|
@@ -31,11 +31,9 @@ class ChannelAnswerHandler(EslEventHandler):
|
|
|
device_id = EslEventUtil.getDeviceId(event)
|
|
|
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:
|
|
|
- self.logger.info("liuwei::debugger::answer, 11111")
|
|
|
self.record(event, device_id)
|
|
|
|
|
|
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)
|
|
|
call_info.answer_flag = AnswerFlag.ROBOT_ANSWER.code
|
|
|
registry.CALL_BOT_ANSWER_REQUESTS.labels(f"{call_info.bucket_type}").inc()
|
|
@@ -79,7 +77,6 @@ class ChannelAnswerHandler(EslEventHandler):
|
|
|
|
|
|
# 启用录音, 生产时候打开
|
|
|
record_url = self.record(event, device_id)
|
|
|
- device.record = record_url
|
|
|
device.record_start_time = device.answer_time
|
|
|
self.dataHandleServer.update_record(call_id, url= record_url)
|
|
|
|
|
@@ -133,13 +130,13 @@ class ChannelAnswerHandler(EslEventHandler):
|
|
|
if CallType.BOT_CALL.code == call.call_type:
|
|
|
registry.CALL_BOT_TRANSFER_REQUESTS.labels(f"{call.bucket_type}").inc()
|
|
|
|
|
|
- self.logger.info("liuwei::debugger::answer, 44444")
|
|
|
self.record(event, device_id)
|
|
|
call.next_commands.append(NextCommand(call.device_list[0], NextType.NEXT_TRANSFER_SUCCESS.code, device_id))
|
|
|
self.logger.info("转接电话中 callId:%s, from:%s, to:%s "% (call.call_id, device_id, next_command.next_value))
|
|
|
self.inbound_client.transfer_call(device_id, next_command.next_value)
|
|
|
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.cache.add_call_info(call)
|
|
|
|
|
|
|
|
|
def listen(self, call: CallInfo, device: DeviceInfo, next_command: NextCommand, event):
|
|
@@ -150,19 +147,16 @@ class ChannelAnswerHandler(EslEventHandler):
|
|
|
def record(self, event, device_id):
|
|
|
call_id = EslEventUtil.getCallId(event)
|
|
|
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:
|
|
|
self.logger.info("answer.record callInfo is null,call_id:%s"%call_id)
|
|
|
return
|
|
|
|
|
|
device =call.device_info_map.get(device_id)
|
|
|
- self.logger.info("answer.record::call_id=%s, device_id=%s, device=%s", call_id, device_id, device)
|
|
|
if not device:
|
|
|
self.logger.info("answer.record deviceInfo is null,call_id:%s, device_id:%s"%(call_id, device_id))
|
|
|
return
|
|
|
|
|
|
_record_url = None
|
|
|
- self.logger.info("answer.record::call_id=%s, device_id=%s, device_type=%s", call_id, device_id, device.device_type)
|
|
|
if CallType.BOT_CALL.code == call.call_type:
|
|
|
if DeviceType.CUSTOMER.code == device.device_type:
|
|
|
_record_url = self.start_recording(device_id, get_record_file_name(call_id, CallStage.ALL), call)
|
|
@@ -172,10 +166,10 @@ class ChannelAnswerHandler(EslEventHandler):
|
|
|
_record_url = self.start_recording(device_id, get_record_file_name(call_id, CallStage.AGENT), call)
|
|
|
else:
|
|
|
_record_url = self.start_recording(device_id, get_record_file_name(call_id, CallStage.ALL), call)
|
|
|
+ device.record = _record_url
|
|
|
return _record_url
|
|
|
|
|
|
def start_recording(self, device_id, file_name, call: CallInfo):
|
|
|
record_url = get_record_prefix(call) + '/' + file_name + '.wav'
|
|
|
- self.logger.info("liuwei::debugger::answer, 5555, %s", record_url)
|
|
|
self.inbound_client.record(device_id, 'start', record_url, 0)
|
|
|
return record_url
|