REST API文档

话单管理

会议话单

信息说明:

参数说明
name会议名称
num会议号码 713556038-demo.xswitch.cn 根据此会议号控制会议各种操作
started_at会议开始时间
completed_at会议结束时间
meeting_id会议开始时间
completed_at会议结束时间
recurrent_meeting_id预约会议中周期性会议的 ID
meeting_id预约会议 ID
has_video是否有视频
uuid会议 UUID,唯一标识符
interval打包间隔
rate采样率
hostname主机
return_all_members所有参会人员
unjoined_members未参会
late_and_early_leave_members迟到早退
normal_joined_users准时参会
late_members仅迟到
early_leave_members仅早退

查看会议话单

  • 请求 URL/api/conference_cdrs 默认查询
  • 请求 URL/api/conference_cdrs?startDate=2023-03-01&endDate=2023-03-07&page=1&perPage=10 按开始、结束时间以及页码查询
  • 请求方式GET
  • Body 信息:参见信息说明。
  • 返回值: code(200 即为正常),msg
  • curl 示例
curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/conference_cdrs
  • 返回会议会议话单(示例)
{
	"rowCount": 1,
	"page": 1,
	"data": [
		{
			"name": "3000",
			"rate": 8000,
			"completed_at": "2024-07-11 16:50:05",
			"interval": 20,
			"get_conf_cdr_total": {
				"joined_users": {
					"data": [
						{
							"name": "1001",
							"id": "3",
							"user_id": "3",
							"destination_number": "3000",
							"left_at": "2024-07-11 16:50:05",
							"joined_at": "2024-07-11 16:50:04",
							"uuid": "0190a0fc-3f54-7336-9344-b3b2c10e87cb",
							"num": "1001",
							"type": "NORMAL",
							"attend_type": "Group"
						}
					],
					"total": 1
				},
				"unjoined_members": {
					"data": [],
					"total": 0
				},
				"return_all_members": {
					"data": [],
					"total": 0
				},
				"late_and_early_leave_members": {
					"data": [],
					"total": 0
				},
				"normal_joined_users": {
					"data": [],
					"total": 0
				},
				"late_members": {
					"data": [],
					"total": 0
				},
				"early_leave_members": {
					"data": [],
					"total": 0
				}
			},
			"started_at": "2024-07-11 16:50:04",
			"has_video": 0,
			"hostname": "77cf3d8ae018",
			"num": "3000-xswitch.cn",
			"id": 1,
			"uuid": "0190a0fc-3fcd-7c84-a778-cbe74f120145"
		}
	],
	"pageCount": 1
}

查看某个指定会议话单

  • 请求 URL/api/conference_cdrs/$id
  • 请求方式GET
  • Body 信息:参见信息说明。
  • 返回值: code(200 即为正常),msg
  • curl 示例
curl  -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/conference_cdrs/1
  • 返回会议会议话单(示例)
{
  "name": "测试会议1",
  "num": "713556038-demo.xswitch.cn",
  "started_at": "2022-05-17 01:24:52",
  "id": 1,
  "completed_at": "2022-05-17 01:25:04",
  "meeting_id": 2,
  "recurrent_meeting_id": 1,
  "interval": 20,
  "hostname": "bob",
  "has_video": 0,
  "rate": 8000,
  "uuid": "cafd90d0-4ffb-4c4e-b765-fd61ba392390"
}

查看某个指定会议话单中的所有参会成员

  • 请求 URL/api/conference_cdrs/uuid/$conference_uuid/members
  • 请求方式GET
  • Body 信息:参见信息说明。
  • 返回值: code(200 即为正常),msg
参数说明
uuid该参会人员呼入会议的 UUID
caller_id_name主叫名称
caller_id_number主叫号码
destination_number被叫号码
is_moderator是否是管理员 1 是 0 否
context呼叫源
network_addr网络地址
conference_uuid会议 UUID
joined_at该成员加入会议时间
left_at该成员离开会议时间
has_video是否开启视频
num参会人数
  • curl 示例
curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/conference_cdrs/uuid/cafd90d0-4ffb-4c4e-b765-fd61ba392390/members
  • 返回会议会议话单(示例)
{
  "members": [
    {
      "is_ghost": 0,
      "aniii": "",
      "conference_cdr_id": 0,
      "end_conference": 0,
      "caller_id_number": "1003",
      "is_moderator": 1,
      "id": 1,
      "chan_name": "sofia/default/1003@192.168.3.222",
      "destination_number": "3000",
      "ani": "1003",
      "uuid": "c3975ddf-2f3d-4e4a-b89c-2e3cfce028a3",
      "context": "context-1",
      "dialplan": "XML",
      "rdnis": "",
      "network_addr": "192.168.3.192",
      "source": "mod_sofia",
      "username": "1003",
      "conference_uuid": "cafd90d0-4ffb-4c4e-b765-fd61ba392390",
      "was_kicked": 0,
      "left_at": "2022-05-17 01:25:04",
      "joined_at": "2022-05-17 01:24:52",
      "callee_id_number": "",
      "caller_id_name": "1003",
      "callee_id_name": "",
      "has_video": 0
    }
  ],
  "num": 1
}

FIFO 话单

参数说明
channel_uuid通道 UUID
dest_number被叫号码
started_at开始时间
bridged_at接听时间
ended_at结束时间
ani服务坐席分机号码
media_file_id队列录音媒体文件 ID
fifo_name队列名
bridged_number服务号码

获取所有 FIFO 话单

FIFO 话单支持按时间、主被叫号码等精确查询。

  • 请求 URL/api/fifo_cdrs
  • 请求方式GET
  • Body 信息:参见信息说明。
  • 返回值: code(200 即为正常) msg
  • curl 示例
curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/fifo_cdrs
curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/fifo_cdrs?page=1&perPage=500&startDate=2023-03-15&endDate=2023-03-23&ani=1001&destNumber=9196&bridgedNumber=1002
  • 返回 FIFO 话单(示例)
{
  "page": 1,
  "pageCount": 1,
  "data": [
    {
      "channel_uuid": "4a08edda-a9cf-497c-9aa5-3af760e4fdd2",
      "id": 2,
      "dest_number": "9196",
      "bridged_at": "2023-03-25 17:28:15",
      "ani": "6000",
      "started_at": "2023-03-25 17:28:12",
      "ended_at": "2023-03-25 17:28:18",
      "media_file_id": 209,
      "fifo_name": "fifo",
      "bridged_number": "6000"
    },
    {
      "channel_uuid": "efd88d74-5acd-47cb-99e0-c0ad52fe1edc",
      "id": 1,
      "dest_number": "9196",
      "bridged_at": "",
      "ani": "6000",
      "started_at": "2023-03-25 17:27:35",
      "ended_at": "2023-03-25 17:28:02",
      "media_file_id": 208,
      "fifo_name": "fifo",
      "bridged_number": ""
    }
  ],
  "rowCount": 2
}

CC 话单

CC 话单支持按时间、主被叫号码等精确查询。

信息说明:

参数说明
started_at开始时间
answer_at应答时间
channel_uuid通道 UUID
dest_number被叫号码
ani服务号码
queuing_time进入队列时长
callcenter_name队列名
bridged_number服务号码
ring_time坐席响铃时长
bridged_at呼叫坐席时间
agent服务坐席
media_file_id录音文件 ID
ended_at结束时间
  • 请求 URL/api/callcenter_cdrs
  • 请求方式GET
  • Body 信息:参见信息说明。
  • 请求值:参见说明。
请求值说明
startDate成功
endDate失败
ani主叫号码
destNumber被叫号码
bridgedNumber服务号码
agent坐席
queue队列
  • curl 示例

获取所有话单:

curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/callcenter_cdrs
curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/
/api/callcenter_cdrs?page=1&perPage=500&startDate=2023-03-10&endDate=2023-03-25&ani=1001&destNumber=9196&bridgedNumber=1002
  • 返回 CC 话单(示例)
{
  "data": [
    {
      "started_at": "2023-03-25 17:45:04",
      "answer_at": "2023-03-25 17:45:06",
      "channel_uuid": "75c86e7f-120a-4091-8d18-50022e92bdcc",
      "dest_number": "9196",
      "ani": "6000",
      "queuing_time": 2,
      "callcenter_name": "cc",
      "bridged_number": "6000",
      "ring_time": 2,
      "id": 2,
      "bridged_at": "2023-03-25 17:45:04",
      "agent": "default.5000",
      "media_file_id": 211,
      "ended_at": "2023-03-25 17:45:08"
    },
    {
      "started_at": "2023-03-25 17:44:47",
      "answer_at": "",
      "channel_uuid": "82c42e7f-d43c-4f22-9a3f-6f1db842e72e",
      "dest_number": "9196",
      "ani": "6000",
      "queuing_time": 6,
      "callcenter_name": "cc",
      "bridged_number": "",
      "ring_time": 0,
      "id": 1,
      "bridged_at": "2023-03-25 17:44:47",
      "agent": "",
      "media_file_id": 210,
      "ended_at": "2023-03-25 17:44:52"
    }
  ],
  "pageCount": 1,
  "page": 1,
  "rowCount": 2
}

