DavidLiu před 4 měsíci
rodič
revize
8c9a6b3ab1
1 změnil soubory, kde provedl 17 přidání a 2 odebrání
  1. 17 2
      src/core/callcenter/esl/client.py

+ 17 - 2
src/core/callcenter/esl/client.py

@@ -542,12 +542,14 @@ class OutboundClient:
                     elif caller_number in whitelist:
                         # 检查白名单
                         _bucket_call_type = 0
+                        self.hold(con, call_id, device_id)
                         self.build_call_info(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, new_device_id)
                     else:
                         # 传统服务
+                        self.hold(con, call_id, device_id)
                         self.build_call_info(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, new_device_id)
+                        # self.server.agent.acd_service.transfer_to_agent(call_id, new_device_id)
 
                     registry.CALL_INCOMING_REQUESTS.labels(f"{_bucket_call_type}").inc()
                     self.server.dataHandleServer.create_record(call_id, caller_number, _bucket_call_type, service_category=service_category, destination=destination)
@@ -624,7 +626,20 @@ class OutboundClient:
             call_info.device_info_map = {device_id: device_custom, new_device_id: device_bot}
             # self.server.logger.info("lwoutBound, call_info=%s"%(call_info))
             self.server.cache.add_call_info(call_info)
-
+            return call_info
+
+        def hold(self, con, call_id, device_id):
+            self.bridge_break(con, call_id, device_id)
+            self.server.cache.set_need_play_hold_music(call_id)
+
+        def bridge_break(self, con, call_id, device_id):
+            """拆线"""
+            builder = [
+                device_id,
+                f"  -both 'set:hangup_after_bridge=false,set:park_after_bridge=true,set:{SIP_HEADER}{sipHeaderHoldMusic}={call_id},park:' inline "
+            ]
+            arg = ''.join(builder)
+            con.execute(TRANSFER, arg)
 
     class CustomTCPServer(socketserver.TCPServer):
         def __init__(self, server_address, RequestHandlerClass, agent, app):