|
@@ -519,30 +519,30 @@ class OutboundClient:
|
|
|
kwargs['variable_sip_h_P-LIBRA-CallId'] = call_id
|
|
|
kwargs['variable_sip_h_P-LIBRA-DeviceId'] = new_device_id
|
|
|
|
|
|
- _call_type = 2
|
|
|
+ _bucket_call_type = 2
|
|
|
destination = None
|
|
|
bucket = self.server.get_bucket(call_id)
|
|
|
whitelist = self.server.get_whitelist()
|
|
|
if bucket and bucket.name == 'AI':
|
|
|
#转到ai机器人
|
|
|
- _call_type = 1
|
|
|
+ _bucket_call_type = 1
|
|
|
destination = self.server.agent.register(**kwargs)
|
|
|
self.server.logger.info("device_id=%s, destination=%s, new_device_id=%s" % (device_id, destination, new_device_id))
|
|
|
- self.build_call_info(call_id, device_id, new_device_id, str(destination), **kwargs)
|
|
|
+ self.build_call_info(call_id, device_id, new_device_id, str(destination), _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:
|
|
|
# 检查白名单
|
|
|
- _call_type = 0
|
|
|
- self.build_call_info(call_id, device_id, new_device_id, destination=None, **kwargs)
|
|
|
+ _bucket_call_type = 0
|
|
|
+ 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.build_call_info(call_id, device_id, new_device_id, destination=None, **kwargs)
|
|
|
+ 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)
|
|
|
|
|
|
- Registry.counter('call_incoming_requests', '呼入流量统计', ['call_type', str(_call_type)]).inc()
|
|
|
- self.server.dataHandleServer.create_record(call_id, caller_number, _call_type, service_category=None, destination=destination)
|
|
|
+ Registry.counter('call_incoming_requests', '呼入流量统计', ['bucket_type', str(_bucket_call_type)]).inc()
|
|
|
+ self.server.dataHandleServer.create_record(call_id, caller_number, _bucket_call_type, service_category=None, destination=destination)
|
|
|
|
|
|
# # 检查白名单
|
|
|
# if caller_number in whitelist:
|
|
@@ -589,7 +589,7 @@ class OutboundClient:
|
|
|
except:
|
|
|
traceback.print_exc()
|
|
|
|
|
|
- def build_call_info(self, call_id, device_id, new_device_id, destination, **kwargs):
|
|
|
+ def build_call_info(self, call_id, device_id, new_device_id, destination, bucket_type, **kwargs):
|
|
|
caller = kwargs.get('Channel-Caller-ID-Number')
|
|
|
called = destination
|
|
|
now = datetime.utcnow().timestamp()
|
|
@@ -597,7 +597,7 @@ class OutboundClient:
|
|
|
call_info = CallInfo(call_id=call_id, agent_key=destination,
|
|
|
caller=caller, called=called, direction=Direction.INBOUND.code,
|
|
|
call_type=CallType.BOT_CALL.code, call_time=now,
|
|
|
- uuid1=call_id, uuid2=device_id, saas_id=saasId,
|
|
|
+ uuid1=call_id, uuid2=device_id, saas_id=saasId, bucket_type=bucket_type,
|
|
|
core_uuid=None, cti_flow_id=None, conference=None, group_id=None, hidden_customer=0, caller_display=None, called_display=None, number_location=None, agent_name=None, login_type=None, ivr_id=None, task_id=None, media_host=None, sip_server=None, client_host=None, record=None, record2=None, record_time=None, answer_flag=None, wait_time=None, answer_count=0, hangup_dir=None, sdk_hangup=0, hangup_code=None, answer_time=None, end_time=None, talk_time=None, first_queue_time=None, queue_start_time=None, queue_end_time=None, overflow_count=0, cdr_notify_url=None, queue_level=None, transfer_agent=None,device_list=[], device_info_map = {}, follow_data = {}, process_data = {}, next_commands=[], call_details=[])
|
|
|
device_custom = DeviceInfo(device_id=device_id, call_time=now,
|
|
|
call_id=call_id, device_type=DeviceType.CUSTOMER.code,
|