Davidliu 2 月之前
父節點
當前提交
ee76780939
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6 4
      src/core/callcenter/esl/handler/channel_hangup_handler.py

+ 6 - 4
src/core/callcenter/esl/handler/channel_hangup_handler.py

@@ -184,7 +184,7 @@ class ChannelHangupHandler(EslEventHandler):
                 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()
+            threading.Thread(target=self._update_record_in_thread, args=(call_info, 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()
@@ -195,20 +195,22 @@ class ChannelHangupHandler(EslEventHandler):
             return agent
         except Exception as e:
             self.logger.error("update_name error: %s", str(e))
-    def _update_record_in_thread(self, call_id, records, sip_status, hangup_cause, agent_name):
+    def _update_record_in_thread(self, call_info, records, sip_status, hangup_cause, agent_name):
         """用于在独立线程中执行 update_record"""
         try:
+            call_id = call_info.call_id
+            hangup_dir = call_info.hangup_dir
             agent = self.update_name(call_id, agent_name)
             # status = 0 if answer_count <= 0 else 1
             if len(records) == 0:
-                self.logger.warning("没有录音文件,直接更新记录: call_id=%s, sip_status=%s, hangup_cause=%s, agent_name=%s", call_id, sip_status, hangup_cause,agent_name)
+                self.logger.warning("没有录音文件,直接更新记录: call_id=%s, sip_status=%s, hangup_cause=%s, agent_name=%s, hangup_dir=%s", call_id, sip_status, hangup_cause,agent_name, hangup_dir)
                 self.dataHandleServer.update_record(call_id, time_end=datetime.now(), sip_status=sip_status, sip_hangup_cause=hangup_cause,user_id=agent.user_id if agent else None, user_name=agent.agent_name if agent else None)
                 return
             merge_record = self.merge_audio_files(records) if len(records) > 1 else records[0]
             # 计算录音时长
             duration = self.get_audio_duration(merge_record) or 0
             self.dataHandleServer.update_record(call_id, times=int(duration), time_end=datetime.now(), url=merge_record, sip_status=sip_status, sip_hangup_cause=hangup_cause,user_id=agent.user_id if agent else None, user_name=agent.agent_name if agent else None)
-            self.logger.info("更新录音记录完成: call_id=%s, duration=%s", call_id, int(duration))
+            self.logger.info("更新录音记录完成: call_id=%s, duration=%s, hangup_dir=%s", call_id, int(duration), hangup_dir)
         except Exception as e:
             self.logger.error("更新录音记录失败: call_id=%s, error=%s", call_id, str(e))