查询时间段内的通话记录

POST
https://api.itniotech.com/aivoice/recordQuery
查询时间段内的通话记录。
 
请求参数
参数 说明 是否必填 类型
current 当前页码,1-N Int
size 每页显示数,1-100 Int
params 分页参数 Object
appId 应用id string
startTime 查询起始时间,时间格式: 2022-09-01 00:00:00 string
endTime 查询结束时间,时间格式: 2022-10-01 00:00:00 string
 
请求示例
Request URL:
    https://api.itniotech.com/aivoice/recordQuery
Request Method:
    POST
Request Headers:
    Content-Type: application/json;charset=UTF-8
    Sign: 05d7a50893e22a5c4bb3216ae3396c7c
    Timestamp: 1630468800
    Api-Key: bDqJFiq9
Request Body:
{
    "current":1,
    "size":1,
    "params":{
        "appId":"LILIN888",
        "startTime":"2022-09-28 00:00:00",
        "endTime":"2022-09-28 23:00:00"
    }
}
 
响应参数
参数 说明 类型
status 状态码,0成功,其他失败参见响应状态码说明 String
reason 失败原因说明 String
data 返回数据 Object
total 总条数 Long
size 每页显示条数 Int
current 当前页 Int
pages 总页数 Int
records 记录 Array
keyId ID String
appId 应用ID String
callId 通话唯一ID(内部) String
callRecordId 通话唯一ID(第三方) String
robotCount 任务使用的AI并发数 Int
callJobId 任务ID String
dialogFlowId 话术ID String
tenantPhoneNumberId 线路ID String
calledPhoneNumber 客户手机号 String
hangupBy 挂断状态 String
resultStatus 通话结果 String
startTime 拨打开始时间 String
endTime 拨打结束时间 String
chatDuration 通话时长(单位秒) String
chargedDuration 计费时长(单位秒) String
chatRound 通话轮次 String
attributes 用户属性 String
customerConcern 用户关注点 String
properties 自定义变量 String
intentLevelDetailName 意向标签名称 String
fullAudioUrl 用户和AI合成录音 String
customerAudioUrl 用户录音 String
dynamicProperties 通话过程中动态变量 String
redialTimes 自动重播次数 String
 
响应状态码
status 状态说明
0 成功
-1 账号认证异常
-4 时间戳过期
-6 ip限制
-27 参数校验异常
-37 应用不存在
-49 账号未认证
-50 应用未报价
-57 签名不能为空
-58 时间戳不能为空
-59 apikey不能为空
 

LANGUAGE

Java

PHP

REQUEST

import cn.hutool.crypto.SecureUtil;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public void recordQuery() {
    final String baseUrl = "https://api.itniotech.com/aivoice";
    final String apiKey = "your api key";
    final String apiPwd = "your api secret";
    final String appId = "your appid";

    final String url = baseUrl.concat("/recordQuery");
    HttpRequest request = HttpRequest.post(url);

    // currentTime
    final String datetime = String.valueOf(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond());
    // generate md5 key
    final String sign = SecureUtil.md5(apiKey.concat(apiPwd).concat(datetime));
    request.header(Header.CONNECTION, "Keep-Alive")
            .header(Header.CONTENT_TYPE, "application/json;charset=UTF-8")
            .header("Sign", sign)  //Signature with encryption
            .header("Timestamp", datetime) //Current system time stamp (second)
            .header("Api-Key", apiKey); //API KEY(Home-Developer options)

    JSONObject params = JSONUtil.createObj()
            .set("appId", appId)
            .set("startTime", "2022-10-09 00:00:00") //Query start time
            .set("endTime", "2022-10-10 23:00:00"); //Query end time
    String page = JSONUtil.createObj()
            .set("current", 1) //Current page, 1-N
            .set("size", 10) //Number of displays per page, 1-100
            .set("params", params)
            .toString();

    HttpResponse response = request.body(page).execute();
    if (response.isOk()) {
        String result = response.body();
        System.out.println(result);
    }
}
 

REQUEST

header('content-type:text/html;charset=utf8');
$apiKey = "your api key";
$apiSecret = "your api secret";
$appId = "your appid";
$url = "https://api.itniotech.com/aivoice/recordQuery";
$timeStamp = time();
$sign = md5($apiKey.$apiSecret.$timeStamp);
$dataArr['current'] = 1;
$dataArr['size'] = 10;
$dataArr['params'] = array(
  "appId" => $appId,
  "startTime" => "2022-10-09 00:00:00",
  "endTime" => "2022-10-10 23:00:00"
);

$data = json_encode($dataArr);
$headers = array('Content-Type:application/json;charset=UTF-8',"Sign:$sign","Timestamp:$timeStamp","Api-Key:$apiKey");

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 600);
curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch, CURLOPT_POSTFIELDS , $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$output = curl_exec($ch);
curl_close($ch);
var_dump($output);
 

RESPONSEEXAMPLE

{
    "status": "0",
    "reason": "success",
    "data": {
    "records": [
            {
                "keyId": "63340c952e896c2d1c773b2f",
                "appId": "lTWfdrEp",
                "callId": "2209281656562000005",
                "callRecordId": "219354",
                "callJobId": "11142",
                "dialogFlowId": "8682",
                "tenantPhoneNumberId": "2958",
                "customerPersonName": "lii",
                "calledPhoneNumber": "13612345678",
                "hangupBy": "INITIAL_HANGUP",
                "resultStatus": "ANSWERED",
                "startTime": "2022-09-28 16:57:11",
                "endTime": "2022-09-28 16:57:50",
                "chatDuration": "32",
                "chargedDuration": "60",
                "chatRound": "4",
                "attributes": "[]",
                "customerConcern": "[]",
                "analysisBasis": "F(Applicant touchable)",
                "properties": "{income=3000, IDCard=1234, relation=friend, name=Jack}",
                "intentLevelDetailName": "F(Applicant touchable)",
                "fullAudioUrl": "https://obs-ai-call-engine.obs.ap-southeast-3.myhuaweicloud.com:443/DialogueRecording/TenantId2038/CallJobId11142/Yfgx_JId_11142_SId_-1_TId_19991133/ai_user.wav",
                "customerAudioUrl": "https://obs-ai-call-engine.obs.ap-southeast-3.myhuaweicloud.com:443/DialogueRecording/TenantId2038/CallJobId11142/Yfgx_JId_11142_SId_-1_TId_19991133/user.wav",
                "dynamicProperties": "{phone=18186441005, sex=man, name=446}",
                "redialTimes": "0"
            }
        ],
        "total": 1,
        "size": 20,
        "current": 1,
        "pages": 1
    }
}