语音消息记录单条查询

GET
https://api.itniotech.com/voice/recordGroup/{voiceId}
查询指定语音消息记录信息(最近两个月内)。
 
请求参数
voiceId
String
必填
记录唯一id
 
请求示例
Request URL:
    https://api.itniotech.com/voice/recordGroup/2203031113381000002
Request Method:
    GET
Request Headers:
    Content-Type: application/json;charset=UTF-8
    Sign: 05d7a50893e22a5c4bb3216ae3396c7c
    Timestamp: 1630468800
    Api-Key: bDqJFiq9
 
响应参数
参数 说明 类型
status 状态码,0成功,其他失败参见响应状态码说明 String
reason 失败原因说明 String
data 记录详情 JSONObject
voiceId 记录唯一id String
callee 被叫号码 String
displayNum 显示号码 String
code 地区运营商 String
submitTime 提交时间 String
callTime 呼叫时间 String
ringingTime 响铃时间 String
answerTime 接听时间 String
hangupTime 挂断时间 String
callDuration 通话时长(秒) Int
chargedDuration 计费时长(秒) Int
terminationCode 状态码0成功其他失败 String
terminationReason 状态码描述 String
cost 消费金额(美元) String
billPeriod 计费周期:20+20,60+60 String
rate 费率(美元) String
baseCost 基础费用(美元) String
voiceFileId 语音文件唯一id,群呼必填 String
feedbackValue 按键反馈值(-1:无,非-1:按键值) String
calledInfo 被叫信息,0-1000位字符 String
 
响应状态码
status 状态说明
0 成功
-1 账号认证异常
-2 ip限制
-16 时间戳过期
-18 系统异常
-22 参数异常
 

LANGUAGE

Java

PHP

REQUEST

import cn.hutool.core.codec.Base64;
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.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.ZoneId;

public void recordGroup() {
    final String baseUrl = "https://api.itniotech.com/voice";
    final String apiKey = "your api key";
    final String apiPwd = "your api secret";

    final String voiceId = "{{voiceId}}";

    final String url = baseUrl.concat("/recordGroup/").concat(voiceId);
    HttpRequest request = HttpRequest.get(url);

    // generate md5 key
    final String datetime = String.valueOf(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond());
    final String sign = SecureUtil.md5(apiKey.concat(apiPwd).concat(datetime));

    request.header(Header.CONTENT_TYPE, "application/json;charset=UTF-8")
            .header("Sign", sign)
            .header("Timestamp", datetime)
            .header("Api-Key", apiKey);

    HttpResponse response = request.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";
$voiceId = "{{voiceId}}";

$url = "https://api.itniotech.com/voice/recordGroup/".$voiceId;

$timeStamp = time();
$sign = md5($apiKey.$apiSecret.$timeStamp);

$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_CONNECTTIMEOUT, 600);
curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

$output = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);

var_dump($output);
 

RESPONSEEXAMPLE

{
    "status": "0",
    "reason": "success",
    "data":{
        "voiceId": "2203031113381000002",
        "callee": "91856321412",
        "displayNum": "1008122211",
        "code": "Afghanistan(Kandahar)",
        "submitTime": "2022-01-18T14:42:40+08:00",
        "callTime": "2022-01-18T14:42:45+08:00",
        "ringingTime": "2022-01-18T14:42:47+08:00",
        "answerTime": "2022-01-18T14:42:50+08:00",
        "hangupTime": "2022-01-18T14:42:55+08:00",
        "callDuration": 5,
        "chargedDuration": 5,
        "terminationCode": "1000",
        "terminationReason": "success",
        "cost": "2",
        "billPeriod": "20+20",
        "rate": "1.2",
        "baseCost": "1",
        "voiceFileId": "12022022570cc2484c59d4f8b9745d34226285b1e.mp3",
        "feedbackValue": "1",
        "calledInfo": "calledInfo"
    }
}