logo
In-app Chat
Powered Byspreading
On this page

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.
Note

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.
Note
  • 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

ParameterTypeDescription
appidStringThe unique ID of an app.
eventStringThe callback event. The return value is call_create.
nonceStringA random number.
signatureStringThe verification string. For more information, see Authenticating server-to-server callbacks.
timestampIntThe Unix timestamp of the server.
call_idStringThe ID of the caller.
user_idsArrayThe list of IDs of users to be called.
Note

When a call is cancelled and the called party logs out, the user_ids of the cancel callback will still return the identifier of the called party.

reasonStringReason for cancellation:
  • Active cancellation(caller_cancel)
  • Timeout cancellation(timeout_cancel)
payloadStringCall to cancel a filled extension field.
Note

It is recommended that you convert some parameters to Int for logical processing. Related fields include appid and nonce.

Sample code

  • POST/JSON
Untitled
{
    "appid": "1",
    "event": "call_cancel",
    "nonce": "350176",
    "signature": "signature",
    "timestamp": 1499676978,
    "call_id": "3501761173612493269",
    "user_ids": ["abc","def"],
    "reason": "caller_cancel",
    "payload": "payload",
}
1
Copied!

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.

Previous

Call invitation sent

Next

Call invitation accepted