GB/T 28181 protocol connection process

Updated at:

This topic describes the connection process for the GB/T 28181 protocol.

GB/T 28181 registration process

To connect a GB/T 28181-compliant device, such as a camera, to Alibaba Cloud using the GB/T 28181 protocol, you must first add the device information to the Visual Edge Computing Service console.

In the camera's management console, configure the Alibaba Cloud GB/T 28181 endpoint information on your Network Video Recorder (NVR) or Internet Protocol Camera (IPC). A sample configuration page is shown below. For instructions on how to configure specific NVR or IPC models, see the documentation provided by the manufacturer.

  1. On the GB/T 28181 configuration page, select the "Enable" checkbox.

  2. Set **SIP Server ID** to the GB/T 28181 ID of the space, which is provided by Visual Edge Computing Service.

  3. Set **SIP Server Address** and **SIP Server Port** to the SIP server address and port provided by Visual Edge Computing Service. You can obtain this information after you create a space in the console or using an API.

  4. Set **Protocol Version** to "GB/T 28181-2016".

  5. Configure the device to use TCP and PS encapsulation for audio and video media transmission.

GB/T 28181 device connection configuration

Create a GB/T 28181 protocol space

  1. For more information about creating a GB/T 28181 protocol space, see the procedure.

  2. After the space is created, click Space Monitoring in the navigation bar. Select the GB/T 28181 protocol space where you want to add the device. Click Space Configuration on the right to obtain the space information.

  3. Copy the configuration information labeled ①, ②, and ③ in the figure. You will use this information on the GB/T 28181 device configuration page.

Add a GB/T 28181 device to the space

Note

The space must be a GB/T 28181 protocol space. You cannot add GB/T 28181 devices to other types of spaces, such as an RTMP stream ingest space.

  1. In the navigation bar, click Space Monitoring. Select the space you want to configure and click Device Monitoring. Then, click the Add Device button.

  2. On the Add Device page, enter the required information.

  3. Parameter descriptions

    1. Device Type: Select Camera or Platform.

      Important

      If the selected device type does not match the actual device type, you cannot pull streams from the device.

    2. Manufacturer: Select the manufacturer of your device. If your manufacturer is not listed, select Other.

    3. Device Name: Enter a custom name for the device.

    4. Device GB/T 28181 ID: The 20-digit GB/T 28181 ID of the device. For more information about the naming conventions, see GB/T 28181 ID naming conventions.

    5. Device IP: Optional. The public IP address of the device.

    6. Port: The port that the device uses. This parameter is optional.

    7. Device Username: The recommended value is the device's GB ID.

    8. Device Password: Enter a password and re-enter it to confirm.

  4. Enter the parameters and click the Create button to add the device.

    Important

    Copy the information labeled ④ and ⑤ in the figure. You will use this information on the GB/T 28181 device configuration page.

3. GB standard device configuration

    Note

    Visual Edge Computing Service supports device registration over the TCP and UDP protocols. You can select TCP or UDP as the transport protocol on the GB/T 28181 registration page of the camera.

    Firewalls in the network path may restrict ports such as 5060. The Visual Edge Computing Service access gateway supports UDP and TCP registration on multiple ports.

    • Supported UDP ports: 5060, 5160.

    • Supported TCP ports: 6060, 6160.

  1. Go to your device's GB/T 28181 configuration page.

  2. On the configuration page, enter the information labeled ① to ⑤ into the corresponding fields, as shown in the following examples.

Important
  1. The username and password for GB/T 28181 registration are not the same as the logon username and password for the camera's management console.

  2. Set the username for GB/T 28181 registration to the same value as the device's GB/T 28181 ID.

  3. If the device status becomes Locked after creation, the cause is usually a mismatch between the device username and password and those on the GB/T 28181 device configuration page. Follow these steps to resolve the issue:

    1. In the Visual Edge Computing Service console, go to Space Monitoring > Device Monitoring. Find the device, click the More button on the right, and then select Edit to update its username and password.

    2. Then, on the GB/T 28181 device configuration page, update the username and password to match the values that you entered in the previous step.

    3. Finally, click Unlock to register the device again.

GB/T 28181 registration process

After you complete the configuration, the camera starts the GB/T 28181 registration process. The basic procedure is as follows.

  1. The camera sends a registration request to the Alibaba Cloud SIP server.

  2. After the Alibaba Cloud SIP server authenticates the request, it sends a 200 OK response to the camera. If authentication is enabled, the Alibaba Cloud SIP server initiates a challenge. The camera must complete the challenge based on the GB/T 28181 standard and register again to pass authentication.

  3. After authentication is successful, the process to pull streams from the camera begins. The Alibaba Cloud SIP server sends a GB/T 28181 INVITE request to the camera. This request contains the address of the Alibaba Cloud streaming media server.

  4. The camera returns a 200 OK response.

  5. The camera connects to the Alibaba Cloud streaming media server and starts to push the video stream.

Start stream pulling after successful device registration

  1. Start stream pulling

    If you enabled automatic stream pulling (by enabling Start Stream Pulling After Adding on the Space Monitoring > Add Device page in the console), Visual Edge Computing Service automatically starts pulling the stream after the GB/T 28181 registration is successful.

    If automatic stream pulling is not configured, you must manually trigger it. You can use one of the following methods:

    1. On the Space Monitoring > Device Monitoring page, select a device and click Start Stream Pulling.

    2. On the Space Monitoring > Device Monitoring page, click Live Preview to the right of the device. On the preview page, click Start Stream Pulling at the bottom.

    3. You can call an API to start stream pulling. For more information, see the API reference for StartStream.

  2. Real-time preview

    After the device is registered, you can preview the live stream in the console by navigating to Space Monitoring > Device Monitoring > Live Preview.