Callback on call invitation canceled
Overview
When the following situations occur (which can be divided into two types), your server can receive a callback on the call invitation cancellation from the ZIM server, in order to determine the call status:
- Cancelled by caller:
- The caller cancels the call.
- After the initialization of the call invitation and before its timeout, no callee accepts the invitation, and the caller logs out.
- After the initialization of the call invitation and before its timeout, no callee accepts the invitation, and the caller goes offline due to heartbeat timeout.
- Cancelled by timeout:
- From the initialization of the call invitation to its timeout, no callee responds to the invitation, and the caller is still online.
From the initialization of the call invitation to its timeout, if no callee responds to the invitation, and the caller is still offline, it will trigger the
If after the call is successfully created and before the call times out, if no call recipient responds and the calling user goes offline, it will trigger the callback on call invitation timed out.
Callback description
- Request method: POST.
- The callback data needs to be decoded by UrlDecode.
- When using the POST request method to pass parameters:
- The parameters in the body can be directly passed in the JsonObject format, without the need to serialize them into a string format.
- In the headers, set "Content-type" to "application/json".
- Request URL: Configure the callback URL in the ZEGOCLOUD console.
- Protocol: HTTPS/HTTP. HTTPS is recommended.
Callback parameters
Parameter | Type | Description |
---|---|---|
appid | String | The unique ID of an app. |
event | String | The callback event. The return value is call_create . |
nonce | String | A random number. |
signature | String | The verification string. For more information, see Authenticating server-to-server callbacks. |
timestamp | Int | The Unix timestamp of the server. |
call_id | String | The ID of the caller. |
user_ids | Array | The list of IDs of users to be called. Note When a call is cancelled and the called party logs out, the |
reason | String | Reason for cancellation:
|
payload | String | Call to cancel a filled extension field. |
It is recommended that you convert some parameters to Int for logical processing. Related fields include appid
and nonce
.
Sample code
- POST/JSON
{
"appid": "1",
"event": "call_cancel",
"nonce": "350176",
"signature": "signature",
"timestamp": 1499676978,
"call_id": "3501761173612493269",
"user_ids": ["abc","def"],
"reason": "caller_cancel",
"payload": "payload",
}
Return codes
If an HTTP status code 2XX (for example, 200) is returned, the callback succeeded. Otherwise, the callback failed.
Callback retry policy
If the ZEGOCLOUD server does not receive a response, or the HTTP status code received by the ZEGOCLOUD server is not 2xx (such as 200), it will retry with intervals of 2s, 4s, 8s, 16s, and 32s respectively. If the retry still fails after an interval of 32s, it will no longer retry.