Skip to main content
Callbacks let your backend learn about changes on the meeting side without polling. Register the URL with Configure event notifications. Subscribing to any event is optional, and events you don’t subscribe to are not sent.

Request format

We send a POST request to the cb_url you registered. The event name appears in both the query parameters and the request body:
Events differ only in data; the three outer fields are always the same. time is the Unix timestamp (in seconds) when the event occurred.

Verify the signature (required)

The signature in the callback request headers uses exactly the same algorithm as calls to the server API (see the Overview), just in the opposite direction: this time we sign with your app_key and you verify. The request headers are app_id / nonce / timestamp / signature. Without signature verification, anyone who knows your callback URL can forge events. Don’t skip this step.

Response requirements

  • The HTTP status code must be 200
  • The response body must be standard JSON: {"code": 0}
  • Our request timeout is 10 seconds. Your handler must return within that time (move heavy work to async processing)
A non-200 status, a non-JSON body, or a non-zero code counts as a failure.

Events at a glance

Subscribing is all it takes: the server enables the underlying events it needs based on the events you subscribe to when you Configure event notifications, with no configuration by the deployer. This applies from SMeeting server v1.8.0. In earlier versions, device_invite_failed, user_online / user_offline, mcu_record_done, and mcu_alarm are sent only after the deployer appends the corresponding underlying events to rtc.callback_events in the server configuration (agent_invite_failed; im_connect, im_disconnect, agent_online, agent_offline; mcu_record; mcu_alarm respectively).

user_enter — User enters the meeting

role: 0 regular member, 1 host, 2 co-host. Sent only after the user has actually connected to the meeting (joined its audio/video channel). Users held in the waiting room, or whose join fails partway, do not trigger it. When the same user_id enters the meeting on multiple devices, the event fires once for each device.

user_exit — User exits the meeting

Has two more fields than user_enter:
  • reason: 1 exited voluntarily, 2 removed, 3 replaced by the same user entering again, 4 heartbeat timeout, 5 meeting destroyed, 6 switched to audience, 7 device connection lost
  • 7 only applies to SIP / H.323 terminals joined through the device gateway: the terminal dropped abnormally (signaling or media timeout, network failure). A normal hang-up on the terminal is still 1, so you can tell a normal hang-up from an unexpected drop
  • online is the number of online members in the meeting after this user exits; 0 means everyone has exited
Checking online == 0 to tell that “the meeting is actually empty” is more reliable than keeping your own count.

meeting_status_change — Meeting status changes

Status values: 1 not started, 2 in progress, 3 ended. from_status is included so you can tell a “normal start” (1→2) apart from cases like “an abnormal restart”.

mcu_status_change — Recording task status changes

  • task_type is a bit mask; for the values, see the Cloud recording and stream mixing guide
  • task_status: 0 pending, 1 in progress, 2 ending, 3 ended abnormally, 4 ended normally
  • err_desc has content only when task_status=3
  • record_count / total_duration / total_size are the number of files, total duration (seconds), and total bytes produced by this recording
0 and 2 are transitional states. Your backend usually only needs to care about 1 (started), 3 (failed), and 4 (ended). When the task ends, record_count in this event is often still 0: recording files start transcoding and uploading only after the task ends. After all files are uploaded, this event is sent again, and the counts in that one are complete.

mcu_record_done — A recording file is ready

This event is the right time to get the playback URL. When the task’s task_status changes to 4 (ended normally), the file is often still being transcoded and uploaded, so requesting the URL then may return nothing. One recording of a meeting produces multiple files, and this event is sent per file. A recording longer than the segment limit (1 hour by default) is split into segments by duration, and a recording that resumes after an interruption also starts a new segment. So:
  • Get the playback URL by record_id, not task_id. See Get the playback URL of a recording file
  • seq starts at 1, and sorting by it gives the playback order; offset_ms is the offset (milliseconds) from the start of the whole recording, for continuous playback
  • reason: 1 split by duration, 2 resumed after an interruption (there is a time gap from the previous segment), 3 final segment at the end, 0 unknown
  • is_last is true when all files of this recording are ready
duration is this segment’s duration (seconds), and vod_size is its size in bytes.
To get all playable URLs of a meeting in one call, use Get playback URLs of all recordings in a meeting. It returns every segment, sorted by segment number.

mcu_alarm — Recording task error

