Davidliu hai 3 meses
pai
achega
22506c7c4b

+ 2 - 1
src/core/callcenter/agent.py

@@ -180,6 +180,7 @@ class AgentEventService:
         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
+        device_id = device_info.device_id if device_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
@@ -188,7 +189,7 @@ class AgentEventService:
 
         start_time = time.time()
         try:
-            self.logger.info('bot_event_channel, event_name=%s, call_id=%s, is_agent=%s, agent_num=%s', event_name, call_id, is_agent, agent_num)
+            self.logger.info('bot_event_channel, event_name=%s, call_id=%s, device_id=%s, is_agent=%s, agent_num=%s', event_name, call_id, device_id, is_agent, agent_num)
             agent = self.data_handle_server.get_agent(saas_id, agent_num)
             if not agent:
                 # self.logger.warn("bot event service channel agent is null %s %s %s %s %s", saas_id, event_name, caller, called,

+ 14 - 9
src/core/callcenter/esl/handler/channel_hangup_handler.py

@@ -129,7 +129,7 @@ class ChannelHangupHandler(EslEventHandler):
 
             # 全部挂机以后推送挂机状态
             # self.logger.info('yushanghui::call_info.device_list %s', call_info.device_list)
-            if call_info.hangup_count == call_info.answer_count:
+            if call_info.hangup_count >= call_info.answer_count:
             # if len(call_info.device_list) == 0:
                 self.get_call_info_record(call_info)
 
@@ -155,14 +155,19 @@ class ChannelHangupHandler(EslEventHandler):
         sip_status = []
         hangup_cause = []
         agent_name = ''
-        for value in call_info.device_info_map.values():
-            records.append(value.record) if value.record else None
-            sip_status.append(value.sip_status if value.sip_status else 'EMPTY')
-            hangup_cause.append(value.hangup_cause if value.hangup_cause else 'EMPTY')
-            if value.device_type == DeviceType.AGENT.code :
-                agent_name = value.agent_key
-        self.logger.info("get_call_info_record: %s,agent_name:%s, sip_status:%s, hangup_cause:%s", records, agent_name, sip_status, hangup_cause)
-        threading.Thread(target=self._update_record_in_thread, args=(call_info.call_id, list(dict.fromkeys(records)), ",".join(sip_status), ",".join(hangup_cause), agent_name)).start()
+        try:
+            self.logger.info("get_call_info_record: %s", call_info)
+            for value in call_info.device_info_map.values():
+                records.append(value.record) if value.record else None
+                sip_status.append(value.sip_status if value.sip_status else 'EMPTY')
+                hangup_cause.append(value.hangup_cause if value.hangup_cause else 'EMPTY')
+                if value.device_type == DeviceType.AGENT.code :
+                    agent_name = value.agent_key
+            self.logger.info("get_call_info_record: %s,agent_name:%s, sip_status:%s, hangup_cause:%s", records, agent_name, sip_status, hangup_cause)
+            threading.Thread(target=self._update_record_in_thread, args=(call_info.call_id, list(dict.fromkeys(records)), ",".join(sip_status), ",".join(hangup_cause), agent_name)).start()
+        except Exception as e:
+            self.logger.info("get_call_info_record:exception %s", e)
+            traceback.print_exc()
 
     def update_name(self,call_id, agent_name):
         try: