|
@@ -3,6 +3,7 @@
|
|
import json
|
|
import json
|
|
import time
|
|
import time
|
|
from datetime import datetime
|
|
from datetime import datetime
|
|
|
|
+import src.core.registry as Registry
|
|
from src.core.callcenter.constant import saasId, get_record_prefix, get_record_file_name
|
|
from src.core.callcenter.constant import saasId, get_record_prefix, get_record_file_name
|
|
from src.core.callcenter.enumeration import NextType, AnswerFlag, Direction, DeviceType, AgentScene, CdrType, CallType, \
|
|
from src.core.callcenter.enumeration import NextType, AnswerFlag, Direction, DeviceType, AgentScene, CdrType, CallType, \
|
|
CallStage
|
|
CallStage
|
|
@@ -101,6 +102,10 @@ class ChannelAnswerHandler(EslEventHandler):
|
|
def call_bridge(self, call: CallInfo, device: DeviceInfo, next_command: NextCommand, event):
|
|
def call_bridge(self, call: CallInfo, device: DeviceInfo, next_command: NextCommand, event):
|
|
self.logger.info("开始桥接电话: callId:%s, caller:%s, called:%s, device1:%s, device2:%s"% (call.call_id,
|
|
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))
|
|
call.caller, call.called, next_command.device_id, next_command.next_value))
|
|
|
|
+ if CallType.BOT_CALL.code == call.call_type:
|
|
|
|
+ call.answer_flag = AnswerFlag.ROBOT_ANSWER.code
|
|
|
|
+ Registry.counter('call_incoming_bot_answer_requests', '呼入机器人接听量',['bucket_type', str(call.bucket_type)]).inc()
|
|
|
|
+
|
|
self.record(event, device_id=device.device_id)
|
|
self.record(event, device_id=device.device_id)
|
|
device1 = call.device_info_map.get(next_command.device_id)
|
|
device1 = call.device_info_map.get(next_command.device_id)
|
|
device2 = call.device_info_map.get(next_command.next_value)
|
|
device2 = call.device_info_map.get(next_command.next_value)
|
|
@@ -117,6 +122,9 @@ class ChannelAnswerHandler(EslEventHandler):
|
|
# 转接电话 deviceInfo为被转接设备
|
|
# 转接电话 deviceInfo为被转接设备
|
|
from_device_id = next_command.device_id
|
|
from_device_id = next_command.device_id
|
|
device_id = EslEventUtil.getDeviceId(event)
|
|
device_id = EslEventUtil.getDeviceId(event)
|
|
|
|
+ call.answer_flag = AnswerFlag.AGENT_ANSWER.code
|
|
|
|
+ if CallType.BOT_CALL.code == call.call_type:
|
|
|
|
+ Registry.counter('call_incoming_transfer_requests', '呼入机器人转人量',['bucket_type', str(call.bucket_type)]).inc()
|
|
self.record(event, device_id)
|
|
self.record(event, device_id)
|
|
call.next_commands.append(NextCommand(device_id, NextType.NEXT_TRANSFER_SUCCESS.code, call.device_list[1]))
|
|
call.next_commands.append(NextCommand(device_id, NextType.NEXT_TRANSFER_SUCCESS.code, call.device_list[1]))
|
|
self.logger.info("转接电话中 callId:%s, from:%s, to:%s "% (call.call_id, from_device_id, device_id))
|
|
self.logger.info("转接电话中 callId:%s, from:%s, to:%s "% (call.call_id, from_device_id, device_id))
|
|
@@ -124,6 +132,7 @@ class ChannelAnswerHandler(EslEventHandler):
|
|
self.logger.info("转接完成 callId:%s, from:%s, to:%s "% (call.call_id, device_id, call.device_list[0]))
|
|
self.logger.info("转接完成 callId:%s, from:%s, to:%s "% (call.call_id, device_id, call.device_list[0]))
|
|
self.inbound_client.bridge_call(call.call_id, device_id, call.device_list[0])
|
|
self.inbound_client.bridge_call(call.call_id, device_id, call.device_list[0])
|
|
|
|
|
|
|
|
+
|
|
def listen(self, call: CallInfo, device: DeviceInfo, next_command: NextCommand, event):
|
|
def listen(self, call: CallInfo, device: DeviceInfo, next_command: NextCommand, event):
|
|
device_id = EslEventUtil.getDeviceId(event)
|
|
device_id = EslEventUtil.getDeviceId(event)
|
|
self.logger.info("开始监听 callId:%s, deviceId:%s, nextCommandDeviceId:%s", call.call_id, device_id, next_command.next_value)
|
|
self.logger.info("开始监听 callId:%s, deviceId:%s, nextCommandDeviceId:%s", call.call_id, device_id, next_command.next_value)
|