|
@@ -541,8 +541,7 @@ class OutboundClient:
|
|
|
if caller_number in whitelist:
|
|
|
# 检查白名单
|
|
|
_bucket_call_type = 0
|
|
|
- con.execute("answer", "", device_id)
|
|
|
- con.execute("playback", HOLD_MUSIC_PATH, device_id)
|
|
|
+ self.answer(con, call_id, device_id)
|
|
|
self.build_call_info(CallType.INCOMING_AGENT_CALL.code, 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, device_id)
|
|
|
elif bucket and bucket.name == 'AI':
|
|
@@ -556,8 +555,7 @@ class OutboundClient:
|
|
|
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)
|
|
|
else:
|
|
|
# 传统服务
|
|
|
- con.execute("answer", "", device_id)
|
|
|
- con.execute("playback", HOLD_MUSIC_PATH, device_id)
|
|
|
+ self.answer(con, call_id, device_id)
|
|
|
self.build_call_info(CallType.INCOMING_AGENT_CALL.code, 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, device_id)
|
|
|
|
|
@@ -581,6 +579,13 @@ class OutboundClient:
|
|
|
# Ignore the error if socket is already closed
|
|
|
pass
|
|
|
|
|
|
+ def answer(self, con, call_id, device_id, timeouts=30):
|
|
|
+ con.execute("answer", "", device_id)
|
|
|
+ con.execute("playback", HOLD_MUSIC_PATH, device_id)
|
|
|
+
|
|
|
+ delay_action = DelayAction(call_id=call_id)
|
|
|
+ self.server.cache.add_delay_message(DelayActionEnum.ACD_TIMEOUT_PLAY.name, delay_action, timeouts)
|
|
|
+
|
|
|
def build_call_info(self, call_type, call_id, device_id, new_device_id, destination, bucket_type, **kwargs):
|
|
|
caller = kwargs.get('Channel-Caller-ID-Number')
|
|
|
called = destination
|