话单--通话记录

话单字段中文说明
caller_id_name主叫名称
caller_id_number主叫号码
destination_number被叫号码
start_stamp开始时间
ring_stamp振铃时间
answer_stamp应答时间
end_stamp结束时间
duration总时长
billsec计费时长
account_code计费号码
hangup_cause挂机原因
network_addr网络地址
network_port网络端口
sip_hangup_disposition挂机方向
context呼叫源
uuid通话 UUID
bleg_uuidB 腿 UUID
direction方向,inboud 为向内,outbound 向外
realm
caller_id_number主叫号码
external_tracking_id自定义 id
caller_sourcecaller_source
other_uuid该话单另外一个 uuid
digits_dialed按键信息
sip_call_idCall ID
xui_route_ids经过的路由 ID
abs_path录音文件绝对路径
rel_path录音文件相对路径
rtp_use_codec_name使用的编码
caller_sourcecaller_source
xui_hangup_causeXUI自定义挂机原因
media_file_id录音对应的媒体文件id
挂机原因中文说明
ORIGINATOR_CANCEL主叫挂机
NORMAL_CLEARING正常释放
NORMAL_TEMPORARY_FAILURE临时故障
WRONG_CALL_STATE呼叫状态异常
USER_BUSY用户忙
LOSE_RACE别处应答
MEDIA_TIMEOUT媒体超时
CALL_REJECTED拒绝呼叫
UNALLOCATED_NUMBER空号
NO_ROUTE_DESTINATION无法路由
NO_USER_RESPONSE久叫不应
NO_ANSWER无应答
NORMAL_UNSPECIFIED未定义
NETWORK_OUT_OF_ORDER网络异常
RECOVERY_ON_TIMER_EXPIRE呼叫超时
USER_NOT_REGISTERED用户未注册
SUBSCRIBER_ABSENT用户缺席
GATEWAY_DOWN网关故障
MANDATORY_IE_MISSINGSIP 消息不全
SYSTEM_SHUTDOWN系统关机
INCOMPATIBLE_DESTINATION目的地不兼容
EXCHANGE_ROUTING_ERROR交换路由错误
MANAGER_REQUEST强制挂机
DESTINATION_OUT_OF_ORDER目的地异常
SERVICE_NOT_IMPLEMENTED服务未实现

查询话单

  • 请求 URL/api/cdrs
  • 请求方式GET
  • 请求参数说明:
请求参数说明
dateType话单时间查询类型,默认话单开始时间,如果选话单结束时间:end_stamp
startDate呼叫开始时间,格式:2018-06-06
endDate呼叫结束时间:格式:2018-06-06
cidNumber主叫号码
destNumber被叫号码
startBillsec最小billsec值, 秒
endBillsec最大billsec值, 秒
groupValue组ID
page当前页码
perPage每页 cdr 条数

话单支持按时间、主被叫号码、通话时长等精确查询。

按时间查询时,默认查询的是话单的开始时间,如果想要按话单的结束时间去查询指定时间的全部话单需要指定日期类型,即,dateType=end_stamp

按时间查询时,如果指定了 startDate 和 startDate,而 endDate 如果只是输入了日期没有精确时分秒,则结束时间默认为该日期加 1,具体如下

示例 1

api/cdrs?startDate=2022-11-03&startDate=2022-11-03&perPage=1&page=2

查询结果为话单的开始时间在 11 月 03 号当天所有话单

示例 2

api/cdrs?startDate=2022-11-03&startDate=2022-11-03 18:30:59&perPage=1&page=2

