語音消息記錄單條査詢

GET

https://api.laaffic.com/v3/voice/recordGroup/{voiceId}

查詢指定語音消息記錄資訊(最近兩個月內)。
 
請求參數
voiceId
String
必填
記錄唯一id
 
請求示例
Request URL:
    https://api.laaffic.com/v3/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
settleRate 本幣費率(報價幣種非美金時有值) String
quoteExchange 客戶側報價匯率(報價幣種非美金時有值) String
currency 報價幣種,EUR/USD(報價幣種非美金時有值) String
settlePay 本幣消費金額(報價幣種非美金時有值) String
 
響應狀態碼
狀態碼 説明
0 成功
-1 帳號認證異常
-2 IP訪問受限
-16 超出時間限制
-18 系統異常
-22 參數異常
 

語言

Java

PHP

請求

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.laaffic.com/v3/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);
    }
}        
                

請求

header('content-type:text/html;charset=utf8');

$apiKey = "your api key";
$apiSecret = "your api secret";
$voiceId = "{{voiceId}}";

$url = "https://api.laaffic.com/v3/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);
        
                
 

響應示例

{
    "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",
        "settleRate": "1.2793",
        "quoteExchange": "0.938",
        "currency":"EUR",
        "settlePay":"1.2793"
    }
}                    
                

點擊此處開啟人工服務