예제 #1
0
    def validate(self, extension):
        if self._is_pattern(extension.exten):
            return

        context = self.dao.get_by_name(extension.context)

        if extension.conference and not self._exten_in_range(
            extension.exten, context.conference_room_ranges
        ):
            raise errors.outside_context_range(extension.exten, extension.context)

        if extension.group and not self._exten_in_range(
            extension.exten, context.group_ranges
        ):
            raise errors.outside_context_range(extension.exten, extension.context)

        if extension.incall and not self._exten_in_range(
            extension.exten, context.incall_ranges
        ):
            raise errors.outside_context_range(extension.exten, extension.context)

        if extension.lines and not self._exten_in_range(
            extension.exten, context.user_ranges
        ):
            raise errors.outside_context_range(extension.exten, extension.context)

        if extension.queue and not self._exten_in_range(
            extension.exten, context.queue_ranges
        ):
            raise errors.outside_context_range(extension.exten, extension.context)
예제 #2
0
    def validate_exten_is_in_context_user_range(self, extension):
        if self._is_pattern(extension.exten):
            return

        context = self._context_dao.get_by_name(extension.context)
        if not self._exten_in_range(extension.exten, context.user_ranges):
            raise errors.outside_context_range(extension.exten, extension.context)
예제 #3
0
 def validate(self, extension):
     context_ranges = self.dao.find_all_context_ranges(extension.context)
     if not self.extension_in_range(extension.exten, context_ranges):
         raise errors.outside_context_range(extension.exten,
                                            extension.context)
예제 #4
0
def validate_extension_in_range(extension):
    if not is_extension_valid_for_context(extension):
        raise errors.outside_context_range(extension.exten, extension.context)