|
@@ -158,15 +158,16 @@ class ChannelHangupHandler(EslEventHandler):
|
|
hangup_cause.append(value.hangup_cause)
|
|
hangup_cause.append(value.hangup_cause)
|
|
self.logger.info("get_call_info_record: %s", records)
|
|
self.logger.info("get_call_info_record: %s", records)
|
|
if records:
|
|
if records:
|
|
- threading.Thread(target=self._update_record_in_thread, args=(call_info.call_id, records, ",".join(sip_status), ",".join(hangup_cause))).start()
|
|
|
|
|
|
+ threading.Thread(target=self._update_record_in_thread, args=(call_info.call_id, records, ",".join(sip_status), ",".join(hangup_cause),call_info.answer_count)).start()
|
|
else:
|
|
else:
|
|
self.logger.warning("没有找到有效的录音文件")
|
|
self.logger.warning("没有找到有效的录音文件")
|
|
|
|
|
|
- def _update_record_in_thread(self, call_id, records, sip_status, hangup_cause):
|
|
|
|
|
|
+ def _update_record_in_thread(self, call_id, records, sip_status, hangup_cause, answer_count):
|
|
"""用于在独立线程中执行 update_record"""
|
|
"""用于在独立线程中执行 update_record"""
|
|
try:
|
|
try:
|
|
merge_record = self.merge_audio_files(records) if len(records) > 1 else records[0]
|
|
merge_record = self.merge_audio_files(records) if len(records) > 1 else records[0]
|
|
- self.dataHandleServer.update_record(call_id, time_end=datetime.now(), url=merge_record, sip_status=sip_status, sip_hangup_cause=hangup_cause)
|
|
|
|
|
|
+ status = 0 if answer_count<= 0 else 1
|
|
|
|
+ self.dataHandleServer.update_record(call_id, time_end=datetime.now(), url=merge_record, sip_status=sip_status, sip_hangup_cause=hangup_cause, status=status)
|
|
self.logger.info("更新录音记录完成: call_id=%s", call_id)
|
|
self.logger.info("更新录音记录完成: call_id=%s", call_id)
|
|
except Exception as e:
|
|
except Exception as e:
|
|
self.logger.error("更新录音记录失败: call_id=%s, error=%s", call_id, str(e))
|
|
self.logger.error("更新录音记录失败: call_id=%s, error=%s", call_id, str(e))
|