参数 | 说明 | 是否必填 | 类型 |
---|---|---|---|
current | 当前页码,1-N | 是 | Int |
size | 每页显示数,1-100 | 是 | Int |
params | 分页参数 | 是 | JSONObject |
strTime | 查询起始时间,ISO8601标准时间格式:2022-01-01T00:00:00+08:00 | 是 | String |
endTime | 查询起始时间,ISO8601标准时间格式:2022-01-31T00:00:00+08:00 | 是 | String |
sipGroupName | 话机组名称,精准匹配 | 否 | String |
phoneName | 话机名称,精准匹配 | 否 | String |
Request URL:
https://api.itniotech.com/voice/recordSipQuery
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"current":1,
"size":10,
"params":{
"strTime":"2022-01-01T00:00:00+08:00",
"endTime":"2022-01-31T00:00:00+08:00",
"sipGroupName":"",
"phoneName":""
}
}
参数 | 说明 | 类型 |
---|---|---|
status | 状态码,0成功,其他失败参见响应状态码说明 | String |
reason | 失败原因说明 | String |
data | 分页数据 | JSONObject |
total | 总记录条数 | Int |
size | 每页显示数 | Int |
current | 当前页码 | Int |
pages | 总页码 | Int |
searchCount | 查询状态 | Boolean |
records | 数据集合 | JSONArray |
voiceId | 记录唯一id | String |
sipGroupName | 话机组名称 | String |
phoneName | 话机名称 | String |
callee | 被叫号码 | String |
displayNum | 显示号码 | String |
code | 地区运营商 | String |
submitTime | 提交时间 | String |
callTime | 呼叫时间 | String |
ringingTime | 响铃时间 | String |
answerTime | 接听时间 | String |
hangupTime | 挂断时间 | String |
callDuration | 通话时长(秒) | Int |
chargedDuration | 计费时长(秒) | Int |
terminationCode | sip code,200代表成功建立通话 | String |
terminationReason | 状态码描述 | String |
cost | 消费金额(报价币种) | String |
billPeriod | 计费周期:20+20,60+60 | String |
rate | 费率(报价币种) | String |
recordingFileId | 录音文件唯一id | String |
settleRate | 本币费率(报价币种非美金时有值) | String |
quoteExchange | 客户侧报价汇率(报价币种非美金时有值) | String |
settlePay | 本币消费金额(报价币种非美金时有值) | String |
currency | 报价币种,EUR/USD(报价币种非美金时有值) | String |
status | 状态说明 |
---|---|
0 | 成功 |
-1 | 账号认证异常 |
-2 | ip限制 |
-16 | 时间戳过期 |
-18 | 系统异常 |
-22 | 参数异常 |
-25 | 超出时间范围限制 |
Java
PHP
REQUEST
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONUtil;
import java.time.LocalDateTime;
import java.time.ZoneId;
void recordSipQuery() {
final String baseUrl = "https://api.itniotech.com/voice";
final String apiKey = "your api key";
final String apiPwd = "your api secret";
final Integer current = 1;
final Integer size = 20;
final String strTime = "2022-01-01T00:00:00+08:00";
final String endTime = "2022-01-31T00:00:00+08:00";
final String sipGroupName = "";
final String phoneName = "";
final JSONObject params = JSONUtil.createObj()
.set("strTime", strTime)
.set("endTime", endTime)
.set("sipGroupName", sipGroupName)
.set("phoneName", phoneName);
final String url = baseUrl.concat("/recordSipQuery");
HttpRequest request = HttpRequest.post(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);
final String body = JSONUtil.createObj()
.set("current", current)
.set("size", size)
.set("params", params)
.toString();
HttpResponse response = request.body(body).execute();
if (response.isOk()) {
String result = response.body();
System.out.println(result);
}
}
REQUEST
$apiKey = "your api key";
$apiSecret = "your api secret";
$url = "https://api.itniotech.com/voice/recordSipQuery";
$timeStamp = time();
$sign = md5($apiKey.$apiSecret.$timeStamp);
$dataArr['current'] = 1;
$dataArr['size'] = 10;
$dataArr['params'] = array("strTime"=>"2022-04-01T00:00:00+08:00",
"endTime"=>"2022-04-31T00:00:00+08:00",
"sipGroupName"=> "",
"phoneName"=> ""
);
$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);
$error = curl_error($ch);
curl_close($ch);
var_dump($output);
RESPONSEEXAMPLE
{
"status": "0",
"reason": "success",
"data": {
"total": 5,
"size": 20,
"current": 1,
"pages": 1,
"searchCount": true,
"records": [
{
"voiceId": "2203031113381000002",
"sipGroupName": "group1",
"phoneName": "sipName8555",
"callee": "91856321412",
"displayNum": "1008122211",
"code": "Afghanistan(Kandahar)",
"submitTime": "2022-02-18T14:42:40+08:00",
"callTime": "2022-02-18T14:45:42+08:00",
"ringingTime": "2022-02-18T14:42:47+08:00",
"answerTime": "2022-02-18T14:42:50+08:00",
"hangupTime": "2022-02-18T14:42:55+08:00",
"callDuration": 5,
"chargedDuration": 5,
"terminationCode": "200",
"terminationReason": "success",
"cost": "2",
"billPeriod": "20+20",
"rate": "1.2",
"recordingFileId": "12022022570cc2484c59d4f8b9745d34226285b1e.mp3",
"settleRate": "1.2793",
"quoteExchange": "0.938",
"currency":"EUR",
"settlePay":"1.2793"
}
]
}
}