|
@@ -26,28 +26,28 @@ class ChannelHangupHandler(EslEventHandler):
|
|
|
self.call_service = CallService(inbound_client, logger)
|
|
|
|
|
|
def handle(self, address, event, coreUUID):
|
|
|
- print(json.loads(event.serialize('json')), end="", flush=True)
|
|
|
+ print(json.loads(event.serialize('json')), flush=True)
|
|
|
try:
|
|
|
call_id = EslEventUtil.getCallId(event)
|
|
|
- print('debugger::call_id is ', call_id, end="", flush=True)
|
|
|
+ print('debugger::call_id is ', call_id, flush=True)
|
|
|
if not call_id:
|
|
|
self.release(event)
|
|
|
- print("call_id is null", end="", flush=True)
|
|
|
+ print("call_id is null", flush=True)
|
|
|
return
|
|
|
call = Cache.get_call_info(call_id)
|
|
|
- print('debugger::call_info is ', call, end="", flush=True)
|
|
|
+ print('debugger::call_info is ', call, flush=True)
|
|
|
if not call:
|
|
|
- print("call:%s is null", call_id, end="", flush=True)
|
|
|
+ print("call:%s is null", call_id, flush=True)
|
|
|
return
|
|
|
device_id = EslEventUtil.getDeviceId(event)
|
|
|
device = call.device_info_map.get(device_id)
|
|
|
- print('debugger::device_id is ', device_id, end="", flush=True)
|
|
|
+ print('debugger::device_id is ', device_id, flush=True)
|
|
|
if not device:
|
|
|
- print("device:%s is null", device_id, end="", flush=True)
|
|
|
+ print("device:%s is null", device_id, flush=True)
|
|
|
return
|
|
|
|
|
|
count = len(call.device_list)
|
|
|
- print('debugger::ChannelHangupHandler, call_id=%s, device_id=%s, count=%s'% (call_id, device_id, count), end="", flush=True)
|
|
|
+ print('debugger::ChannelHangupHandler, call_id=%s, device_id=%s, count=%s'% (call_id, device_id, count), flush=True)
|
|
|
try:
|
|
|
call.device_list.remove(device_id)
|
|
|
except:
|
|
@@ -78,13 +78,13 @@ class ChannelHangupHandler(EslEventHandler):
|
|
|
if device.record_start_time:
|
|
|
device.record_time = int(device.end_time) - int(device.record_start_time)
|
|
|
call.device_info_map[device.device_id] = device
|
|
|
- print('debugger::ChannelHangupHandler, hangup_reason=%s, device_type=%s' % (hangup_reason, device.device_type), end="", flush=True)
|
|
|
+ print('debugger::ChannelHangupHandler, hangup_reason=%s, device_type=%s' % (hangup_reason, device.device_type), flush=True)
|
|
|
# 如果是转人工
|
|
|
if 'transferToAgent' == hangup_reason and DeviceType.ROBOT.code == device.device_type:
|
|
|
call.answer_flag = AnswerFlag.TRANSFER_TO_AGENT.code
|
|
|
service_id = EslEventUtil.getLIBRAServiceId(event)
|
|
|
Cache.add_call_info(call)
|
|
|
- print('debugger::ChannelHangupHandler, transferToAgent, service_id=%s' % (service_id), end="", flush=True)
|
|
|
+ print('debugger::ChannelHangupHandler, transferToAgent, service_id=%s' % (service_id), flush=True)
|
|
|
self.acd_service.transfer_to_agent(call, device, service_id)
|
|
|
return
|
|
|
|