Query outbound call report (QueryOutboundCallReport)
Queries the outbound call report by call ID and returns the complete communication record of the call, including the caller number, callee number, final call status, call start and end time, and call duration.
Prerequisites
-
The SDK is installed.
-
An AccessKey pair is obtained and configured. For more information, see Obtain an AccessKey pair and configure it in environment variables.
-
The CallId (call ID) is obtained. You can obtain it from the Data.CallId response parameter when calling CreateCallOutboundInstant to initiate a real-time outbound call, or from the QueryOutboundCallList response when querying the outbound call list.
Request parameters
|
Name |
Type |
Required |
Description |
Example |
|
Action |
String |
Yes |
The operation to perform. Set the value to QueryOutboundCallReport. |
QueryOutboundCallReport |
|
Version |
String |
Yes |
The API version number. Format: YYYY-MM-DD. Set the value to 2025-11-27. |
Fixed as 2025-11-27 |
|
CallId |
String |
Yes |
The unique identifier of the call. |
call-abc123def456 |
Response parameters
|
Name |
Type |
Description |
Example |
|
RequestId |
String |
The request ID. |
xxxx-xxxx-xxxx |
|
Success |
Boolean |
Indicates whether the request was successful. |
True |
|
Code |
String |
The error code. Empty when the request is successful. |
None |
|
Message |
String |
The error message or success message. |
Success |
|
Data |
Object |
The returned data, which contains fields such as CallId, CallStatus, CalledNumber, CallerNumber, StartTime, EndTime, and Duration. For more information, see the response parameter description below. |
Examples
Python
import json
import os
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_tea_openapi.client import Client as OpenApiClient
from alibabacloud_tea_util import models as util_models
from alibabacloud_openapi_util.client import Client as OpenApiUtilClient
def main():
config = open_api_models.Config(
access_key_id=os.getenv("ACCESS_KEY_ID"),
access_key_secret=os.getenv("ACCESS_KEY_SECRET"),
)
config.endpoint = "thirdswaicall.aliyuncs.com"
config.protocol = "HTTPS"
client = OpenApiClient(config)
params = open_api_models.Params(
style="RPC",
version="2025-11-27",
action="QueryOutboundCallReport",
method="POST",
pathname="/",
protocol="HTTPS",
auth_type="AK",
req_body_type="json",
body_type="json",
)
body = {'CallId': 'call-abc123def456'}
request = open_api_models.OpenApiRequest(query=OpenApiUtilClient.query(body))
runtime = util_models.RuntimeOptions(autoretry=True, max_attempts=3)
try:
resp = client.call_api(params, request, runtime)
print(json.dumps(resp.get("body", {}), ensure_ascii=False, indent=2))
except Exception as e:
print(f"调用失败: {e}")
if __name__ == "__main__":
main()
Java
import com.aliyun.teaopenapi.Client;
import com.aliyun.teaopenapi.models.Config;
import com.aliyun.teaopenapi.models.OpenApiRequest;
import com.aliyun.teaopenapi.models.Params;
import com.aliyun.teautil.models.RuntimeOptions;
import com.google.gson.Gson;
import java.util.HashMap;
import java.util.Map;
public class Demo {
public static void main(String[] args) throws Exception {
// 初始化配置
Config config = new Config()
.setAccessKeyId(System.getenv("ACCESS_KEY_ID"))
.setAccessKeySecret(System.getenv("ACCESS_KEY_SECRET"))
.setEndpoint("thirdswaicall.aliyuncs.com")
.setProtocol("HTTPS");
Client client = new Client(config);
// 设置 API 参数
Params params = new Params()
.setStyle("RPC")
.setVersion("2025-11-27")
.setAction("QueryOutboundCallReport")
.setMethod("POST")
.setPathname("/")
.setProtocol("HTTPS")
.setAuthType("AK")
.setReqBodyType("json")
.setBodyType("json");
// 构建请求参数
Map<String, Object> body = new HashMap<>();
body.put("CallId", 1);
OpenApiRequest request = new OpenApiRequest()
.setQuery(com.aliyun.openapiutil.Client.query(body));
// 设置运行时选项(自动重试)
RuntimeOptions runtime = new RuntimeOptions()
.setAutoretry(true)
.setMaxAttempts(3);
try {
// 调用 API
Map<String, ?> response = client.callApi(params, request, runtime);
Gson gson = new Gson();
System.out.println(gson.toJson(response.get("body")));
} catch (Exception e) {
System.err.println("调用失败: " + e.getMessage());
}
}
}
Sample response
{
"Success": true,
"Code": null,
"Message": "Success",
"RequestId": "xxxx-xxxx-xxxx",
"Data": {
"CallId": "call-abc123def456",
"CallStatus": 2001105,
"CalledNumber": "13800138000",
"CallerNumber": "null",
"StartTime": "2026-04-10 10:00:00",
"EndTime": "2026-04-10 10:02:30",
"Duration": 150
}
}
The specific results are contained in the Data node. The following table describes the parameters of the Data node.
|
Name |
Type |
Description |
Example |
|
CallId |
String |
The unique identifier of the call. |
call-abc123def456 |
|
CallStatus |
String |
The final status of the call. A numeric code is returned. For more information about the meaning of each code, see the CallStatus code table below. |
2001105 |
|
CalledNumber |
String |
The callee number. |
13800138000 |
|
CallerNumber |
String |
The caller number. |
Fixed as null |
|
StartTime |
String |
The call start time. |
2026-04-10 10:00:00 |
|
EndTime |
String |
The call end time. |
2026-04-10 10:02:30 |
|
Duration |
Number |
The call duration in seconds. |
150 |
CallStatus code table
|
Code |
Enum name |
Description |
|
2001105 |
CALL_END |
Call ended normally |
|
2001101 |
START_CALL |
Calling in progress |
|
2001102 |
CALLER_CONNECTED |
Caller connected, calling the callee |
|
2001103 |
IN_CALL |
Call connected, in conversation |
|
2001104 |
CALLER_NUMBER_RESTRICTED |
Caller number restricted |
|
2001106 |
CALL_REJECT |
Callee number is empty |
|
2001109 |
CALL_HANGUP |
Call hung up (successful) |
|
2001111 |
CALLEE_REJECT |
Callee rejected (simple) |
|
2001112 |
CALL_DIRECT |
Call being transferred |
|
2001133 |
CALLEE_NO_ANSWER |
Callee did not answer or hung up early |
|
2001134 |
CALL_NUMBER_INVALID |
Callee number is invalid and cannot be reached |
|
2001135 |
CALL_CANCEL |
Callee cancelled the call |
|
2001116 |
PROVIDER_TIME_RESTRICTED |
Call time period restricted |
|
2001117 |
PROVIDER_FREQUENCY_RESTRICTED |
Call frequency restricted |
|
2001121 |
CALL_OVER_CONCURRENCY |
Call concurrency limit exceeded |
|
2000908 |
USER_LISTENED |
User finished listening to the recording |
|
2000921 |
USER_SPEAK_EARLY |
User spoke early, causing audio truncation |
|
2000922 |
USER_HANG_UP |
User hung up |
|
2000923 |
USER_NO_ANSWER |
User did not answer, rejected, or timed out |
|
2000924 |
USER_NOT_IN_SERVICE |
Number is suspended or not activated |
|
2000925 |
USER_UNREACHABLE |
Number is invalid or powered off |
|
2000927 |
USER_INVALID |
Number is invalid, unreachable, or out of service area |
|
2000929 |
VOICE_PLAY_FAILED |
Voice playback failed |
|
2000930 |
GET_PRESS_TIMEOUT |
Keypress timeout, call hung up |
|
2000933 |
POWER_OFF |
Powered off |
|
2000915 |
OUT_OF_SERVICE |
Suspended |
Error codes
If an error occurs, see Error codes for troubleshooting.