|
@@ -17,12 +17,12 @@ from src.core.callcenter import BizException
|
|
|
from src.core.callcenter.cache import Cache
|
|
|
from src.core.callcenter.api import MakeCallContext, DelayAction, CallInfo, DeviceInfo, NextCommand
|
|
|
from src.core.callcenter.callback import Callback
|
|
|
-from src.core.callcenter.constant import SK, EMPTY, WaitingHangupMusicPath, saasId
|
|
|
+from src.core.callcenter.constant import SK, EMPTY, WaitingHangupMusicPath, saasId, HOLD_MUSIC_PATH
|
|
|
from src.core.callcenter.esl.constant.esl_constant import BRIDGE_VARIABLES, BRIDGE, HANGUP, NORMAL_CLEARING, SIP_HEADER, \
|
|
|
SPACE, SOFIA, \
|
|
|
ORIGINATE, PARK, SET, EAVESDROP, SMF_ALEG, EXECUTE, PLAYBACK, PAUSE, TRANSFER, UUID_TRANSFER, UUID_BROADCAST, \
|
|
|
UUID_BREAK, UUID_HOLD, \
|
|
|
- UUID_RECORD, UUID_SETVAR, UUID_GETVAR, UUID_KILL
|
|
|
+ UUID_RECORD, UUID_SETVAR, UUID_GETVAR, UUID_KILL, ANSWER
|
|
|
import src.core.callcenter.esl.utils.esl_event_util as EslEventUtil
|
|
|
import src.core.callcenter.esl.handler as event_handler
|
|
|
from src.core.callcenter.esl.constant.sip_header_constant import sipHeaderHoldMusic, profile1, profile2
|
|
@@ -530,6 +530,7 @@ class OutboundClient:
|
|
|
service_category = 0
|
|
|
bucket = self.server.get_bucket(call_id)
|
|
|
whitelist = self.server.get_whitelist()
|
|
|
+ self.server.logger.info('call incoming call_id=%s, bucket=%s', call_id, bucket.name)
|
|
|
if bucket and bucket.name == 'AI':
|
|
|
#转到ai机器人
|
|
|
_bucket_call_type = 1
|
|
@@ -542,14 +543,14 @@ class OutboundClient:
|
|
|
elif caller_number in whitelist:
|
|
|
# 检查白名单
|
|
|
_bucket_call_type = 0
|
|
|
- self.hold(con, call_id, device_id)
|
|
|
+ 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:
|
|
|
# 传统服务
|
|
|
- self.hold(con, call_id, device_id)
|
|
|
+ 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)
|
|
|
+ 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)
|
|
@@ -628,19 +629,6 @@ class OutboundClient:
|
|
|
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):
|
|
|
super().__init__(server_address, RequestHandlerClass)
|