查询结果为话单的开始时间2022-11-032022-11-03 18:30:59之内的话单

示例 3

api/cdrs?dateType=end_stamp&startDate=2022-11-03&startDate=2022-11-03 18:30:59&perPage=1&page=2

查询结果为话单的结束时间在2022-11-032022-11-03 18:30:59之内的所有话单

page=1&perPage=500&startDate=2023-03-15&endDate=2023-03-23&ani=&destNumber=&bridgedNumber=

  • curl 示例

获取所有话单:

curl  -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/cdrs
  • 返回值
{
  "pageCount": 1,
  "page": 1,
  "data": [
    {
      "account_code": "1003",
      "external_tracking_id": "",
      "sip_call_id": "61b0aca4459f42e8a6f5d131ebc93d42",
      "sip_hangup_disposition": "recv_bye",
      "answer_stamp": "2022-05-17 01:30:33",
      "network_addr": "192.168.3.192",
      "abs_path": "",
      "digits_dialed": "none",
      "xui_route_ids": "1",
      "hangup_cause": "NORMAL_CLEARING",
      "caller_source": "",
      "other_uuid": "",
      "context": "context-1",
      "network_port": "",
      "bleg_uuid": "",
      "billsec": "1",
      "start_stamp": "2022-05-17 01:30:33",
      "caller_id_name": "1003",
      "duration": "1",
      "caller_id_number": "1003",
      "realm": "",
      "end_stamp": "2022-05-17 01:30:34",
      "direction": "inbound",
      "destination_number": "9196",
      "rel_path": "",
      "uuid": "0e3ca7b2-6626-419e-8766-64de327a4741"
    },
    {
      "account_code": "1003",
      "external_tracking_id": "",
      "sip_call_id": "c79fd9801a904668b6d0b78e292bb359",
      "sip_hangup_disposition": "recv_bye",
      "answer_stamp": "2022-05-17 01:30:09",
      "network_addr": "192.168.3.192",
      "abs_path": "",
      "digits_dialed": "none",
      "xui_route_ids": "20",
      "hangup_cause": "NORMAL_CLEARING",
      "caller_source": "",
      "other_uuid": "",
      "context": "context-1",
      "network_port": "",
      "bleg_uuid": "",
      "billsec": "20",
      "start_stamp": "2022-05-17 01:30:09",
      "caller_id_name": "1003",
      "duration": "20",
      "caller_id_number": "1003",
      "realm": "",
      "end_stamp": "2022-05-17 01:30:29",
      "direction": "inbound",
      "destination_number": "3000",
      "rel_path": "",
      "uuid": "6242c44b-c2f2-4882-8941-784d44ba9885"
    }
  ],
  "rowCount": 2
}

查询指定通话时间内通话信息

  • 示例:
curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" "http://192.168.1.100:8081/api/cdrs?startDate=2022-05-17&endDate=2022-05-17&perPage=1&page=2

或查询最近 30 天话单

  • 示例:
curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" "http://192.168.1.100:8081/api/cdrs?last=30"
  • 返回:
{
	"data": [
		{
			"caller_id_number": "1003",
			"context": "context-1",
			"caller_source": "",
			"destination_number": "9196",
			"end_stamp": "2022-05-17 01:30:34",
			"direction": "inbound",
			"answer_stamp": "2022-05-17 01:30:33",
			"hangup_cause": "NORMAL_CLEARING",
			"rel_path": "",
			"abs_path": "",
			"network_addr": "192.168.3.192",
			"start_stamp": "2022-05-17 01:30:33",
			"account_code": "1003",
			"digits_dialed": "none",
			"billsec": "1",
			"external_tracking_id": "",
			"xui_route_ids": "1",
			"realm": "",
			"bleg_uuid": "",
			"duration": "1",
			"sip_call_id": "61b0aca4459f42e8a6f5d131ebc93d42",
			"uuid": "0e3ca7b2-6626-419e-8766-64de327a4741",
			"other_uuid": "",
			"caller_id_name": "1003",
			"sip_hangup_disposition": "recv_bye",
			"network_port": ""
		}
		...
	],
	"page": 1,
	"rowCount": 12,
	"pageCount": 1
}

查询指定 uuid 话单

  • 请求 URL/api/cdrs/$uuid

  • 请求方式GET

  • 参数说明:

  • 示例:

curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" "http://192.168.1.100:8081/api/cdrs/6f781c5f-9ab7-43c2-8e4a-aa3143761093"
  • 返回:
{
  "hangup_cause": "NORMAL_CLEARING",
  "caller_id_number": "1022",
  "bleg_uuid": "",
  "xui_route_ids": "19",
  "uuid": "6f781c5f-9ab7-43c2-8e4a-aa3143761093",
  "network_addr": "192.168.3.192",
  "digits_dialed": "none",
  "answer_stamp": "2022-05-05 15:08:38",
  "sip_call_id": "a5211f22b8f44e4e8d5e1466bb25054f",
  "account_code": "1022",
  "billsec": "1133",
  "context": "context-1",
  "caller_id_name": "1022",
  "direction": "inbound",
  "network_port": "",
  "external_tracking_id": "",
  "other_uuid": "",
  "realm": "",
  "destination_number": "3000",
  "end_stamp": "2022-05-05 15:27:31",
  "duration": "1134",
  "start_stamp": "2022-05-05 15:08:37",
  "sip_hangup_disposition": "recv_bye",
  "caller_source": ""
}

话单通知

通话记录通知使用mod_xml_cdr模块推送到第三方服务器。

配置推送目的 URL: url

<configuration name="xml_cdr.conf" description="XML CDR CURL logger">
  <settings>
    <param name="url" value="http://10.10.10.10:40016/new_call_center/call/center/cdr"/>
    <param name="log-dir" value=""/>
    <param name="log-b-leg" value="false"/>
    <param name="prefix-a-leg" value="true"/>
...
  • mod_xml_cdr cdr 示例:
<?xml version="1.0"?>
 <cdr>
   <channel_data>
     <state>CS_REPORTING</state>
     <direction>inbound</direction>
     <state_number>11</state_number>
     <flags>0=1;36=1;38=1;51=1</flags>
     <caps>1=1;2=1;3=1</caps>
   </channel_data>
   <variables>
    <uuid>2e831835-d336-4735-b3e5-90e5d7dc8187</uuid>
    <sip_network_ip>192.168.0.2</sip_network_ip>
    <sip_network_port>56866</sip_network_port>
    <sip_received_ip>192.168.0.2</sip_received_ip>
    <sip_received_port>56866</sip_received_port>
    <sip_via_protocol>udp</sip_via_protocol>
    <sip_from_user>1000</sip_from_user>
    <sip_from_uri>1000%40192.168.0.2</sip_from_uri>
    <sip_from_host>192.168.0.2</sip_from_host>
    <sip_from_user_stripped>1000</sip_from_user_stripped>
    ...
   </variables>
   <app_log>
    <application app_name="set" app_data="continue_on_fail=true"></application>
    <application app_name="bridge" app_data="sofia/external/gateway/gw001/1000"></application>
    <application app_name="bridge" app_data="sofia/external/gateway/gw002/1000"></application>
   </app_log>
   <callflow dialplan="XML" profile_index="1">
    <extension name="1000" number="1000">
     <application app_name="set" app_data="continue_on_fail=true"></application>
     <application app_name="bridge" app_data="sofia/external/gateway/gw001/1000"></application>
    </extension>
   </callflow>
   <caller_profile>
     <username>1000</username>
     <dialplan>XML</dialplan>
     <caller_id_name>1000</caller_id_name>
     <ani>1000</ani>
     <aniii></aniii>
     <caller_id_number>1000</caller_id_number>
     <network_addr>192.168.0.2</network_addr>
     <rdnis>1000</rdnis>
     <destination_number>1000</destination_number>
     <uuid>2e831835-d336-4735-b3e5-90e5d7dc8187</uuid>
     <source>mod_sofia</source>
     <context>default</context>
     <chan_name>sofia/default/1000@192.168.0.2</chan_name>
   </caller_profile>
   <times>
     <created_time>1274439432438053</created_time>
     <profile_created_time>1274439432448060</profile_created_time>
     <progress_time>0</progress_time>
     <progress_media_time>0</progress_media_time>
     <answered_time>0</answered_time>
     <hangup_time>1274439438418776</hangup_time>
     <resurrect_time>0</resurrect_time>
     <transfer_time>0</transfer_time>
   </times>
 </cdr>

