余尚辉 4 ay önce
ebeveyn
işleme
e9ad73ac39

+ 4 - 1
src/core/callcenter/esl/handler/channel_hangup_handler.py

@@ -8,12 +8,13 @@ import traceback
 from src.core.callcenter.acd import AcdService
 from src.core.callcenter.call import CallService
 from src.core.callcenter.enumeration import CallType, DeviceType, AnswerFlag, NextType, CdrType, HangupDir, \
-    CallCause,AgentServiceState
+    CallCause,AgentServiceState,AgentScene
 from src.core.callcenter.esl.annotation import EslEventName
 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.handler.esl_event_handler import EslEventHandler
 from src.core.callcenter.api import CallInfo, DeviceInfo, NextCommand
+from src.core.callcenter.push import PushHandler
 from src.core.callcenter.data_handler import *
 
 @EslEventName(CHANNEL_HANGUP)
@@ -24,6 +25,7 @@ class ChannelHangupHandler(EslEventHandler):
         self.acd_service = AcdService(inbound_client,inbound_client.app)
         self.call_service = CallService(inbound_client,inbound_client.logger)
         self.dataHandleServer=DataHandleServer(inbound_client.app)
+        self.push_handler = PushHandler(inbound_client.logger)
 
     def handle(self, address, event, coreUUID):
         print(json.loads(event.serialize('json')), flush=True)
@@ -112,6 +114,7 @@ class ChannelHangupHandler(EslEventHandler):
 
             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)
+                self.push_handler.push_on_call_end(call.cti_flow_id,call.agent_key,AgentScene.ROBOT,call.direction, device.device_type)
         except:
             traceback.print_exc()
 

+ 1 - 1
src/core/callcenter/push.py

@@ -66,7 +66,7 @@ class PushHandler:
         new_data = {'data': json.dumps(data)}
         self.push_to_socket_service(user_id, json.dumps(new_data))
 
-    def push_on_call_end(self, saas_id, flow_id, user_id,  scene, service_direct=None, disconnect_type=0):
+    def push_on_call_end(self, flow_id, user_id,  scene: AgentScene, service_direct=None, disconnect_type=0):
         data = {
             'eventName': DownEvent.ON_CALL_END.code,
             'ext': {

+ 4 - 4
src/core/voip/bot.py

@@ -246,8 +246,8 @@ class MyCall(pj.Call):
             return self.player_complete_dict.get(player_id)
     def onDtmfDigit(self, prm):
         # 判断是否播放完成 否则不记录用户说的内容
-        # if not self.is_play_complete():
-        #     return
+        if not self.is_play_complete():
+            return
         digit = prm.digit
         self.reset_wait_time()
         # 假设为超长类型按键 把用户输入的按键进行拼接 如果为# 则把用户输入所有按键放入队列并发送文本机器人
@@ -320,8 +320,8 @@ class MyCall(pj.Call):
 
     def on_receiver_asr_result(self, message, *args):
         # 判断是否播放完成 否则不记录用户说的内容
-        # if not self.is_play_complete():
-        #     return
+        if not self.is_play_complete():
+            return
         message = json.loads(message)
         if message["header"]["status"] == 20000000:
             if message["header"]["name"] == "SentenceEnd":