|
@@ -3,6 +3,11 @@
|
|
|
|
|
|
import json
|
|
|
import src.core.callcenter.cache as Cache
|
|
|
+from src.core.callcenter.constant import HOLD_MUSIC_PATH
|
|
|
+from src.core.callcenter.enumeration import DeviceType
|
|
|
+from src.core.callcenter.esl.constant.esl_constant import SIP_HEADER
|
|
|
+from src.core.callcenter.esl.constant.sip_header_constant import sipHeaderHoldMusic
|
|
|
+from src.core.callcenter.esl.utils.esl_event_util import *
|
|
|
from src.core.callcenter.esl.annotation import EslEventName
|
|
|
from src.core.callcenter.esl.constant.event_names import CHANNEL_PARK
|
|
|
from src.core.callcenter.esl.handler.esl_event_handler import EslEventHandler
|
|
@@ -20,6 +25,33 @@ class ChannelParkHandler(EslEventHandler):
|
|
|
self.process_fxo_calling(event)
|
|
|
return
|
|
|
|
|
|
+ call_id = getCallId(event)
|
|
|
+ device_id = getUniqueId(event)
|
|
|
+ need_hold_music = getVariableNeedHoldMusic(event)
|
|
|
+ print("park播放等待音标识 callId: %s deviceId: %s needHoldMusic:%s",call_id,device_id,need_hold_music, flush=True)
|
|
|
+ if need_hold_music:
|
|
|
+ self.play_hold_music(event)
|
|
|
+ return
|
|
|
+
|
|
|
+ def play_hold_music(self, event):
|
|
|
+ call_id = getCallId(event)
|
|
|
+ device_id = getUniqueId(event)
|
|
|
+ print('debugger, ChannelParkHandler, call_id=%s, device_id=%s'%(call_id, device_id), flush=True)
|
|
|
+ if not call_id or not device_id:
|
|
|
+ return
|
|
|
+ call_info = Cache.get_call_info(call_id)
|
|
|
+ if not call_info:
|
|
|
+ print("CHANNEL_PARK callInfo is null", flush=True)
|
|
|
+ return
|
|
|
+
|
|
|
+ device_info = call_info.device_info_map.get(device_id)
|
|
|
+ hold = Cache.get_need_play_hold_music(call_id)
|
|
|
+ print('debugger, ChannelParkHandler, hold=%s, device_info=%s' % (hold, device_info), flush=True)
|
|
|
+ if hold and device_info.device_type == DeviceType.CUSTOMER.code:
|
|
|
+ self.inbound_client.hold_play(device_id, HOLD_MUSIC_PATH)
|
|
|
+ Cache.del_need_play_hold_music(call_id)
|
|
|
+ self.inbound_client.set_var(device_id, SIP_HEADER + sipHeaderHoldMusic, "false")
|
|
|
+
|
|
|
def process_fxo_calling(self, event):
|
|
|
kwargs = json.loads(event.serialize('json'))
|
|
|
destination = self.bot_agent.register(**kwargs)
|