|
@@ -27,14 +27,15 @@ class ChannelAnswerHandler(EslEventHandler):
|
|
|
def handle(self, address, event, coreUUID):
|
|
|
call_id = EslEventUtil.getCallId(event)
|
|
|
call_info = self.cache.get_call_info(call_id)
|
|
|
- print("answer call_id:%s, call_info:%s, event:%s"% (call_id, call_info, json.loads(event.serialize('json'))), flush=True)
|
|
|
+ # print("lwdebugger::answer call_id:%s, call_info:%s, event:%s"% (call_id, call_info, json.loads(event.serialize('json'))), flush=True)
|
|
|
if not call_info:
|
|
|
return
|
|
|
|
|
|
device_id = EslEventUtil.getDeviceId(event)
|
|
|
device_info = call_info.device_info_map.get(device_id)
|
|
|
next_command = call_info.next_commands[0] if len(call_info.next_commands) > 0 else None
|
|
|
- print("answer device_id:%s, device_info:%s, next_command:%s"%(device_id, device_info, next_command), flush=True)
|
|
|
+ device_type = DeviceType.get_by_code(device_info.device_type)
|
|
|
+ print("lwdebugger::ChannelAnswerHandler call_id:%s, device_id:%s, device_type:%s, next_command:%s"%(call_id, device_id, device_type, next_command), flush=True)
|
|
|
if not next_command:
|
|
|
return
|
|
|
|
|
@@ -75,9 +76,7 @@ class ChannelAnswerHandler(EslEventHandler):
|
|
|
new_device_id = 'D' + str(self.snowflake.next_id())
|
|
|
call.device_list.append(new_device_id)
|
|
|
called = call.called
|
|
|
-
|
|
|
- self.logger.info("呼另外一侧电话: callId: %s, display:%s, called:%s, deviceId: %s ",
|
|
|
- call_id, call.called_display, called, device_id)
|
|
|
+ print("呼另外一侧电话: callId: %s, display:%s, called:%s, deviceId: %s "%(call_id, call.called_display, called, device_id), flush=True)
|
|
|
|
|
|
# now = lambda: int(round(time.time() * 1000))
|
|
|
now = datetime.utcnow().timestamp()
|
|
@@ -88,7 +87,7 @@ class ChannelAnswerHandler(EslEventHandler):
|
|
|
call_time=now, device_type=DeviceType.CUSTOMER.code, caller_display=route_gateway.name, cdr_type=CdrType.OUTBOUND.code)
|
|
|
call.next_commands.append(NextCommand(device_id=device_id, next_type=NextType.NEXT_CALL_BRIDGE.code, next_value=new_device_id))
|
|
|
call.device_info_map[new_device_id] = new_device
|
|
|
- print("lwdebugger::call_other, call_info=%s"%call, flush=True)
|
|
|
+ # print("lwdebugger::call_other, call_info=%s"%call, flush=True)
|
|
|
self.cache.add_call_info(call)
|
|
|
self.cache.add_agent_info(agent=agent, call_id=call_id, device_id=device_id)
|
|
|
|