Davidliu 1 місяць тому
батько
коміт
b9e6eee7f5
2 змінених файлів з 13 додано та 10 видалено
  1. 6 6
      src/core/callcenter/agent.py
  2. 7 4
      src/core/callcenter/esl/client.py

+ 6 - 6
src/core/callcenter/agent.py

@@ -93,14 +93,13 @@ class AgentEventService:
 
         start_time = time.time()
         try:
-            self.logger.info('agent_event_channel, event_name=%s, call_id=%s, event_time=%s, agent_num=%s, device_id=%s, is_agent=%s, hangup_dir=%s, hangup_count=%s, answer_count=%s', event_name, call_id, event_time, agent_num, device_id, is_agent, call_info.hangup_dir, call_info.hangup_count, call_info.answer_count)
             agent = self.data_handle_server.get_agent(saas_id, agent_num)
             if not agent:
-                # self.logger.warn("event service channel agent is null %s %s %s %s %s", saas_id, event_name, caller, called, json.loads(event.serialize('json')))
+                self.logger.warn("agent_event_channel:return, agent is null %s %s %s %s %s", saas_id, event_name, event_time, caller, called)
                 return
             agent_monitor = self.data_handle_server.get_agent_monitor(saas_id, agent_num)
             if not agent_monitor:
-                # self.logger.warn("event service channel agentMonitor is null %s %s %s %s %s", saas_id, event_name, caller, called, json.loads(event.serialize('json')))
+                self.logger.warn("agent_event_channel:return, agentMonitor is null %s %s %s %s %s", saas_id, event_name, event_time, caller, called)
                 return
 
             # 信道发起事件,触发完成发起(或桥)&& 坐席侧
@@ -181,6 +180,7 @@ class AgentEventService:
             registry.ESL_EVENT_CALLBACK_COST.labels(event_name, "agent").observe(time_cost)
             latency = (time.time() - event_timestamp) * 1000
             registry.ESL_EVENT_CALLBACK_LATENCY.labels(event_name, "agent").observe(latency)
+            self.logger.info('agent_event_channel, event_name=%s, time_cost=%s, latency=%s, call_id=%s, event_time=%s, agent_num=%s, device_id=%s, is_agent=%s, hangup_dir=%s, hangup_count=%s, answer_count=%s', event_name, time_cost, latency, call_id, event_time, agent_num, device_id, is_agent, call_info.hangup_dir, call_info.hangup_count, call_info.answer_count)
 
     def bot_event_channel(self, event, call_info, device_info):
         event_name = EslEventUtil.getEventName(event)
@@ -198,14 +198,13 @@ class AgentEventService:
 
         start_time = time.time()
         try:
-            self.logger.info('bot_event_channel, event_name=%s, call_id=%s, device_id=%s, event_time=%s, is_agent=%s, agent_num=%s, hangup_dir=%s, hangup_count=%s, answer_count=%s', event_name, call_id, device_id, event_time, is_agent, agent_num, call_info.hangup_dir, call_info.hangup_count, call_info.answer_count)
             agent = self.data_handle_server.get_agent(saas_id, agent_num)
             if not agent:
-                self.logger.warn("bot event service channel agent is null %s %s %s %s %s", saas_id, event_name, call_id, caller, called)
+                self.logger.warn("bot_event_channel:return, agent is null %s %s %s %s %s %s", saas_id, event_name, event_time, call_id, caller, called)
                 return
             agent_monitor = self.data_handle_server.get_agent_monitor(saas_id, agent_num)
             if not agent_monitor:
-                self.logger.warn("bot event service channel agentMonitor is null %s %s %s %s %s", saas_id, event_name, call_id, caller, called)
+                self.logger.warn("bot_event_channel:return, agentMonitor is null %s %s %s %s %s %s ", saas_id, event_name, event_time, call_id, caller, called)
                 return
 
             # 信道发起事件,触发完成发起(或桥)&& 坐席侧
@@ -250,6 +249,7 @@ class AgentEventService:
             registry.ESL_EVENT_CALLBACK_COST.labels(event_name, "bot").observe(time_cost)
             latency = (time.time() - event_timestamp) * 1000
             registry.ESL_EVENT_CALLBACK_LATENCY.labels(event_name, "bot").observe(latency)
+            self.logger.info('bot_event_channel, event_name=%s, time_cost=%s, latency=%s, call_id=%s, device_id=%s, event_time=%s, is_agent=%s, agent_num=%s, hangup_dir=%s, hangup_count=%s, answer_count=%s', event_name, time_cost, latency, call_id, device_id, event_time, is_agent, agent_num, call_info.hangup_dir, call_info.hangup_count, call_info.answer_count)
 
     def reprocessing_idle(self, state_data: AgentDelayStateData):
         agent = self.data_handle_server.get_agent(state_data.saas_id, state_data.agent_num)

+ 7 - 4
src/core/callcenter/esl/client.py

@@ -107,8 +107,6 @@ class InboundClient:
 
     def choose_thread_pool_executor(self, e):
         event_name = EslEventUtil.getEventName(e)
-        event_timestamp = EslEventUtil.getEventTimestamp(e)
-        event_time = datetime.fromtimestamp(event_timestamp).strftime('%Y-%m-%d %H:%M:%S')
         call_id = EslEventUtil.getCallId(e)
         device_id = EslEventUtil.getUniqueId(e)
         wdh_device_id = EslEventUtil.getDeviceId(e)
@@ -117,7 +115,7 @@ class InboundClient:
             random_index = abs(mmh3.hash(random_id)) % len(self.executors)
         else:
             random_index = random.randint(0, len(self.executors) - 1) if self.executors else 0
-        self.logger.info('choose_thread_pool_executor:event_name=%s, random_index=%s, call_id=%s, unique_id=%s, device_id=%s, event_time=%s', event_name, random_index, call_id, device_id, wdh_device_id, event_time)
+        # self.logger.info('choose_thread_pool_executor:event_name=%s, random_index=%s, call_id=%s, unique_id=%s, device_id=%s, event_time=%s', event_name, random_index, call_id, device_id, wdh_device_id, event_time)
         return self.executors.get(random_index)
 
     def process_esl_event(self, e):
@@ -125,8 +123,12 @@ class InboundClient:
         start_time = time.time()
         event_name = EslEventUtil.getEventName(e)
         coreUUID = EslEventUtil.getCoreUuid(e)
-        address = self.host + ':' + self.port
+        call_id = EslEventUtil.getCallId(e)
+        device_id = EslEventUtil.getUniqueId(e)
+        wdh_device_id = EslEventUtil.getDeviceId(e)
         event_timestamp = EslEventUtil.getEventTimestamp(e)
+        event_time = datetime.fromtimestamp(event_timestamp).strftime('%Y-%m-%d %H:%M:%S')
+        address = self.host + ':' + self.port
         # self.logger.info("process_esl_event.event_name=%s,coreUUID=%s", event_name, coreUUID)
         try:
             self.callback.callback_event(e)
@@ -147,6 +149,7 @@ class InboundClient:
             registry.ESL_EVENT_COST.labels(event_name).observe(time_cost)
             latency = (time.time() - event_timestamp) * 1000
             registry.ESL_EVENT_LATENCY.labels(event_name).observe(latency)
+            self.logger.info('process_esl_event:event_name=%s, time_cost=%s, latency=%s, call_id=%s, unique_id=%s, device_id=%s, event_time=%s', event_name, time_cost, latency, call_id, device_id, wdh_device_id, event_time)
 
     def do_delay_action(self, action, message):
         delay_action = DelayAction.from_json(message)