DavidLiu 3 ヶ月 前
コミット
43aee0d5a9
3 ファイル変更7 行追加13 行削除
  1. 6 7
      src/core/callcenter/acd.py
  2. 0 4
      src/core/callcenter/esl/client.py
  3. 1 2
      src/core/voip/bot.py

+ 6 - 7
src/core/callcenter/acd.py

@@ -31,17 +31,16 @@ class AcdService:
         self.checkIdleScheduler.add_job(self.try_transfer_agent, 'interval', seconds=2, max_instances=1)
         self.checkIdleScheduler.start()
 
-    def hold(self, call_id, device_id):
-        # 1. hold住并且播放等待音
-        self.call_service.hold(call_id, device_id)
-        # self.wait_timeout(call_id)
-
-    def transfer_to_agent(self, call_id, device_id, service_id='00000000000000000'):
+    def transfer_to_agent(self, call_id, device_id, service_id='00000000000000000', hold=False):
         call_info = self.cache.get_call_info(call_id)
         self.logger.info('transfer_to_agent, come in, call_id:%s, call_info:%s'%(call_id, call_info))
         if not call_info:
             return
         call_info.answer_flag = AnswerFlag.TRANSFER_TO_AGENT.code
+        # 1. hold住并且播放等待音
+        if hold:
+            self.call_service.hold(call_id, device_id)
+            self.wait_timeout(call_id)
         # 获得空闲坐席
         agent_number = self.agent_service.assign(AgentActionRequest(saas_id=saasId, service_id=service_id))
         if not agent_number:
@@ -106,4 +105,4 @@ class AcdService:
 
     def wait_timeout(self, call_id, timeouts=30):
         delay_action = DelayAction(call_id=call_id)
-        # self.cache.add_delay_message(DelayActionEnum.ACD_TIMEOUT_PLAY.name, delay_action, timeouts)
+        self.cache.add_delay_message(DelayActionEnum.ACD_TIMEOUT_PLAY.name, delay_action, timeouts)

+ 0 - 4
src/core/callcenter/esl/client.py

@@ -542,9 +542,7 @@ class OutboundClient:
                         # 检查白名单
                         _bucket_call_type = 0
                         con.execute("answer", "", device_id)
-                        # self.server.agent.acd_service.hold(call_id, device_id)
                         con.execute("playback", HOLD_MUSIC_PATH, device_id)
-                        # con.execute("UUID_BROADCAST", f"{device_id} playback::{HOLD_MUSIC_PATH} {SMF_ALEG}", device_id)
                         self.build_call_info(CallType.INCOMING_AGENT_CALL.code, call_id, device_id, new_device_id, destination=None, bucket_type=_bucket_call_type, **kwargs)
                         self.server.agent.acd_service.transfer_to_agent(call_id, device_id)
                     elif bucket and bucket.name == 'AI':
@@ -560,8 +558,6 @@ class OutboundClient:
                         # 传统服务
                         con.execute("answer", "", device_id)
                         con.execute("playback", HOLD_MUSIC_PATH, device_id)
-                        # con.execute("UUID_BROADCAST", f"{device_id} playback::{HOLD_MUSIC_PATH} {SMF_ALEG}", device_id)
-                        # self.server.agent.acd_service.hold(call_id, device_id)
                         self.build_call_info(CallType.INCOMING_AGENT_CALL.code, call_id, device_id, new_device_id, destination=None, bucket_type=_bucket_call_type,  **kwargs)
                         self.server.agent.acd_service.transfer_to_agent(call_id, device_id)
 

+ 1 - 2
src/core/voip/bot.py

@@ -596,8 +596,7 @@ class BotAgent:
 
     def transfer(self, user_part, call_id, device_id, service_id='00000000000000000'):
         if self.acd_service:
-            self.acd_service.hold(call_id, device_id)
-            self.acd_service.transfer_to_agent(call_id, device_id, service_id)
+            self.acd_service.transfer_to_agent(call_id, device_id, service_id, hold=True)
         # sip_headers = {'P-LIBRA-HangUpReason': 'transferToAgent', 'P-LIBRA-ServiceId': service_id}
         try_count = 100
         while try_count >0: