DavidLiu 4 місяців тому
батько
коміт
f1153b5e4b
1 змінених файлів з 15 додано та 15 видалено
  1. 15 15
      src/core/callcenter/agent.py

+ 15 - 15
src/core/callcenter/agent.py

@@ -75,14 +75,14 @@ class AgentEventService:
 
 
     def agent_event_channel(self, event, call_info: CallInfo, device_info: DeviceInfo):
     def agent_event_channel(self, event, call_info: CallInfo, device_info: DeviceInfo):
         event_name = EslEventUtil.getEventName(event)
         event_name = EslEventUtil.getEventName(event)
-        saas_id = call_info.saas_id
-        flow_id = call_info.cti_flow_id
-        call_id = call_info.call_id
-        caller = device_info.caller
-        called = device_info.called
-        agent_num = device_info.agent_key
-
-        is_agent = device_info and DeviceType.AGENT.code == device_info.device_type
+        saas_id = call_info.saas_id if call_info else None
+        flow_id = call_info.cti_flow_id if call_info else None
+        call_id = call_info.call_id if call_info else None
+        agent_num = device_info.agent_key if device_info else None
+        caller = device_info.caller if device_info else None
+        called = device_info.called if device_info else None
+        is_agent = (device_info and DeviceType.AGENT.code == device_info.device_type) if device_info else False
+
         agent = self.data_handle_server.get_agent(saas_id, agent_num)
         agent = self.data_handle_server.get_agent(saas_id, agent_num)
         if not agent:
         if not agent:
             self.logger.warn("event service channel agent is null %s %s %s %s %s", saas_id, event_name, caller, called, event.serialize('json'))
             self.logger.warn("event service channel agent is null %s %s %s %s %s", saas_id, event_name, caller, called, event.serialize('json'))
@@ -157,13 +157,13 @@ class AgentEventService:
 
 
     def bot_event_channel(self, event, call_info, device_info):
     def bot_event_channel(self, event, call_info, device_info):
         event_name = EslEventUtil.getEventName(event)
         event_name = EslEventUtil.getEventName(event)
-        saas_id = call_info.saas_id
-        flow_id = call_info.cti_flow_id
-        call_id = call_info.call_id
-        agent_num = device_info.agent_key
-        is_agent = device_info and DeviceType.AGENT.code == device_info.device_type
-        caller = device_info.called if is_agent else device_info.caller
-        called = device_info.caller if is_agent else device_info.called
+        saas_id = call_info.saas_id if call_info else None
+        flow_id = call_info.cti_flow_id if call_info else None
+        call_id = call_info.call_id if call_info else None
+        agent_num = device_info.agent_key if device_info else None
+        is_agent = (device_info and DeviceType.AGENT.code == device_info.device_type) if device_info else False
+        caller = (device_info.called if is_agent else device_info.caller) if device_info else None
+        called = (device_info.caller if is_agent else device_info.called) if device_info else None
         human_service_id = '00000000000000000'
         human_service_id = '00000000000000000'
 
 
         agent = self.data_handle_server.get_agent(saas_id, agent_num)
         agent = self.data_handle_server.get_agent(saas_id, agent_num)