删除话单

提供接口支持删除指定 N 天、N 月、N 年前话单,即,仅保留最近几天、几月或几年的话单。

自动删除话单功能,前提是自动删除话单脚本已启动,系统初始化安装是该脚本未启动。

参数说明
day7Day 表示删除 7 天前,7Month 表示删除 7 个月前话单,7Year 表示删除 7 年前话单
auto_delete是否自动删除,如果设置了 true,则系统会每天凌晨自动执行指定时间话单删除
  • 请求 URL/api/cdrs?day=7Day&auto_delete=false

  • 请求方式DELETE

  • 参数说明: 参考参数说明

  • 示例:

curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" -XDELETE http://192.168.1.100:8081/api/cdrs?day=7Day&auto_delete=false
  • 返回值
{
  "data": 80500,
  "code": 200,
  "message": "success"
}

话单配置

参数说明
name配置名称
description描述
log_leg记录哪条腿话单 a 腿:a-bleg ;b 腿话单:b-bleg; ab 腿话单:both
disabled是否启用 0-启用 1-不启用
template模版 ID

查询话单配置

  • 请求 URL/api/odbc_cdrs
  • 请求方式GET
  • 返回值
[
  {
    "description": "",
    "name": "cdrs",
    "deleted_at": "",
    "updated_at": "2022-05-16 09:51:32",
    "id": 1,
    "disabled": 0,
    "created_at": "2022-05-16 09:51:32",
    "log_leg": "a-leg"
  }
]
  • 示例:
curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" "http://192.168.1.100:8081/api/odbc_cdrs"

创建话单配置

  • 请求 URL/api/odbc_cdrs
  • 请求方式POST
  • 消息头Content-Type: application/json
  • Body 信息
{
  "name": "111",
  "log_leg": "a-leg",
  "disabled": 1,
  "template": "1"
}
  • 返回值
{
  "message": "success",
  "code": 200,
  "data": 2
}
  • 示例:
curl -XPOST -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \
-d '{"name": "111","log_leg": "a-leg","disabled": 1, "template": "1"}' \
-H "Content-Type: application/json" http://192.168.1.100:8081/api/odbc_cdrs

修改话单配置

  • 请求 URL/api/odbc_cdrs/$id
  • 请求方式PUT
  • 消息头Content-Type: application/json
  • Body 信息
{
  "log_leg": "b-leg"
}
  • 返回值
{
  "data": "1",
  "message": "success",
  "code": 200
}
  • 示例:
curl -XPOST -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \
-d '{"log_leg": "b-leg"}' \
-H "Content-Type: application/json" http://192.168.1.100:8081/api/odbc_cdrs/1

删除话单配置

  • 请求 URL/api/odbc_cdrs/$id
  • 请求方式DELETE
  • Body 信息:无
  • 返回值
{
  "message": "success",
  "code": 200,
  "data": 1
}
  • 示例:
curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" -XDELETE http://192.168.1.100:8081/api/odbc_cdrs/2

查询 ODBC CDR 全局参数

参数说明
k参数名
v参数值
realm固定值 话单全局参数为-ODBC_CDR_SETTINGS
disabled是否启用该参数,0-启用 1-不启用
  • 请求 URL/api/params/realm/ODBC_CDR_SETTINGS
  • 请求方式GET
  • 返回值
{
  "page": 1,
  "data": [
    {
      "created_at": "2022-04-28 16:49:05",
      "id": "1057",
      "deleted_at": "",
      "ref_id": "0",
      "v": "$${DSN}",
      "realm": "ODBC_CDR_SETTINGS",
      "updated_at": "2022-04-28 16:49:05",
      "disabled": "0",
      "k": "odbc-dsn"
    },
    {
      "created_at": "2022-04-28 16:49:05",
      "id": "1058",
      "deleted_at": "",
      "ref_id": "0",
      "v": "both",
      "realm": "ODBC_CDR_SETTINGS",
      "updated_at": "2022-04-28 16:49:05",
      "disabled": "0",
      "k": "log-leg"
    }
  ],
  "rowCount": 2,
  "pageCount": 1
}
  • 示例:
curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" "http://192.168.1.100:8081/api/params/realm/ODBC_CDR_SETTINGS"

