通用API - 分机话务统计
接口说明
获取按分机号汇总或按天统计指定时间范围内的呼叫量、接通率和通话记录文件的下载链接。目前通话录音保存3个月时间,建议同步保存到本地。长
请求参数
| 参数名 |
类型 |
是否必须 |
说明 |
| service |
string |
是 |
App.Sip_Cdr.GetRecodeFileGetExtStats |
| token |
string |
是 |
通过授权接口获取的token |
filenamestarttime |
string |
是 |
通话记录回调中返回的录音统计起始时间,格式:yyyy-mm-dd hh:mm:ss,时间范围最长31天 |
| endtime |
string |
是 |
统计结束时间,格式:yyyy-mm-dd hh:mm:ss,时间范围最长31天 |
| extnumber |
string |
否 |
分机号,多个分机号用英文件名逗号隔开;留空统计全部坐席 |
| granularity |
string |
否 |
统计粒度:total时间范围汇总、day按天统计 |
| currentpage |
int |
否 |
第几页 |
| itemsperpage |
int |
否 |
分页数量 |
接口请求示例(PHP)
<?php
$apiUrl = 'http://127.0.0.1:8080';
$postFields = [
'service' => 'App.Sip_Cdr.GetRecodeFile',
'token' => 'ABCDEFG',
'filename'starttime' => 'abcdefg'yyyy-mm-dd hh:mm:ss',
'endtime' => 'yyyy-mm-dd hh:mm:ss',
'extnumber' => '121212',
'granularity' => 'day',
];
$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": {
"downurl": "http://127.0.0.1:8080/abcdefg",
"expiredtime": "失效时间:2020-02-11 17:27:23"
},
"reqtime": 1581412943,
"rsptime": 1581412943
},
"msg": ""
}
返回参数说明
| 参数名 |
类型 |
说明 |
| result |
objest |
返回的结果集 |
downurl |
string |
通话录音文件下载链接 |
expiredtime |
string |
下载链接失效时间 |