Browse Source

fix record

DavidLiu 3 months ago
parent
commit
26a16a8206
1 changed files with 7 additions and 15 deletions
  1. 7 15
      src/core/callcenter/esl/handler/channel_answer_handler.py

+ 7 - 15
src/core/callcenter/esl/handler/channel_answer_handler.py

@@ -31,10 +31,10 @@ class ChannelAnswerHandler(EslEventHandler):
         device_id = EslEventUtil.getDeviceId(event)
         device_info = call_info.device_info_map.get(device_id)
         if CallType.AGENT_CALL.code == call_info.call_type and device_info.device_type == DeviceType.CUSTOMER.code:
-            self.record(event, device_id)
+            device_info.record = self.record(event, device_id)
 
         if CallType.BOT_CALL.code == call_info.call_type and device_info.device_type == DeviceType.ROBOT.code:
-            self.record(event, device_id)
+            device_info.record = self.record(event, device_id)
             call_info.answer_flag = AnswerFlag.ROBOT_ANSWER.code
             registry.CALL_BOT_ANSWER_REQUESTS.labels(f"{call_info.bucket_type}").inc()
 
@@ -61,13 +61,6 @@ class ChannelAnswerHandler(EslEventHandler):
         else:
             self.logger.warn("can not match command :%s, callId :%s", next_command.next_type, call_id)
 
-        # if device_info.device_type == DeviceType.AGENT.code:  # 如果是坐席接听 变更坐席状态
-        #     call_info.answer_time = EslEventUtil.getEventDateTimestamp(event)
-        #     self.dataHandleServer.update_record(call_id, {"status": 1})
-        #     self.push_handler.push_on_agent_work_report(call_info.saas_id, call_info.cti_flow_id, call_info.agent_key, call_info.call_id, AgentScene.ROBOT,WorkStatus.AGENT_ANSWER_INCOMING)
-        #     self.dataHandleServer.update_agent_monitor_service_state(call_info.agent_key,AgentServiceState.CALLING.code)
-        #     self.logger.info("坐席接听 event:%s" % (json.loads(event.serialize('json'))))
-
         self.cache.add_call_info(call_info)
 
 
@@ -93,7 +86,7 @@ class ChannelAnswerHandler(EslEventHandler):
         route_gateway = self.cache.get_route_gateway(call.saas_id)
         agent = self.cache.get_agent_info(call.saas_id, call.agent_key)
         new_device = DeviceInfo(device_id=new_device_id, call_id=call_id, agent_key=call.agent_key,
-                                called=called, display=call.called_display, caller=call.called_display,
+                                called=called, display=call.called_display, caller=call.called_display, record=record_url,
                                 call_time=now, device_type=DeviceType.CUSTOMER.code, caller_display=route_gateway.name, cdr_type=CdrType.OUTBOUND.code)
         call.next_commands.append(NextCommand(device_id=device_id, next_type=NextType.NEXT_CALL_BRIDGE.code, next_value=new_device_id))
         call.device_info_map[new_device_id] = new_device
@@ -110,7 +103,7 @@ class ChannelAnswerHandler(EslEventHandler):
         self.logger.info("开始桥接电话: callId:%s, caller:%s, called:%s, device1:%s, device2:%s"% (call.call_id,
                          call.caller, call.called, next_command.device_id, next_command.next_value))
         self.logger.info("liuwei::debugger::answer, 33333")
-        self.record(event, device_id=device.device_id)
+        device.record = self.record(event, device_id=device.device_id)
         device1 = call.device_info_map.get(next_command.device_id)
         device2 = call.device_info_map.get(next_command.next_value)
 
@@ -130,7 +123,9 @@ class ChannelAnswerHandler(EslEventHandler):
         if CallType.BOT_CALL.code == call.call_type:
             registry.CALL_BOT_TRANSFER_REQUESTS.labels(f"{call.bucket_type}").inc()
 
-        self.record(event, device_id)
+        device_info = call.device_info_map.get(device_id)
+        device_info.record = self.record(event, device_id)
+
         call.next_commands.append(NextCommand(call.device_list[0], NextType.NEXT_TRANSFER_SUCCESS.code, device_id))
         self.logger.info("转接电话中 callId:%s, from:%s, to:%s "% (call.call_id, device_id, next_command.next_value))
         self.inbound_client.transfer_call(device_id, next_command.next_value)
@@ -166,9 +161,6 @@ class ChannelAnswerHandler(EslEventHandler):
                 _record_url = self.start_recording(device_id, get_record_file_name(call_id, CallStage.AGENT), call)
         else:
             _record_url = self.start_recording(device_id, get_record_file_name(call_id, CallStage.ALL), call)
-        device.record = _record_url
-        self.logger.info("luyincall:%s, device:%s" % (call, device))
-        self.cache.add_call_info(call)
         return _record_url
 
     def start_recording(self, device_id, file_name, call: CallInfo):