Skip to main content

通用API - 获取通话记录接口

接口说明

客户主动拉取通话记录列表的接口。

请求方式

POST,form-data格式

请求参数

参数名 类型 是否必须 说明
service string App.Sip_Cdr.GetBill
token string 通过授权接口获取的token
starttime string (拔打)起始时间,格式:yyyy-mm-dd hh:mm:ss
endtime string (拔打)结束时间,格式:yyyy-mm-dd hh:mm:ss
syncflag int 获取记录类型:1、获取未查询过的记录(默认);2、获取已查询过的记录;3、获取全部记录。
direction int 呼叫方向:1、呼入; 2、呼出;3、全部(默认)。
callmethod int 呼叫方法:0、不限;1、分机互拨;2、分机直拨(手拨);3、API呼叫(默认);4、API双呼;5、预测式外呼;6、IVR/群呼。
currentpage int 页数,默认:1
itemsperpage int 每页数量,默认:10,最小:1;最大:1000
extnumber string 分机号,多个分机号用英文逗号隔开,传空值时为全部
destnumber string 呼叫的目标号码,传空值时为全部
userid string 自定义数据(员工ID),可为空值
memberid string 自定义数据(会员ID),可为空值
extchengshudu string 自定义数据(扩展参数成熟度)
customuuid string 自定义数据(客户ID)

接口请求示例(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": 263056202,22670,
                    "companycode"extnumber": "9513923"",
                    "direction"destnumber": "callout"13387525701",
                    "type"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,
                    "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"customuuid": "0",
                    "disnumber": "219513923001",
                    "destnumber": "81351111451",
                    "extnumber": "",
                    "recordfilename": "",
                    "downloadip": "",
                    "hangupdirection": 10040,10041,
                    "hangupcause": 10020,
                    "uuid": "db4a44cc-aa72-11f0-ad78-1d7ff0749d07",
                    "userkey": "",
                    "customuuid": "76c33d997640d36b033d43b1d2d3964e",
                    "taskid": "",
                    "round": 0,
                    "recordurl": ""#"
                }
            ]
        },
        "reqtime": 1581502410,
        "rsptime": 1581502410
    },
    "msg": ""
}

返回参数说明

参数名 类型 说明
result objest 返回的结果集
—totalitems int 记录总数
—currentpage int 当前页码
—itemsperpage int 每页数量
—bills array 记录数组
——id int 记录id
——extnumber string 分机号
——destnumber string 目标号码
——disnumberdisplaynumber string 显示号码
——starttime string 呼叫时间
——answertime string 应答时间
——endtime string 通话结束时间
——duration int 呼叫等待时长
——billsec int 通话时长
——direction string 呼叫方向
——callmethod int 呼叫方式
——userid string 自定义参数(用户id)
——memberid string 自定义参数(会员id)
——chengshudu string 自定义参数(成熟度)
——extstring自定义参数(扩展参数)
——customuuid string 自定义参数(客户id)
——recordfilename string 通话记录文件名
——downloadip string 下载ip
——hangupdirection int 挂断方向
——hangupcause int 挂断原因
——userkey string 用户按键
——customuuidstring自定义参数
——taskidstring任务id
——roundstring任务轮次
——recordurlstring录音下载地址

Postman请求示例

c65b2c52d15ac1a4f5775e9b19f9cfe5.jpg