After you set a callback URL for receiving stream pushing information for a stream pushing domain, ApsaraVideo Live sends messages to notify you of the stream pushing status of the domain, such as successful or interrupted stream pushing. ApsaraVideo Live supports authenticating the callback URL to avoid unauthorized access to the stream. This topic describes how to set a callback URL for receiving stream pushing information for a stream pushing domain and how to enable authentication for the callback URL.

  1. Log on to the ApsaraVideo Live console.
  2. In the left-side navigation pane, click Domains to go to the Domain Management page.
  3. Find the stream pushing domain that you want to configure and click Domain Settings.
  4. Choose Stream Management > Basic Settings and click the Stream Ingest Information tab.
  5. Click the Edit icon next to Callback URL to open the Configure Callback URL window.
    Callback URL
  6. Complete the callback URL configuration in the Configure Callback URL window.
    1. Enter the callback URL.
    2. Enable authentication for the callback URL if needed.

      If you would like to enable authentication for the callback URL, turn the Authentication tab on, fill in the Cryptographic Key field, then click OK to complete the configuration.

      Note Observe the rules on the GUI for the Cryptographic Key.
      Authenticate callback url yes

      Otherwise, click OK directly to complete the configuration.

      Authenticate callback url no

Callback logic

Callback logic for live stream ingest status
  1. During stream ingest over Real-Time Messaging Protocol (RTMP), ApsaraVideo Live checks whether the stream ingest client closes the connection within 2 seconds after ApsaraVideo Live receives an OnPublish message. If the stream ingest client does not close the connection, ApsaraVideo Live sends a callback notification about the successful stream ingest. You may require ApsaraVideo Live to send this callback notification only when ApsaraVideo Live receives live streaming data after the connection is established. In this case, submit a ticket.
  2. For example, you have Ingest Domain A and Streaming Domain B, and you use the stream pulling feature for live streaming under Streaming Domain B. You can configure ApsaraVideo Live to pull a stream at the specified point in time, or enable ApsaraVideo Live to automatically pull a stream when the origin server starts live streaming. If you want to receive a callback notification about the stream pulling status, configure stream ingest callbacks for Ingest Domain A. After the configuration, ApsaraVideo Live uses the same callback logic as that for stream ingest status to send callback notifications about the stream pulling status under Streaming Domain B. By default, ApsaraVideo Live sends a callback notification about successful stream pulling if the stream pulling client does not close the connection within 2 seconds after the connection is established. If you require ApsaraVideo Live to send this callback notification only when live streaming data is received, submit a ticket.
Note We recommend that you deliver the streaming URL only after you determine that the stream ingest or pulling is successful based on callback notifications and the list of online streams.

Callback authentication logic

The callback authentication is disabled by default. You can enable it while configuring the callback URL. The authentication logic is as follows:
  1. ApsaraVideo Live includes the ALI-LIVE-TIMESTAMP and ALI-LIVE-SIGNATURE fields in the HTTP(S) request header when sending callback information to the callback URL. The value of ALI-LIVE-SIGNATURE is calculated using the following formula:

    ALI-LIVE-SIGNATURE=MD5SUM (MD5CONTENT)

    MD5CONTENT=Stream pushing domain name|Value of ALI-LIVE-TIMESTAMP|Cryptographic key
    Note The Stream pushing domain name refers to the domain to which the callback URL is configured. The Cryptographic key refers to the authentication key for the callback URL.
  2. The server that hosts the callback URL generates an MD5 hash from a concatenated string of the stream pushing domain name, the value of ALI-LIVE-TIMESTAMP, and the cryptographic key. It then compares the MD5 hash with the value of ALI-LIVE-SIGNATURE in the HTTP(S) request header. If the MD5 hash is not consistent with the value of ALI-LIVE-SIGNATURE, the request is considered invalid.