Query Call Records in Time Period

POST

https://api.itniotech.com/aivoice/recordQuery

Query call records in time period.
Request Parameters
Parameters Description Required Type
current Current page, 1-N Yes Int
size Number of displays per page, 1-100 Yes Int
params Paging parameters Yes Object
 appId Application id Yes string
 startTime Query start time, time format: 2022-09-01 00:00:00 Yes string
 endTime Query end time, time format: 2022-10-01 00:00:00 Yes string
Request Sample
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"
    }
}
Response Parameters
Parameters Description Type
status "0"means successful, others than 0 means failure, seeing Status code description String
reason Failure Reason Description String
data Return Data Object
 total Total number Long
 size Number of items displayed per page Int
 current Current Page Int
 pages Page Count Int
 records record Array
keyId ID String
appId Application id String
callId Unique Call ID (internal) String
callRecordId Unique Call ID (third party) String
robotCount AI concurrency used by tasks Int
callJobId Task ID String
dialogFlowId Script ID String
tenantPhoneNumberId Line ID String
calledPhoneNumber Customer phone number String
hangupBy Hangup status String
customerPersonName Customer name String
analysisBasis Intention analysis basis String
resultStatus Call results String
startTime Call start time String
endTime Call end time String
chatDuration Call duration (unit: second) String
chargedDuration Billing duration (unit: second) String
chatRound Chat round String
attributes User attribute String
customerConcern User concerns String
properties Custom variables String
intentLevelDetailName Intention tag name String
fullAudioUrl User and AI composite recording String
customerAudioUrl User Recording String
dynamicProperties Dynamic variables during call String
redialTimes Number of automatic Redials String
Response Status Code
status Description
0 Success
-1 Authentication error
-4 Timestamp expires
-6 Restricted IP access
-27 Abnormal parameter verification
-37 Application does not exist
-49 Account not authenticated
-50 Application not quoted
-57 The Sign cannot be empty
-58 The Timestamp cannot be empty
-59 The Api-Key cannot be empty

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
    }
}