余尚辉 4 months ago
parent
commit
67d8c575d7

+ 1 - 1
src/core/callcenter/call.py

@@ -34,7 +34,7 @@ class CallService:
         agent = self.cache.get_agent_info(request.saas_id, request.agent_id)
         route_gateway = self.cache.get_route_gateway(request.saas_id)
         call_info = CallInfo(cti_flow_id=request.cti_flow_id, call_id=call_id, agent_key=agent.agent_number, sip_server=agent.sip_server,
-                             caller=agent.agent_number, called=request.called, direction=Direction.INBOUND.code,
+                             caller=agent.agent_number, called=request.called, direction=Direction.OUTBOUND.code,
                              caller_display=request.caller_display, called_display=request.called_display,
                              call_type=request.call_type, call_time=now, follow_data=request.follow_data,
                              uuid1=request.uuid1, uuid2=request.uuid2, saas_id=saasId,

+ 8 - 8
src/core/callcenter/esl/handler/channel_answer_handler.py

@@ -46,9 +46,9 @@ class ChannelAnswerHandler(EslEventHandler):
         device_info.ring_end_time = EslEventUtil.getEventDateTimestamp(event)
         call_info.answer_count = call_info.answer_count + 1
         call_info.next_commands.remove(next_command)
-        self.logger.info("ysChannelAnswerHandler call_info.answer_time::%s,time:%s", call_info.answer_time, EslEventUtil.getEventDateTimestamp(event))
-        if not call_info.answer_time:
-            call_info.answer_time = EslEventUtil.getEventDateTimestamp(event)
+        # self.logger.info("ysChannelAnswerHandler call_info.answer_time::%s,time:%s", call_info.answer_time, EslEventUtil.getEventDateTimestamp(event))
+        # if not call_info.answer_time:
+        #     call_info.answer_time = EslEventUtil.getEventDateTimestamp(event)
 
         if NextType.NEXT_CALL_OTHER.code == next_command.next_type:
             self.call_other(call_info, device_info, event)
@@ -62,11 +62,11 @@ class ChannelAnswerHandler(EslEventHandler):
             self.logger.warn("can not match command :%s, callId :%s", next_command.next_type, call_id)
         self.cache.add_call_info(call_info)
 
-        if device_info.device_type == DeviceType.AGENT.code:  # 如果是坐席接听 变更坐席状态
-            self.logger.info('坐席接听')
-            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)
+        # if device_info.device_type == DeviceType.AGENT.code:  # 如果是坐席接听 变更坐席状态
+        #     self.logger.info('坐席接听')
+        #     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("lwanswer call_id:%s, call_info:%s, event:%s" % (call_id, call_info, json.loads(event.serialize('json'))))
 

+ 16 - 16
src/core/callcenter/esl/handler/channel_bridge_handler.py

@@ -13,21 +13,21 @@ class ChannelBridgeHandler(EslEventHandler):
 
     def __init__(self, inbound_client, bot_agent):
         super().__init__(inbound_client, bot_agent)
-        # self.dataHandleServer = DataHandleServer(inbound_client.app)
-        # self.push_handler = PushHandler(inbound_client.logger)
+        self.dataHandleServer = DataHandleServer(inbound_client.app)
+        self.push_handler = PushHandler(inbound_client.logger)
 
     def handle(self, address, event, coreUUID):
-        pass
-        # call_id = EslEventUtil.getCallId(event)
-        # device_id = EslEventUtil.getDeviceId(event)
-        # call = self.cache.get_call_info(call_id)
-        # device = call.device_info_map.get(device_id)
-        # # 每通电话的第一次写入应答时间
-        # if not call.answer_time:
-        #     call.answer_time = EslEventUtil.getEventDateTimestamp(event)
-        #     self.cache.add_call_info(call)
-        #     self.dataHandleServer.update_record(call_id, {"status": 1})
-        #     self.logger.info("bridge call_info.answer_time:%s,device_info.answer_time%s,device.device_type%s" % (call.answer_time, device.answer_time,device.device_type))
-        # if device.device_type == DeviceType.AGENT.code: # 如果是坐席接听 变更坐席状态
-        #     self.push_handler.push_on_agent_work_report(call.saas_id, call.cti_flow_id, call.agent_key, call.call_id, AgentScene.ROBOT, WorkStatus.AGENT_ANSWER_INCOMING)
-        #     self.dataHandleServer.update_agent_monitor_service_state(call.agent_key, AgentServiceState.CALLING.code)
+        call_id = EslEventUtil.getCallId(event)
+        device_id = EslEventUtil.getDeviceId(event)
+        call_info = self.cache.get_call_info(call_id)
+        device = call_info.device_info_map.get(device_id)
+        # 每通电话的第一次写入应答时间
+        if not call_info.answer_time:
+            call_info.answer_time = EslEventUtil.getEventDateTimestamp(event)
+            self.cache.add_call_info(call_info)
+            self.dataHandleServer.update_record(call_id, {"status": 1})
+            self.logger.info("bridge call_info.answer_time:%s,device_info.answer_time%s,device.device_type%s" % (call_info.answer_time, device.answer_time,device.device_type))
+        if device.device_type == DeviceType.AGENT.code: # 如果是坐席接听 变更坐席状态
+            # 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)