DavidLiu hai 3 meses
pai
achega
2073eec4f7

+ 5 - 3
src/core/callcenter/esl/handler/channel_answer_handler.py

@@ -38,15 +38,17 @@ class ChannelAnswerHandler(EslEventHandler):
             call_info.answer_flag = AnswerFlag.ROBOT_ANSWER.code
             registry.CALL_BOT_ANSWER_REQUESTS.labels(f"{call_info.bucket_type}").inc()
 
+        device_info.answer_time = EslEventUtil.getEventDateTimestamp(event)
+        device_info.ring_end_time = EslEventUtil.getEventDateTimestamp(event)
+        call_info.answer_count = call_info.answer_count + 1
+
         next_command = call_info.next_commands[0] if len(call_info.next_commands) > 0 else None
         device_type = DeviceType.get_by_code(device_info.device_type)
         self.logger.info("ChannelAnswerHandler call_id:%s, device_id:%s, device_type:%s, next_command:%s"%(call_id, device_id, device_type, next_command))
         if not next_command:
+            self.cache.add_call_info(call_info)
             return
 
-        device_info.answer_time = EslEventUtil.getEventDateTimestamp(event)
-        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("ChannelAnswerHandler call_info.answer_time::%s,time:%s", call_info.answer_time, EslEventUtil.getEventDateTimestamp(event))
 

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

@@ -116,6 +116,8 @@ class ChannelHangupHandler(EslEventHandler):
                 # self.inbound_client.hangup_call(call_id, device_id, CallCause.HANGUP_EVENT)
 
             if CallType.BOT_CALL.code == call_info.call_type and device_info.device_type == DeviceType.ROBOT.code:
+                if not device_info.answer_time:
+                    registry.CALL_BOT_NO_ANSWER_ERROR_REQUESTS.labels(f"{call_info.bucket_type}", f"{device_info.sip_status}").inc()
                 registry.CALL_BOT_HANGUP_REQUESTS.labels(f"{call_info.bucket_type}", f"{device_info.sip_status}").inc()
 
             # 全部挂机以后推送挂机状态

+ 2 - 1
src/core/callcenter/registry.py

@@ -14,7 +14,8 @@ metrics = PrometheusMetrics(app)
 CALL_INCOMING_REQUESTS = Counter('call_incoming_requests', '呼入总流量', ['bucket'])
 CALL_BOT_ANSWER_REQUESTS = Counter('call_bot_answer_requests', '机器人接听量', ['bucket'])
 CALL_BOT_TRANSFER_REQUESTS = Counter('call_bot_transfer_requests', '机器转人量', ['bucket'])
-CALL_BOT_HANGUP_REQUESTS = Counter('call_bot_hangup_requests', '机器挂机量', ['bucket','sip_status'])
+CALL_BOT_HANGUP_REQUESTS = Counter('call_bot_hangup_requests', '机器人挂机量', ['bucket','sip_status'])
+CALL_BOT_NO_ANSWER_ERROR_REQUESTS = Counter('call_bot_no_answer_error_requests', '机器人未接听异常数', ['bucket','sip_status'])
 
 
 BOT_REQUEST_COUNT = Counter('bot_request_count',  'Total number of bot requests')