呼叫状态查询
云通讯平台为开发者提供了呼叫状态查询接口,以便开发者通过此REST API对当前一路通话的状态进行实时查询。
REST API:呼叫状态查询
通过HTTPS POST方式提交请求,云通讯平台收到请求后,返回操作结果。
1、请求
1.1 请求地址
- /{SoftVersion}/Accounts/{accountSid}/ivr/call
1.2 请求包头
- 请参阅:Rest 介绍》统一请求包头,使用主账户进行验证
1.3 请求包体
属性 | 类型 | 约束 | 说明 |
Appid | String | 必选 | 应用Id |
callid | String | 必选 | 呼叫Id |
action | String | 可选 | 查询结果通知的回调url地址 |
1.4 XML请求示例
- POST /2013-12-26/Accounts/abcdefghijklmnopqrstuvwxyz012345/ivr/call?sig=155EAA68C5DFB6B762A42D88F406ABCD&callid= 13421304281638380001000000000001
- HTTP/1.1
- Accept:application/xml;
- Host:192.168.0.1:8883
- content-length: 139
- Content-Type:application/xml;
- charset=utf-8;
- Authorization:ZmY4MDgwODEzYzM3ZGE1MzAxM2M4MDRmODA3MjAwN2M6MjAxMzAyMDExNTABCDE=
- <?xml version="1.0" encoding="UTF-8"?>
- <Request>
- <Appid>ff8081813fc747ee013fc12345678</Appid>
- <QueryCallState callid ="13421304281638380001000000000001"/>
- </Request>
1.5 JSON请求示例
- POST /2013-12-26/Accounts/abcdefghijklmnopqrstuvwxyz012345/ivr/call?sig=155EAA68C5DFB6B762A42D88F406ABCD&callid= 13421304281638380001000000000001
- HTTP/1.1
- Accept:application/json;
- Host:192.168.0.1:8883
- content-length: 139
- Content-Type:application/json;
- charset=utf-8;
- Authorization:ZmY4MDgwODEzYzM3ZGE1MzAxM2M4MDRmODA3MjAwN2M6MjAxMzAyMDExNTABCDE=
- {"Appid":"ff8081813fc747ee013fc12345678","QueryCallState":{"callid":"14092410343310310001000400000047"}}
2、响应
2.1 响应包体
属性 | 类型 | 约束 | 说明 |
statusCode | String | 必选 | 请求状态码,取值000000(成功),可参考Rest 错误代码。 |
callSid | String | 必选 | 呼叫Id |
state | String | 必选 | 呼叫状态 0:通话结束, 1:通话中 |
2.2 XML请求示例
- HTTP/1.1 200 OK
- Content-Length:586
- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
- <Response>
- <statusCode>000000</statusCode>
- <callSid>029340934823840303948889933</callSid>
- <state>0</state>
- </Response>
2.3 JSON请求示例
- HTTP/1.1 200 OK
- Content-Length:586
- {"statusCode":"000000","state":"1","callSid":"14092410343310310001000400000047"}