|
@@ -21,7 +21,7 @@ from src.core.callcenter.constant import CENTER_AGENT_HEARTBEAT, SAAS_ID, CENTER
|
|
|
from src.core.callcenter.dao import *
|
|
|
from src.core.callcenter.data_handler import DataHandleServer
|
|
|
from src.core.callcenter.enumeration import AgentState, AgentCheck, AgentHeartState, AgentServiceState, AgentLogState, \
|
|
|
- AgentScene, BizErrorCode, WorkStatus, DownEvent, HumanState, DeviceType, ServiceDirect
|
|
|
+ AgentScene, BizErrorCode, WorkStatus, DownEvent, HumanState, DeviceType, ServiceDirect, HangupDir
|
|
|
from src.core.callcenter.esl.constant.event_names import *
|
|
|
from src.core.callcenter.exception import BizException
|
|
|
from src.core.callcenter.push import PushHandler
|
|
@@ -91,7 +91,7 @@ class AgentEventService:
|
|
|
|
|
|
start_time = time.time()
|
|
|
try:
|
|
|
- self.logger.info('agent_event_channel, event_name=%s, agent_num=%s, device_id=%s, is_agent=%s', event_name, agent_num, device_id, is_agent)
|
|
|
+ self.logger.info('agent_event_channel, event_name=%s, agent_num=%s, device_id=%s, is_agent=%s, hangup_dir=%s, hangup_count=%s, answer_count=%s', event_name, agent_num, device_id, is_agent, call_info.hangup_dir, call_info.hangup_count, call_info.answer_count)
|
|
|
agent = self.data_handle_server.get_agent(saas_id, agent_num)
|
|
|
if not agent:
|
|
|
# self.logger.warn("event service channel agent is null %s %s %s %s %s", saas_id, event_name, caller, called, json.loads(event.serialize('json')))
|
|
@@ -103,6 +103,9 @@ class AgentEventService:
|
|
|
|
|
|
# 信道发起事件,触发完成发起(或桥)&& 坐席侧
|
|
|
if CHANNEL_ORIGINATE == event_name and is_agent:
|
|
|
+ if call_info.hangup_dir and call_info.hangup_dir == HangupDir.CUSTOMER_HANGUP.code:
|
|
|
+ self.logger.info('agent_event_channel:already:hangup, event_name=%s, call_id=%s, device_id=%s, is_agent=%s, agent_num=%s, hangup_dir=%s, hangup_count=%s, answer_count=%s', event_name, call_id, device_id, is_agent, agent_num, call_info.hangup_dir, call_info.hangup_count, call_info.answer_count)
|
|
|
+ return
|
|
|
self.push_handler.push_on_agent_work_report(saas_id, flow_id, agent_num, call_id, AgentScene.MANUAL, WorkStatus.AGENT_RINGING,phone=call_info.caller)
|
|
|
|
|
|
# 进度事件,外呼时对方提醒。或者入呼时提醒 && 坐席侧
|
|
@@ -146,7 +149,7 @@ class AgentEventService:
|
|
|
self.agent_monitor_service.update_processing(agent_monitor)
|
|
|
self.logger.info('挂断更新:%s', agent)
|
|
|
# self.data_handle_server.update_record(call_id, user_id=agent.user_id, user_name=agent.agent_name)
|
|
|
- self.reprocessing_idle(AgentDelayStateData(saas_id, flow_id, agent_num, AgentServiceState.REPROCESSING, AgentScene.MANUAL))
|
|
|
+ self.reprocessing_idle(AgentDelayStateData(saas_id, flow_id, call_id, agent_num, AgentServiceState.REPROCESSING, AgentScene.MANUAL))
|
|
|
self.push_handler.push_on_call_end(saas_id, flow_id, agent_num, AgentScene.MANUAL, ServiceDirect.MANUAL_CALL.service_direct, '0')
|
|
|
self.push_handler.push_on_agent_work_report(saas_id, flow_id, agent_num, call_id, AgentScene.MANUAL, WorkStatus.AGENT_HANG_REPROCESSING)
|
|
|
self.push_handler.push_on_agent_report(saas_id, agent_num, AgentScene.MANUAL, AgentServiceState.REPROCESSING)
|
|
@@ -189,7 +192,7 @@ class AgentEventService:
|
|
|
|
|
|
start_time = time.time()
|
|
|
try:
|
|
|
- self.logger.info('bot_event_channel, event_name=%s, call_id=%s, device_id=%s, is_agent=%s, agent_num=%s', event_name, call_id, device_id, is_agent, agent_num)
|
|
|
+ self.logger.info('bot_event_channel, event_name=%s, call_id=%s, device_id=%s, is_agent=%s, agent_num=%s, hangup_dir=%s, hangup_count=%s, answer_count=%s', event_name, call_id, device_id, is_agent, agent_num, call_info.hangup_dir, call_info.hangup_count, call_info.answer_count)
|
|
|
agent = self.data_handle_server.get_agent(saas_id, agent_num)
|
|
|
if not agent:
|
|
|
# self.logger.warn("bot event service channel agent is null %s %s %s %s %s", saas_id, event_name, caller, called,
|
|
@@ -203,6 +206,9 @@ class AgentEventService:
|
|
|
|
|
|
# 信道发起事件,触发完成发起(或桥)&& 坐席侧
|
|
|
if CHANNEL_ORIGINATE == event_name and is_agent:
|
|
|
+ if call_info.hangup_dir and call_info.hangup_dir == HangupDir.CUSTOMER_HANGUP.code:
|
|
|
+ self.logger.info('bot_event_channel:already:hangup, event_name=%s, call_id=%s, device_id=%s, is_agent=%s, agent_num=%s, hangup_dir=%s, hangup_count=%s, answer_count=%s', event_name, call_id, device_id, is_agent, agent_num, call_info.hangup_dir, call_info.hangup_count, call_info.answer_count)
|
|
|
+ return
|
|
|
self.push_handler.push_on_call_ring(saas_id, flow_id, agent_num, AgentScene.ROBOT, call_id, ServiceDirect.ROBOT_CALL.service_direct, called, caller, human_service_id)
|
|
|
self.push_handler.push_on_agent_work_report(saas_id, flow_id, agent_num, call_id, AgentScene.ROBOT, WorkStatus.AGENT_RINGING,phone=call_info.caller)
|
|
|
self.data_handle_server.update_record(call_id, transfer_user_id=agent.user_id,transfer_user_name=agent.agent_name) #转接给客服以后更新转接人
|
|
@@ -223,7 +229,7 @@ class AgentEventService:
|
|
|
|
|
|
if CHANNEL_HANGUP == event_name and is_agent:
|
|
|
self.agent_monitor_service.update_processing(agent_monitor)
|
|
|
- self.reprocessing_idle(AgentDelayStateData(saas_id, flow_id, agent_num, AgentServiceState.REPROCESSING, AgentScene.ROBOT))
|
|
|
+ self.reprocessing_idle(AgentDelayStateData(saas_id, flow_id, call_id, agent_num, AgentServiceState.REPROCESSING, AgentScene.ROBOT))
|
|
|
self.push_handler.push_on_call_end(saas_id, flow_id, agent_num, AgentScene.ROBOT, ServiceDirect.ROBOT_CALL.service_direct, "0")
|
|
|
self.push_handler.push_on_agent_work_report(saas_id, flow_id, agent_num, call_id, AgentScene.ROBOT, WorkStatus.AGENT_HANG_REPROCESSING)
|
|
|
self.push_handler.push_on_agent_report(saas_id, agent_num, AgentScene.ROBOT, AgentServiceState.REPROCESSING)
|
|
@@ -250,7 +256,7 @@ class AgentEventService:
|
|
|
self.agent_state_service.idle(agent.saas_id, agent.out_id, agent.phone_num)
|
|
|
self.logger.info('reprocessing_idle_end')
|
|
|
self.agent_monitor_service.update_idle(agent_monitor)
|
|
|
- self.push_handler.push_on_agent_work_report(state_data.saas_id, state_data.flow_id, state_data.agent_num, "", state_data.scene, WorkStatus.AGENT_HANG_IDLE)
|
|
|
+ self.push_handler.push_on_agent_work_report(state_data.saas_id, state_data.flow_id, state_data.agent_num, state_data.call_id, state_data.scene, WorkStatus.AGENT_HANG_IDLE)
|
|
|
self.agent_actionlog_service.insert_service_state(agent_monitor, AgentServiceState.IDLE, AgentLogState.REPROCESSING_IDLE)
|
|
|
|
|
|
|
|
@@ -910,7 +916,8 @@ class AgentStateService:
|
|
|
|
|
|
def handle_release_agent_lock(self, choose_phone_num, saas_id, service_id='00000000000000000'):
|
|
|
key = self._lock_key(saas_id, service_id, choose_phone_num)
|
|
|
- self.redis_handler.redis.delete(key)
|
|
|
+ # self.redis_handler.redis.delete(key)
|
|
|
+ self.redis_handler.redis.expire(key, 3)
|
|
|
self.logger.info('releaseAgent %s %s %s'% (saas_id, service_id, choose_phone_num))
|
|
|
|
|
|
def handle_assign_time(self, saas_id, service_id, choose_phone_num):
|