Davidliu 2 tháng trước cách đây
mục cha
commit
6e35b159af

+ 4 - 2
src/core/callcenter/api.py

@@ -457,7 +457,7 @@ class CallInfo(BaseApi):
                  hangup_dir=None, sdk_hangup=0, hangup_code=None, answer_time=None, end_time=None, talk_time=None,
                  first_queue_time=None, queue_start_time=None, queue_end_time=None, overflow_count=0,
                  uuid1=None, uuid2=None, cdr_notify_url=None, queue_level=None, transfer_agent=None, bucket_type=None,
-                 user_no_answer_end_call=False, device_list=[], device_info_map: Dict[str, Any] = {}, follow_data: Dict[str, Any] = {},
+                 user_no_answer_end_call=False, hangup_count=0, device_list=[], device_info_map: Dict[str, Any] = {}, follow_data: Dict[str, Any] = {},
                  process_data: Dict[str, Any] = {}, next_commands=[], call_details=[]):
         self.core_uuid = core_uuid  # 通话唯一标识
         self.cti_flow_id = cti_flow_id
@@ -505,6 +505,7 @@ class CallInfo(BaseApi):
         self.transfer_agent = transfer_agent #是否转人工
         self.bucket_type = bucket_type #呼入流量类型
         self.user_no_answer_end_call = user_no_answer_end_call #用户未接听挂机
+        self.hangup_count = hangup_count
         self.device_list = device_list  # 当前通话的设备
         self.device_info_map = device_info_map
         self.follow_data = follow_data  # 呼叫随路数据(作为落单数据)
@@ -539,7 +540,7 @@ class CallInfo(BaseApi):
                    uuid1=data.get('uuid1'), uuid2=data.get('uuid2'), cdr_notify_url=data.get('cdr_notify_url'),
                    queue_level=data.get('queue_level'), transfer_agent=data.get('transfer_agent'),
                    bucket_type=data.get('bucket_type'), user_no_answer_end_call=data.get('user_no_answer_end_call'),
-                   device_list=data.get('device_list', []),device_info_map=device_info_map,
+                   hangup_count=data.get('hangup_count'), device_list=data.get('device_list', []),device_info_map=device_info_map,
                    follow_data=follow_data, process_data=process_data,
                    next_commands=next_commands, call_details=call_details)
 
@@ -594,6 +595,7 @@ class CallInfo(BaseApi):
             "transfer_agent": self.transfer_agent,
             "bucket_type": self.bucket_type,
             "user_no_answer_end_call": self.user_no_answer_end_call,
+            "hangup_count": self.hangup_count,
             "device_list": [x for x in self.device_list],
             "device_info_map": {key: vars(value) for key, value in self.device_info_map.items()},
             "follow_data": {key: vars(value) for key, value in self.follow_data.items()},

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

@@ -90,12 +90,13 @@ class ChannelHangupHandler(EslEventHandler):
             # 计算录音时长
             if device_info.record_start_time:
                 device_info.record_time = int(device_info.end_time) - int(device_info.record_start_time)
+            call_info.hangup_count = call_info.hangup_count + 1
             call_info.device_info_map[device_info.device_id] = device_info
             skip_hangup_all = device_info.device_type == DeviceType.ROBOT.code
             bucket_type = call_info.bucket_type if call_info.bucket_type else "EMPTY"
             registry.CALL_HANGUP_REQUESTS.labels(f"{bucket_type}", f"{device_info.sip_status}").inc()
 
-            self.logger.info('ChannelHangupHandler, hangup_reason=%s, device_type=%s, cdr_type=%s, end_time=%s, skip_hangup_all=%s' % (hangup_reason, device_info.device_type, device_info.cdr_type, call_info.end_time, skip_hangup_all))
+            self.logger.info('ChannelHangupHandler, hangup_reason=%s, device_type=%s, cdr_type=%s, end_time=%s, skip_hangup_all=%s, answer_count=%s, hangup_count=%s' % (hangup_reason, device_info.device_type, device_info.cdr_type, call_info.end_time, skip_hangup_all, call_info.answer_count, call_info.hangup_count))
             # 如果是转人工
             # if 'transferToAgent' == hangup_reason and DeviceType.ROBOT.code == device_info.device_type:
             #     call_info.answer_flag = AnswerFlag.TRANSFER_TO_AGENT.code
@@ -128,7 +129,8 @@ class ChannelHangupHandler(EslEventHandler):
 
             # 全部挂机以后推送挂机状态
             # self.logger.info('yushanghui::call_info.device_list %s', call_info.device_list)
-            if len(call_info.device_list) == 0:
+            if call_info.hangup_count == call_info.answer_count:
+            # if len(call_info.device_list) == 0:
                 self.get_call_info_record(call_info)
 
             # 判断挂机方向 && 更新缓存