logo
In-app Chat
Powered Byspreading
On this page

Callback on call invitation sent


Overview

When a user sends a call invitation to other users, it represents the creation of a call.

Your server can receive the call creation callback from the ZIM server to obtain the details of the call invitation.

Note
  1. If multiple users are called and one of them is logged out, the logged-out user is not included in the call creation callback.

  2. If all called users are logged out, the call creation callback is not returned.

  3. If the call inviation has been sent but the caller logs out or is indicated to be logged out by a heartbeat timeout, the business backend receives the call cancellation callback from the ZIM server. For more information, see Call cancel callback.

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.
create_timeIntThe Unix timestamp of call invitation creation.
payloadStringThe extended field for call creation.
callerStringThe user creating the call.
timeoutIntThe maximum time limit, in seconds, for waiting for a response from the called user.
Note

We recommend that you convert some parameters into integers for logic processing, including appid and nonce.

Sample code

Untitled
{
    "appid": "1",
    "event": "call_create",
    "nonce": "350176",
    "signature": "signature",
    "timestamp": 1499676978,
    "call_id": "3501761173612493269",
    "user_ids": ["abc","def"],
    "create_time": 1499676968,
    "payload": "payload",
    "caller": "caller",
    "timeout": 90
}
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

Login and logout

Next

Call invitation canceled