Esempio n. 1
0
 def on_ami_queue_member(self, ami_event):
     queue_name = ami_event['Queue']
     member_name = ami_event['Name']
     queue_member = self._queue_member_manager.get_queue_member_by_name(queue_name, member_name)
     if queue_member is not None:
         new_state = QueueMemberState.from_ami_queue_member(ami_event)
         self._queue_member_manager._update_queue_member(queue_member, new_state)
Esempio n. 2
0
 def on_ami_queue_member(self, ami_event):
     queue_name = ami_event['Queue']
     member_name = ami_event['Name']
     queue_member = self._queue_member_manager.get_queue_member_by_name(
         queue_name, member_name)
     if queue_member is not None:
         new_state = QueueMemberState.from_ami_queue_member(ami_event)
         self._queue_member_manager._update_queue_member(
             queue_member, new_state)
Esempio n. 3
0
    def test_from_ami_queue_member(self):
        ami_event = {
            'Queue': 'foobar',
            'Name': 'Agent/2',
            'Location': 'SIP/abcdef',
            'Membership': 'dynamic',
            'Penalty': '1',
            'CallsTaken': '42',
            'LastCall': '1355154813',
            'Status': '1',
            'Paused': '1',
            'Skills': 'agent-17',
        }
        expected_state = QueueMemberState()
        expected_state.calls_taken = 42
        expected_state.interface = 'SIP/abcdef'
        expected_state.last_call = datetime.fromtimestamp(1355154813)
        expected_state.paused = True
        expected_state.penalty = 1
        expected_state.status = '1'

        state = QueueMemberState.from_ami_queue_member(ami_event)

        self.assertEqual(state, expected_state)