(The alarm_brief above means “Stream push interrupted”.) gw is the gateway node running the task. Giving us this value speeds up troubleshooting a lot. Note that an alarm doesn’t mean the task has stopped— rely on task_status in mcu_status_change. Push tasks that keep failing also use this event: task_type 0 means it’s a push alarm, and task_id is then the push task’s push_id, not a recording task, so don’t pass it to mcu/* endpoints; whether the push has recovered is shown by status in List push tasks. See the Media output guide.

user_mic_state_change / user_camera_state_change / user_extra_screen_state_change — User media status changes

The three events share one structure. Read the status field that matches the event name; the other two are a snapshot at the time of sending:
  • mic_state / camera_state / extra_screen_state: 1 on, 2 off — the same values as the in-meeting member list
  • Sent only when the status actually flips. The camera counts as on while either its high or low stream is published; both appearing together sends one event
  • “Extra screen” means an extra screen pushed by a client (a secondary screen, such as the always-on second view each participant keeps in remote bid evaluation). Each person pushes their own and keeps it on; it is independent of meeting sharing (share_state_change)
  • Dual-stream content sharing from a SIP/H.323 endpoint doesn’t use this event; it counts as meeting sharing and shows up in share_state_change
  • When one action toggles several media at once (for example, joining with both microphone and camera on), each is sent separately with the same ts_ms
  • No “off” events are sent when a user leaves; treat user_exit as “everything off”
  • Status reflects whether the stream is being published: a microphone that is only muted locally while still published does not trigger “off”

share_state_change — Meeting sharing status changes

Both start and stop of sharing use this event, for screen sharing and whiteboard sharing alike:
  • from_state / to_state: 0 no sharing, 1 screen, 2 whiteboard. 0→1/2 is a start, 1/2→0 is a stop, 1↔2 switches the sharing type
  • user_id is the person who started or stopped sharing; on stop it is the previous sharer
  • A stop is sent when the sharer stops, the host stops it, the host disables sharing, or the sharer leaves
  • When a new sharer takes over from a sharer who has dropped off, a stop for the previous sharer is sent first, then a start for the new one
  • “Start” is sent as soon as sharing is granted, without waiting for the client to actually push the screen
  • Dual-stream content sharing from a SIP/H.323 endpoint is meeting sharing too: when the endpoint presses its local share button, this event is sent (the platform can’t start sharing on these endpoints remotely) and user_id is that device

device_invite_failed — Device invitation failed

Sent when a device invited with Invite devices to the channel (agent/invite) failed to enter:
  • meeting_id: the current meeting found by room_no; empty if none is found (for example, the meeting was deleted), and the event is still sent
  • room_no: the room number given in the invitation
  • device: the invited device. type is the device type (2 SIP, 3 H.323, 4 GB28181, 5 RTSP, and so on), contact is the device identifier from the invitation, and name is the device name
  • code: when reason is join_refused, the error code for the refused entry (for example, the meeting has ended); 0 otherwise
  • msg: the original description, such as a SIP status line, an H.323 release reason, a stream pull error, or a server message, for troubleshooting
reason values:
  • Sent only for devices invited by the platform; failures of devices dialing in by themselves (the endpoint dials the meeting number) are not sent
  • At most once per invitation; a device that entered successfully and then dropped off is not an invitation failure, that goes through user_exit (reason 7)
  • A device already in another meeting that is invited over and refused entry to the new meeting is also sent as join_refused
This event requires a newer device gateway version to be reported; subscribe to it when you Configure event notifications and that’s it. For SMeeting server versions earlier than v1.8.0, the deployer also needs to append agent_invite_failed to rtc.callback_events in the server configuration.
Calls to users have no failure callback; for how to detect failures, see Invite and remove.

user_online / user_offline — User comes online / goes offline

Tells you whether a user is online, regardless of whether they’re in a meeting (for entering and exiting meetings, see user_enter / user_exit). People and devices share these two events, distinguished by is_agent:
  • People: a person comes online when the client enables out-of-meeting messages (for example, by calling smeeting.enableIm() on Web) and establishes an IM connection, and goes offline when they disconnect, are kicked, or time out on heartbeat
  • Devices: SIP / H.323 endpoints and GB28181 devices connected through the device gateway come online when they register with the device gateway, and go offline when they unregister or time out on heartbeat; direct-IP endpoints are probed periodically by the device gateway: online when reachable, offline when unreachable
A person comes online:
A device goes offline (user_offline has two more fields than user_online, reason and heartbeat_at, at the same level as the other fields):
  • Multi-device sign-in counts per connection: when the same person enables out-of-meeting messages on several clients, each client sends its own online and offline event, distinguished by sid. To tell whether the person is still online, aggregate the sids of all clients by user_id yourself; a single user_offline doesn’t mean the person is offline
  • Devices count per status change: periodic registration refreshes and heartbeats don’t resend online; an event is sent only when the device actually switches between online and offline, and a device that resumes heartbeats after going offline sends online again
  • An offline caused by heartbeat timeout waits for the timeout to be determined, so it’s sent 5–7 minutes after the actual disconnection; when you need the actual disconnection time, use heartbeat_at
  • Devices don’t belong to any single app, so every app subscribed to these events receives the same device’s online and offline events
Subscribe to these two events when you Configure event notifications and that’s it. For SMeeting server versions earlier than v1.8.0, the deployer also needs to append im_connect, im_disconnect (people online / offline) and agent_online, agent_offline (devices online / offline) to rtc.callback_events in the server configuration; if you only need people or only devices, appending the corresponding two is enough.

Idempotency and retry

Network jitter can cause the same event to be delivered more than once. Make your handling idempotent by event + business key (meeting_id, task_id, user_id). Don’t deduplicate by time—there can be several events of the same type within the same second. Media status and sharing status events are not guaranteed to arrive in order (for example, when the microphone is toggled quickly, “off” may arrive before “on”). Trust the one with the largest ts_ms (milliseconds); the three media status fields are a full snapshot at the time of sending, so you can simply overwrite.