通用api - 获取通话记录接口
接口通话记录回调参数说明
话单回调需要给对应的账号配置上回调地址即可。
话单的回调地址配置:由客户主动拉取提供一个可以接收json数据的接口地址,由我们配置或客户自行在后台配置都可以。
通话记录列表的接口。回调数据格式json
{
"id": 263056202,
"companycode": "9513923",
"direction": "callout",
"type": "callout",
"callmethod": 6,
"starttime": "2025-10-16 17:31:13",
"answertime": "",
"endtime": "2025-10-16 17:31:21",
"duration": 8,
"billsec": 0,
"userid": "0",
"memberid": "0",
"chengshudu": "0",
"ext": "0",
"disnumber": "219513923001",
"destnumber": "81351111451",
"extnumber": "",
"recordfilename": "",
"downloadip": "",
"hangupdirection": 10040,
"hangupcause": 10020,
"uuid": "db4a44cc-aa72-11f0-ad78-1d7ff0749d07",
"userkey": "",
"customuuid": "76c33d997640d36b033d43b1d2d3964e",
"taskid": "",
"round": 0,
"recordurl": ""
}
请求方式
POST,form-data格式
获取通话记录接口请求回调参数说明
| 参数名 | 类型 | 说明 | |
|---|---|---|---|
| callmethod | int | 呼叫方法:0、不限;1、分机互拨;2、分机直拨(手拨);3、API呼叫(默认);4、API双呼;5、预测式外呼;6、IVR/群呼。 | |
获取通话记录接口请求示例(PHP)
<?php
$apiUrl = 'http://127.0.0.1:8080';
$postFields = [
'service' => 'App.Sip_Cdr.GetBill',
'token' => 'ABCDEFG',
'starttime' => '2019-01-12 00:00:00',
'endtime' => '2020-12-12 00:00:00',
'direction' => 3
'syncflag' => 3,
'callmethod' => 0,
'currentpage' => 1,
'itemsperpage' => 10,
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $apiUrl);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
$curlError = curl_error($curl);
curl_close($curl);
var_dump($response);
?>
返回数据结构示例
{
"ret": 200,
"data": {
"status": 0,
"desc": "获取成功",
"result": {
"totalitems": 8151,
"currentpage": 1,
"itemsperpage": 10,
"bills": [
{
"id": 22670,
"extnumber": "",
"destnumber": "13387525701",
"displaynumber": "2190170001",
"starttime": "2019-09-27 14:58:37",
"answertime": null,
"endtime": "2019-09-27 14:59:05",
"duration": 28,
"billsec": 0,
"direction": "callout",
"callmethod": 6,
"userid": "0",
"memberid": "0",
"chengshudu": "0",
"customuuid": "0",
"recordfilename": "",
"downloadip": "",
"hangupdirection": 10041,
"hangupcause": 10020,
"userkey":"#"
}
]
},
"reqtime": 1581502410,
"rsptime": 1581502410
},
"msg": ""
}
返回参数说明
| string | 呼叫时间 | |
| string | 应答时间 | |
| string | 通话结束时间 | |
| int | 呼叫等待时长 | |
| int | 通话时长 | |
| string | ||
| string | 自定义参数 |
|
| string | 自定义参数-值和ext一致 | |
| hangupdirection | int | 挂机方向 |
| hangupcause | int | 挂机原因代码 |
| memberid | string | 自定义参数 |
| string | ||
| string | ||
| string | 录音下载ip | |
| recordfilename | string | |
| string | ||
| string | 通话uuid | |
| userkey | string | 用户按键 |
| customuuid | string | 自定义参数-客户id |
| taskid | string | 任务id |
| round | string | 呼叫轮次 |
| recordurl | string | 录音下载地址 |
Postman请求参数示例
