跳转到主要内容

通用API - 录音识别统计

接口说明

按时间范围汇总或按天统计识别总数、失败数、语音信箱数和正常通话数

请求方式

POST,form-data格式

获取通话记录接口请求参数

参数名 类型 是否必须 说明
service string App.Sip_Cdr.GetAsrStats
token string 通过授权接口获取的token
starttime string 起始时间,格式:yyyy-mm-dd hh:mm:ss,最长31天
endtime string 结束时间,格式:yyyy-mm-dd hh:mm:ss,最长31天
granularity int 统计粒度:total汇总、day按天

获取通话记录接口请求示例(PHP)

<?php
    $apiUrl = 'http://127.0.0.1:8080';
    $postFields = [
        'service'   => 'App.Sip_Cdr.GetAsrStats',
        'token'     => 'ABCDEFG',
        'starttime'  => '2019-01-12 00:00:00',
        'endtime'    => '2020-12-12 00:00:00',
        'cdrid'  => 3
        'calluuid'   => 3,
        '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": {
            "stats": [
                {
                    "totalcalls": 0,
                    "failedcalls": 0,
                    "voicemailcalls": 0,
                    "normalcalls": 0
                }
            ]
        },
        "reqtime": 1789459343,
        "rsptime": 1789459343
    },
    "msg": ""
}

返回参数说明

参数名 类型 说明
result objest 返回的结果集
—totalitems int 记录总数
—currentpage int 当前页码
—itemsperpage int 每页数量
—stats array 记录数组
——totalcalls int 总数
——failedcalls int 失败数
——voicemailcalls int 语音信箱数
——normalcalls int 正常通话数