|
@@ -8,7 +8,7 @@ import traceback
|
|
from src.core.callcenter.acd import AcdService
|
|
from src.core.callcenter.acd import AcdService
|
|
from src.core.callcenter.call import CallService
|
|
from src.core.callcenter.call import CallService
|
|
from src.core.callcenter.enumeration import CallType, DeviceType, AnswerFlag, NextType, CdrType, HangupDir, \
|
|
from src.core.callcenter.enumeration import CallType, DeviceType, AnswerFlag, NextType, CdrType, HangupDir, \
|
|
- CallCause,AgentServiceState, AgentScene
|
|
|
|
|
|
+ CallCause,AgentServiceState, AgentScene,WorkStatus
|
|
from src.core.callcenter.esl.annotation import EslEventName
|
|
from src.core.callcenter.esl.annotation import EslEventName
|
|
import src.core.callcenter.esl.utils.esl_event_util as EslEventUtil
|
|
import src.core.callcenter.esl.utils.esl_event_util as EslEventUtil
|
|
from src.core.callcenter.esl.constant.event_names import CHANNEL_HANGUP
|
|
from src.core.callcenter.esl.constant.event_names import CHANNEL_HANGUP
|
|
@@ -80,9 +80,8 @@ class ChannelHangupHandler(EslEventHandler):
|
|
if device.record_start_time:
|
|
if device.record_start_time:
|
|
device.record_time = int(device.end_time) - int(device.record_start_time)
|
|
device.record_time = int(device.end_time) - int(device.record_start_time)
|
|
call.device_info_map[device.device_id] = device
|
|
call.device_info_map[device.device_id] = device
|
|
- # print("ceshiyix shijian",device)
|
|
|
|
- # 更新通话记录
|
|
|
|
- # self.dataHandleServer.update_record(call_id, {"time_end": datetime.fromtimestamp(int(device.end_time)),"times":device.talk_time})
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
print('debugger::ChannelHangupHandler, hangup_reason=%s, device_type=%s' % (hangup_reason, device.device_type), flush=True)
|
|
print('debugger::ChannelHangupHandler, hangup_reason=%s, device_type=%s' % (hangup_reason, device.device_type), flush=True)
|
|
# 如果是转人工
|
|
# 如果是转人工
|
|
@@ -111,9 +110,19 @@ class ChannelHangupHandler(EslEventHandler):
|
|
self.hangup_dir(call, device, cause)
|
|
self.hangup_dir(call, device, cause)
|
|
self.cache.add_call_info(call)
|
|
self.cache.add_call_info(call)
|
|
|
|
|
|
- if len(call.device_list)==0 and device.device_type == DeviceType.AGENT.code:
|
|
|
|
- self.dataHandleServer.update_agent_monitor_service_state(device_id, AgentServiceState.IDLE.code)
|
|
|
|
|
|
+ # 全部挂机以后推送挂机状态
|
|
|
|
+ if len(call.device_list)==0:
|
|
|
|
+ # 计算当前通话时长
|
|
|
|
+ if call.answer_time:
|
|
|
|
+ call.end_time = timestamp
|
|
|
|
+ call.talk_time = int(call.end_time) - int(call.answer_time)
|
|
self.push_handler.push_on_call_end(saas_id=call.saas_id, flow_id=call.cti_flow_id, user_id=call.agent_key)
|
|
self.push_handler.push_on_call_end(saas_id=call.saas_id, flow_id=call.cti_flow_id, user_id=call.agent_key)
|
|
|
|
+ self.dataHandleServer.update_record(call_id, {"time_end": datetime.utcnow(),"times":call.talk_time // 1000})
|
|
|
|
+
|
|
|
|
+ # 更新坐席状态
|
|
|
|
+ if device.device_type == DeviceType.AGENT.code:
|
|
|
|
+ self.dataHandleServer.update_agent_monitor_service_state(device_id, AgentServiceState.IDLE.code)
|
|
|
|
+ self.push_handler.push_on_agent_work_report(call.saas_id, call.cti_flow_id, call.agent_key, call.call_id, AgentScene.ROBOT,WorkStatus.AGENT_DIALING)
|
|
except:
|
|
except:
|
|
traceback.print_exc()
|
|
traceback.print_exc()
|
|
|
|
|