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

+ 8 - 8
src/core/callcenter/esl/client.py

@@ -521,7 +521,7 @@ class OutboundClient:
                     event_name = info.getHeader("Event-Name")
                     self.server.logger.info('Event-Name: %s', event_name)
                     device_id = info.getHeader("unique-id")
-                    caller_number = str(info.getHeader("Caller-Caller-ID-Number"))  # 获取来电号码
+                    caller_number = info.getHeader("Caller-Caller-ID-Number")  # 获取来电号码
 
                     call_id = 'C' + str(Snowflake().next_id())
                     new_device_id = 'D' + str(Snowflake().next_id())
@@ -537,7 +537,13 @@ class OutboundClient:
                     whitelist = self.server.get_whitelist()
                     self.server.logger.info('call incoming call_id=%s, bucket=%s', call_id, bucket.name)
                     self.server.logger.info('call incoming caller_number=%s, whitelist=%s', caller_number, json.dumps(whitelist))
-                    if bucket and bucket.name == 'AI':
+                    if caller_number in whitelist:
+                        # 检查白名单
+                        _bucket_call_type = 0
+                        con.execute("answer", "", 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)
+                    elif bucket and bucket.name == 'AI':
                         #转到ai机器人
                         _bucket_call_type = 1
                         service_category = 1
@@ -546,12 +552,6 @@ class OutboundClient:
                         self.build_call_info(call_id, device_id, new_device_id, str(destination), bucket_type=_bucket_call_type, **kwargs)
                         self.server.cache.add_device_user_part(device_id, destination)
                         con.execute("bridge", "{sip_h_P-LIBRA-CallId=%s,sip_h_P-LIBRA-DeviceId=%s,origination_uuid=%s}user/%s" % (call_id, new_device_id, new_device_id, destination), device_id)
-                    elif caller_number in whitelist:
-                        # 检查白名单
-                        _bucket_call_type = 0
-                        con.execute("answer", "", 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:
                         # 传统服务
                         con.execute("answer", "", device_id)