创建 ODBC CDR 全局参数

  • 请求 URL/api/params
  • 请求方式POST
  • 消息头Content-Type: application/json
  • Body 信息
{
  "disabled": 1,
  "k": "test",
  "realm": "ODBC_CDR_SETTINGS",
  "v": "100"
}
  • 返回值
{
  "data": 1596,
  "code": 200,
  "message": "success"
}
  • 示例:
curl -XPOST -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \
-d '{"disabled": "1","k": "test","realm": "ODBC_CDR_SETTINGS","v": "100"}' \
-H "Content-Type: application/json" http://192.168.1.100:8081/api/params

修改 ODBC CDR 全局参数

  • 请求 URL/api/params/$id
  • 请求方式PUT
  • 消息头Content-Type: application/json
  • Body 信息
{
  "disabled": 0,
  "k": "test",
  "realm": "ODBC_CDR_SETTINGS",
  "v": "200"
}
  • 返回值
{
  "data": "1597",
  "message": "success",
  "code": 200
}
  • 示例:
curl -XPUT -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \
-d '{"disabled": "0","k": "test","realm": "ODBC_CDR_SETTINGS","v": "100"}' \
-H "Content-Type: application/json" http://192.168.1.100:8081/api/params/1597

删除 ODBC CDR 全局参数

  • 请求 URL/api/params/$id
  • 请求方式DELETE
  • Body 信息:无
  • 返回值
{
  "code": 200,
  "data": "1596",
  "message": "success"
}
  • 示例:
curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" -XDELETE http://192.168.1.100:8081/api/params/1596

查询指定话单配置下参数

参数说明
k参数名
v参数值
realm固定值 话单参数为-ODBC_CDR
disabled是否启用该参数,0-启用 1-不启用
  • 请求 URL/api/odbc_cdrs/$id
  • 请求方式GET
  • 返回值
{
	"updated_at": "2023-03-24 09:00:39",
	"disabled": 0,
	"created_at": "2023-03-23 06:25:21",
	"deleted_at": "",
	"params": [
		{
			"v": "accountcode",
			"updated_at": "2023-03-23 06:25:23",
			"disabled": "0",
			"created_at": "2023-03-23 06:25:23",
			"deleted_at": "",
			"ref_id": "1",
			"id": "1314",
			"k": "account_code",
			"realm": "ODBC_CDR"
		},
		...
		{
			"v": "xui_route_ids",
			"updated_at": "2023-03-23 06:25:23",
			"disabled": "0",
			"created_at": "2023-03-23 06:25:23",
			"deleted_at": "",
			"ref_id": "1",
			"id": "1337",
			"k": "xui_route_ids",
			"realm": "ODBC_CDR"
		}
	],
	"description": "",
	"id": 1,
	"name": "cdrs",
	"log_leg": "b-leg"
}
  • 示例:
curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" "http://192.168.1.100:8081/api/odbc_cdrs/1"

话单配置增加某参数

  • 请求 URL/api/odbc_cdrs/$id/params/
  • 请求方式POST
  • 消息头Content-Type: application/json
  • Body 信息
{
  "k": "test-param",
  "v": "test"
}
  • 返回值
{
  "code": 200,
  "message": "success",
  "data": 2101
}
  • 示例:
curl -XPOST -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \
-d '{"k": "test-param","v": "test"}' \
-H "Content-Type: application/json" http://192.168.1.100:8081/api/odbc_cdrs/1/params/

修改指定话单配置下某参数

  • 请求 URL/api/odbc_cdrs/$id/params/$param_id
  • 请求方式PUT
  • 消息头Content-Type: application/json
  • Body 信息
{
  "k": "test"
}
  • 返回值
{
  "data": "1597",
  "message": "success",
  "code": 200
}
  • 示例:
curl -XPOST -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \
-d '{"k": "test"}' \ -H "Content-Type: application/json" http://192.168.1.100:8081/api/odbc_cdrs/1/params/1597

删除话单配置某参数

  • 请求 URL/api/odbc_cdrs/$id/params/$params_id
  • 请求方式DELETE
  • Body 信息:无
  • 返回值
{
  "code": 200,
  "data": "1597",
  "message": "success"
}
  • 示例:
curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" -XDELETE http://192.168.1.100:8081/api/odbc_cdrs/1/params/1597
权限管理