def _on_bus_transfer_answered(self, body): event_name = body.get('name') if event_name == 'transfer_answered': event = Marshaler.unmarshal_message(body, AnswerTransferEvent) if event.transfer['flow'] == 'attended': self._task_queue.put(self._transfer_answered, event.transfer['initiator_uuid']) elif event_name == 'transfer_cancelled': event = Marshaler.unmarshal_message(body, CancelTransferEvent) if event.transfer['flow'] == 'attended': self._task_queue.put(self._transfer_cancelled, event.transfer['initiator_uuid'])
def _on_bus_user_status_update_event(self, body): try: event = Marshaler.unmarshal_message(body, UserStatusUpdateEvent) except KeyError as e: logger.info( '_on_bus_user_status_update_event: received an incomplete event: %s', e) else: self._task_queue.put(self._on_new_presence, event.id_, event.status)