示例#1
0
    def test_when_channel_1_is_local(self):
        self.storage._calls = {
            u'1395685236.26':
            Call(
                _Channel(Extension('1009', 'default', True),
                         'SIP/1uzh6d-0000000e'),
                _Channel(Extension('', '', True),
                         'Local/102@default-00000006;1'),
            ),
            u'1395685237.28':
            Call(
                _Channel(Extension('', '', True),
                         'Local/102@default-00000006;2'),
                _Channel(Extension('1002', 'default', True),
                         'SIP/8o5zja-0000000f'),
            ),
        }

        self.storage.merge_local_channels('Local/102@default-00000006;')

        expected = {
            u'1395685237.28':
            Call(
                _Channel(Extension('1009', 'default', True),
                         'SIP/1uzh6d-0000000e'),
                _Channel(Extension('1002', 'default', True),
                         'SIP/8o5zja-0000000f'),
            ),
        }

        assert_that(self.storage._calls, equal_to(expected))
示例#2
0
    def _create_call(self,
                     uniqueid=None,
                     destuniqueid=None,
                     source_exten=Mock(Extension),
                     destination_exten=Mock(Extension),
                     source_channel=sentinel.source_channel,
                     destination_channel=sentinel.destination_channel):
        source = _Channel(source_exten, source_channel)
        destination = _Channel(destination_exten, destination_channel)

        self.storage.new_call(uniqueid, destuniqueid, source, destination)

        self.call_notifier.reset_mock()
        self.endpoint_notifier.reset_mock()

        return Call(source, destination)
    def test_route_device_in_use_outgoing_external(self):
        is_internal = False
        extension = Extension(number=NUMBER,
                              context=CONTEXT,
                              is_internal=is_internal)
        expected_is_internal = is_internal
        expected_direction = CallDirection.outgoing
        status = EndpointStatus.talking
        source_channel = _Channel(extension, sentinel.source_channel)
        destination_channel = _Channel(Mock(Extension),
                                       sentinel.destination_channel)
        calls = [Call(source_channel, destination_channel)]
        event = EndpointEvent(extension, status, calls)

        self.router.route(AGENT_ID, event)

        self.status_manager.device_in_use.assert_called_once_with(
            AGENT_ID, expected_direction, expected_is_internal)
示例#4
0
 def setUp(self):
     super(TestFindAllCallsForExtension, self).setUp()
     self.default_call = Call(SOURCE, DESTINATION)