|
@@ -24,23 +24,25 @@ class ChannelAnswerHandler(EslEventHandler):
|
|
def handle(self, address, event, coreUUID):
|
|
def handle(self, address, event, coreUUID):
|
|
call_id = EslEventUtil.getCallId(event)
|
|
call_id = EslEventUtil.getCallId(event)
|
|
call_info = self.cache.get_call_info(call_id)
|
|
call_info = self.cache.get_call_info(call_id)
|
|
- self.logger.info("liuwei::debugger::answer call_id:%s, call_info:%s", call_id, call_info)
|
|
|
|
|
|
+ self.logger.info("answer call_id:%s, call_info:%s", call_id, call_info)
|
|
if not call_info:
|
|
if not call_info:
|
|
return
|
|
return
|
|
|
|
|
|
device_id = EslEventUtil.getDeviceId(event)
|
|
device_id = EslEventUtil.getDeviceId(event)
|
|
device_info = call_info.device_info_map.get(device_id)
|
|
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:
|
|
if CallType.AGENT_CALL.code == call_info.call_type and device_info.device_type == DeviceType.CUSTOMER.code:
|
|
|
|
+ self.logger.info("liuwei::debugger::answer, 11111")
|
|
self.record(event, device_id)
|
|
self.record(event, device_id)
|
|
|
|
|
|
if CallType.BOT_CALL.code == call_info.call_type and device_info.device_type == DeviceType.ROBOT.code:
|
|
if CallType.BOT_CALL.code == call_info.call_type and device_info.device_type == DeviceType.ROBOT.code:
|
|
|
|
+ self.logger.info("liuwei::debugger::answer, 22222")
|
|
self.record(event, device_id)
|
|
self.record(event, device_id)
|
|
call_info.answer_flag = AnswerFlag.ROBOT_ANSWER.code
|
|
call_info.answer_flag = AnswerFlag.ROBOT_ANSWER.code
|
|
registry.CALL_BOT_ANSWER_REQUESTS.labels(f"{call_info.bucket_type}").inc()
|
|
registry.CALL_BOT_ANSWER_REQUESTS.labels(f"{call_info.bucket_type}").inc()
|
|
|
|
|
|
next_command = call_info.next_commands[0] if len(call_info.next_commands) > 0 else None
|
|
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)
|
|
device_type = DeviceType.get_by_code(device_info.device_type)
|
|
- self.logger.info("liuwei::debugger::ChannelAnswerHandler call_id:%s, device_id:%s, device_type:%s, next_command:%s"%(call_id, device_id, device_type, next_command))
|
|
|
|
|
|
+ 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:
|
|
if not next_command:
|
|
return
|
|
return
|
|
|
|
|
|
@@ -48,7 +50,7 @@ class ChannelAnswerHandler(EslEventHandler):
|
|
device_info.ring_end_time = EslEventUtil.getEventDateTimestamp(event)
|
|
device_info.ring_end_time = EslEventUtil.getEventDateTimestamp(event)
|
|
call_info.answer_count = call_info.answer_count + 1
|
|
call_info.answer_count = call_info.answer_count + 1
|
|
call_info.next_commands.remove(next_command)
|
|
call_info.next_commands.remove(next_command)
|
|
- self.logger.info("liuwei::debugger::ChannelAnswerHandler call_info.answer_time::%s,time:%s", call_info.answer_time, EslEventUtil.getEventDateTimestamp(event))
|
|
|
|
|
|
+ self.logger.info("ChannelAnswerHandler call_info.answer_time::%s,time:%s", call_info.answer_time, EslEventUtil.getEventDateTimestamp(event))
|
|
|
|
|
|
if NextType.NEXT_CALL_OTHER.code == next_command.next_type:
|
|
if NextType.NEXT_CALL_OTHER.code == next_command.next_type:
|
|
self.call_other(call_info, device_info, event)
|
|
self.call_other(call_info, device_info, event)
|
|
@@ -76,6 +78,7 @@ class ChannelAnswerHandler(EslEventHandler):
|
|
device_id = device.device_id
|
|
device_id = device.device_id
|
|
|
|
|
|
# 启用录音, 生产时候打开
|
|
# 启用录音, 生产时候打开
|
|
|
|
+ self.logger.info("liuwei::debugger::answer, 33333")
|
|
record_url = self.record(event, device_id)
|
|
record_url = self.record(event, device_id)
|
|
device.record = record_url
|
|
device.record = record_url
|
|
device.record_start_time = device.answer_time
|
|
device.record_start_time = device.answer_time
|
|
@@ -111,6 +114,7 @@ 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))
|
|
|
|
+ self.logger.info("liuwei::debugger::answer, 33333")
|
|
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)
|
|
@@ -131,6 +135,7 @@ class ChannelAnswerHandler(EslEventHandler):
|
|
if CallType.BOT_CALL.code == call.call_type:
|
|
if CallType.BOT_CALL.code == call.call_type:
|
|
registry.CALL_BOT_TRANSFER_REQUESTS.labels(f"{call.bucket_type}").inc()
|
|
registry.CALL_BOT_TRANSFER_REQUESTS.labels(f"{call.bucket_type}").inc()
|
|
|
|
|
|
|
|
+ self.logger.info("liuwei::debugger::answer, 44444")
|
|
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))
|
|
@@ -147,13 +152,14 @@ class ChannelAnswerHandler(EslEventHandler):
|
|
def record(self, event, device_id):
|
|
def record(self, event, device_id):
|
|
call_id = EslEventUtil.getCallId(event)
|
|
call_id = EslEventUtil.getCallId(event)
|
|
call = self.cache.get_call_info(call_id)
|
|
call = self.cache.get_call_info(call_id)
|
|
|
|
+ self.logger.info("answer.record::call_id=%s, device_id=%s, call=%s", call_id, device_id, call)
|
|
if not call:
|
|
if not call:
|
|
- self.logger.info("answer callInfo is null,call_id:%s"%call_id)
|
|
|
|
|
|
+ self.logger.info("answer.record callInfo is null,call_id:%s"%call_id)
|
|
return
|
|
return
|
|
|
|
|
|
device =call.device_info_map.get(device_id)
|
|
device =call.device_info_map.get(device_id)
|
|
if not device:
|
|
if not device:
|
|
- self.logger.info("answer deviceInfo is null,call_id:%s, device_id:%s"%(call_id, device_id))
|
|
|
|
|
|
+ self.logger.info("answer.record deviceInfo is null,call_id:%s, device_id:%s"%(call_id, device_id))
|
|
return
|
|
return
|
|
|
|
|
|
return self.start_recording(device_id, get_record_file_name(call_id, CallStage.ALL), call)
|
|
return self.start_recording(device_id, get_record_file_name(call_id, CallStage.ALL), call)
|