|
@@ -28,7 +28,7 @@ from src.core.callcenter.enumeration import CallCause, DeviceType, DelayActionEn
|
|
|
from src.core.callcenter.esl.handler.default_esl_event_handler import DefaultEslEventHandler
|
|
|
from src.core.datasource import SERVE_HOST
|
|
|
from src.core.voip.constant import *
|
|
|
-
|
|
|
+from src.core.callcenter.dao import *
|
|
|
|
|
|
class InboundClient:
|
|
|
|
|
@@ -479,10 +479,15 @@ class OutboundClient:
|
|
|
|
|
|
def __init__(self, agent, logger):
|
|
|
self.logger = logger
|
|
|
+ self.whitelist = self.load_whitelist()
|
|
|
#threading.Thread(target=self.start, args=('0.0.0.0', 8084, agent, logger)).start()
|
|
|
server_thread = threading.Thread(target=self.start, args=('0.0.0.0', 8084, agent, logger))
|
|
|
server_thread.daemon = True # 设置守护线程
|
|
|
server_thread.start()
|
|
|
+ def load_whitelist(self):
|
|
|
+ phones = Whitelist.query.filter_by(del_flag=0).all()
|
|
|
+ phone_list = [phone.phone for phone in phones]
|
|
|
+ return phone_list
|
|
|
|
|
|
class ESLRequestHandler(socketserver.BaseRequestHandler):
|
|
|
def setup(self):
|
|
@@ -497,6 +502,15 @@ class OutboundClient:
|
|
|
# print(json.loads(info.serialize('json')))
|
|
|
event_name = info.getHeader("Event-Name")
|
|
|
device_id = info.getHeader("unique-id")
|
|
|
+ # caller_number = info.getHeader("Caller-Caller-ID-Number") # 获取来电号码
|
|
|
+
|
|
|
+ # 检查白名单
|
|
|
+ # if caller_number in self.server.whitelist:
|
|
|
+ # self.server.logger.info("Caller %s is in whitelist, directly transferring call.", caller_number)
|
|
|
+ # # 直接转接到指定用户
|
|
|
+ # print('come in whitelist')
|
|
|
+ # return
|
|
|
+
|
|
|
kwargs = json.loads(info.serialize('json'))
|
|
|
destination = self.server.agent.register(**kwargs)
|
|
|
self.server.logger.info("device_id=%s, destination=%s", device_id, destination)
|