コード例 #1
0
    def test_new_caller_id_no_cid_name(self):
        uid = 127984.33
        self._va.set(uid, Var('xivo', 'calleridname', sentinel.name))
        self._va.set(uid, Var('xivo', 'calleridnum', '666'))

        self.updater.new_caller_id(uid, '', sentinel.num)

        assert_that(self._va.get(uid)['xivo']['calleridname'], equal_to(sentinel.name))
        assert_that(self._va.get(uid)['xivo']['calleridnum'], equal_to(sentinel.num))
コード例 #2
0
    def setUp(self):
        self.channel_1 = {
            'id': 'SIP/abcdef-2135543',
            'context': 'testctx',
            'cid_name': 'Alice',
            'cid_number': '1234',
            'unique_id': 786234234.33
        }
        channel_1 = Channel(self.channel_1['id'], self.channel_1['context'],
                            self.channel_1['unique_id'])
        self.channel_2 = {
            'id': 'SCCP/123-2135543',
            'context': 'testctx',
            'cid_number': '1234',
            'unique_id': 123456.43
        }
        channel_2 = Channel(self.channel_2['id'], self.channel_2['context'],
                            self.channel_2['unique_id'])
        self.channel_3 = {
            'id': 'SCCP/123-9643244',
            'context': 'testctx',
            'cid_number': '6543',
            'unique_id': 987654.32
        }
        channel_3 = Channel(self.channel_3['id'], self.channel_3['context'],
                            self.channel_3['unique_id'])

        self.innerdata = Mock(innerdata.Safe)
        self.innerdata.channels = {
            self.channel_1['id']: channel_1,
            self.channel_2['id']: channel_2,
            self.channel_3['id']: channel_3,
        }
        self.call_form_variable_aggregator = VariableAggregator()
        self.call_form_variable_aggregator.set(
            self.channel_1['unique_id'],
            Var('xivo', 'calleridname', self.channel_1['cid_name']),
        )
        self.call_form_variable_aggregator.set(
            self.channel_1['unique_id'],
            Var('xivo', 'calleridnum', self.channel_1['cid_number']),
        )
        self.call_form_variable_aggregator.set(
            self.channel_2['unique_id'],
            Var('xivo', 'calleridnum', self.channel_2['cid_number']),
        )
        self._channel_dao = ChannelDAO(self.innerdata,
                                       self.call_form_variable_aggregator)
コード例 #3
0
    def test_clean(self):
        self._va.set(sentinel.uid,
                     Var(sentinel.type, sentinel.name, sentinel.value))

        self._va.clean(sentinel.uid)

        assert_that(self._va._vars, equal_to({}))
コード例 #4
0
    def test_set(self):
        self._va.set(sentinel.uid,
                     Var(sentinel.type, sentinel.name, sentinel.value))

        assert_that(self._va.get(sentinel.uid),
                    equal_to({sentinel.type: {
                        sentinel.name: sentinel.value
                    }}))
コード例 #5
0
ファイル: amiinterpret.py プロジェクト: alexis-via/xivo-ctid
 def userevent_dialplan2cti(self, chanprops, event):
     # why "UserEvent + dialplan2cti" and not "Newexten + Set" ?
     # - more selective
     # - variables declarations are not always done with Set (Read(), AGI(), ...)
     # - if there is a need for extra useful data (XIVO_USERID, ...)
     # - (future ?) multiple settings at once
     uniqueid = event['Uniqueid']
     cti_varname = event.get('VARIABLE')
     dp_value = event.get('VALUE')
     self._aggregator.set(uniqueid, Var('dp', cti_varname, dp_value))
コード例 #6
0
 def reverse_lookup_result(self, uid, event):
     for key, value in event.iteritems():
         if key.startswith('db-'):
             key = key.split('-', 1)[-1]
             self._aggregator.set(uid, Var('db', key, value))
コード例 #7
0
 def new_caller_id(self, uid, name, number):
     logger.debug('New caller ID received on channel %s: "%s" <%s>', uid,
                  name, number)
     if name:
         self._aggregator.set(uid, Var('xivo', 'calleridname', name))
     self._aggregator.set(uid, Var('xivo', 'calleridnum', number))
コード例 #8
0
ファイル: amiinterpret.py プロジェクト: alexis-via/xivo-ctid
 def _set(var_name, var_value):
     self._aggregator.set(uniqueid, Var('xivo', var_name, var_value))
コード例 #9
0
 def setUp(self):
     self._va = VariableAggregator()
     self._var = Var(sentinel.type, sentinel.name, sentinel.value)