Skip to main content
Device integration brings things that don’t run our SDK into the channel: the SIP phone in a meeting room, the GB28181 camera on the wall, an RTSP stream. They join through a device gateway acting on their behalf, and appear in the channel as a regular user (with a uid prefixed with _agent_). For the parameters and response structure of each endpoint, see Device integration.

Three steps

Devices don’t connect to RTC directly. Each one is attached to a gateway, which handles signaling and media conversion. So step 1 can’t be skipped— a wrong gw keeps the device from coming online.

Six integration types

type is a URL query parameter (?type=regsip), not part of the request body. The request body fields of Add a device and Update a device change with it: The table lists only the fields specific to each type. For the full request body of each value, see Add a device (with a section per type). All types require display_name (display name) and gw (device gateway); remark is optional. For types other than rtsp, also note: registration mode requires the device to register with the gateway itself, while with direct IP we connect to the device. Which one to choose depends on whether we can reach the network the device is on. To be notified when a registration-mode device comes online or goes offline, subscribe to the agent_online / agent_offline callbacks; see the Callback events guide. When updating a device, type must match the type the device was registered with; you can’t use it to turn a SIP device into an RTSP one. To change the integration type, delete the device and register it again.

GB28181 channels

A GB28181 device (an NVR or a dome camera) may have several camera channels, and each GB28181 channel is a separate video in the SRTC channel. subjects is a map of “channel number → channel name”:
There are three ways to maintain them, with the same result: Likewise, the device’s own sip_no can be obtained with Generate a GB28181 device SIP number. Both “generate” endpoints only return a number and don’t save anything; you still have to register it yourself. For a GB28181 camera to register, the device must be configured with the “upper-level platform” info (SIP number, domain, IP, port)— get these values from List device gateway platform info.

Inviting devices and controlling them in the channel

Get agents[].type and contact for Invite devices to the channel from List devices. Each channel of a GB28181 device is a separate entry, and its contact is the channel number. Joining is asynchronous: a successful response only means the invitation was sent. The device is actually online only when the user_join callback arrives. If you subscribe to the agent_join callback, you must also return sid in it, or the device can’t join—see the Callback events guide. Devices can’t turn their own microphone and camera on or off; only the server can send these commands: Turn device video on or off / Turn device audio on or off. For uid, use the device’s user ID in the channel (prefixed with _agent_, from the user list or the user_join callback). If you don’t pass uid, the operation applies to all devices in the channel. If you subscribe to the agent_operate callback, both operations first ask your backend, and a non-zero return rejects them.

Device type numbers

list-invite and invite use numeric types, which are a different scheme from the type strings: The device_type of users in the channel is a third numbering scheme (the agent range starting at 80); see the Callback events guide.