WebRTC signaling
The following sequence diagram shows the WebRTC signaling protocol between Alexa and your smart home add-on.
Session Description Protocol offer/answer format
TheRTCSessionController interface uses the Session Description Protocol (SDP) to negotiate session capabilities between peers.
Offer/answer exchange example
Each media track has a set of Interactive Connectivity Establishment (ICE) candidates. The example shows ICE candidates of type host. If your devices aren’t routed through a public gateway, also include either server-reflexive by using STUN or relay candidates by using TURN.
Supported communication types
TheRTCSessionController interface supports one-way (half-duplex) or two-way (full-duplex) audio communication. For an audio-only scenario, such as an Echo Plus connecting to a front door intercom, you must have two-way communication. For an audio and video scenario, such as an Echo Show connecting to a front door camera, Alexa supports one-way video communication and one-way or two-way audio communication.
-
Half-duplex communication allows users to communicate in two directions, but not simultaneously. For example:
- A walkie-talkie
- A push-to-talk door intercom
If your device doesn’t have acoustic echo cancellation support, choose half duplex.
-
Full-duplex communication allows users to communicate in two directions simultaneously. For example:
- A telephone
- A telephone door intercom
Supported resolutions
The supported resolutions are 480p to 1080p.Prerequisites and service-level requirements
Low latency is critical to an optimal user experience. To use theRTCSessionController, you must meet to following requirements:
- Alexa requires your device to support live streaming for at least one minute.
- When your add-on receives an offer, you must respond with an SDP answer within six seconds.
- Your device or platform must be WebRTC-compliant, or support the suite of protocols by WebRTC and all supported resiliency mechanisms used in WebRTC. Specifically, the following protocols and mechanisms:
- For resource considerations, you must support BUNDLE and rtcp-mux. You use a bundle to send audio and video over the same connection to reduce the number of open sockets.
- To support full duplex communication, your device must employ effective algorithms for acoustic echo cancellation (AEC) and noise suppression.
-
To support half duplex communication, you can use the push to talk (PTT) feature through the typical live view scenario. Declare
isFullDuplexAudioSupportedasfalsein the discovery response. -
To support video, you must use the following video codec:
- H.264 (up to profile high, level 4.1)
-
To support audio, you must use one of the following audio codecs:
- Opus (preferred codec)
- PCMU/PCMA
-
For ICE candidates, you can use either UDP or TCP but you must use IPv4. Alexa doesn’t support trickle ICE. You must gather all ICE candidates up front and send them in the SDP answer.
- Minimize the number of ICE candidates to allow your device to respond within six seconds.
Cameras that support pan, tilt, zoom
To enable an Alexa user to use the pan, tilt, and zoom features, your device must implement theRTCSessionController and the RangeController interfaces. Alexa uses the Alexa.RangeController directives to request that your camera do the following:
- Pan – Rotate the camera on the horizontal plane, left and right.
- Tilt – Rotate the camera on the vertical plane, up and down.
- Zoom – Change the view to see a smaller area with more detail (zoom in) or more area with less detail (zoom out).
Specify the camera range
A camera can implement all or any subset of pan, tilt, and zoom. To specify what properties the camera supports, set theinstance field in the Alexa.RangeController to Camera.Pan, Camera.Tilt, Camera.Zoom.
For each instance, specify the minimum and maximum ranges that your camera supports. For pan and tilt, specify ranges as a percentage of the field of view (FOV) of your camera. For example, if your camera has a 90-degree horizontal FOV, and can rotate 360 total degrees, the range of motion is 400%. The range represents the number of times you can fit the FOV in the total range. You can define your total supported range as 0–400 or –200–200 (minus 200 to 200). If you use –200–200, Alexa can use zero for the direction, straight ahead. For zoom, specify the range as a percent from 0 to the maximum zoom that your camera supports.
The following diagram shows the camera field of view before and after the user asks Alexa to pan to the right. Here, the camera has a 90 degree FOV and can rotate 360 degrees.
Camera pan example
The following example shows theAlexa.RangeController interface for a camera that supports pan. Send these properties in the discovery response. For details about the properties, see Alexa.RangeController.
Respond to pan, tilt, and zoom directives
To request pan, tilt, and zoom, Alexa sends aSetRangeValue or AdjustRangeValue directive to your device over the RTC data channel. Respond immediately. Don’t wait for movement to complete. After the motion completes, partially completes, or fails, send an asynchronous an Alexa.ChangeReport event with the current position of the camera. Send the Alexa.ChangeReport event to Alexa over both the RTC data channel and the Alexa gateway.
The following list shows the response scenarios:
- If the camera can fulfill the requested motion, respond with an
Alexa.Responseand include the final position. Here, the final position is the requested position. - If the camera can partially fulfill the requested motion, respond with an
Alexa.Responseand include the final position. For example, if the request contains a range that’s outside of the camera range, the final position is the furthest extent the camera can move. - If the camera knows it can’t fulfill the request, respond with an
Alexa.ErrorResponse. - After any completed full or partial position change, due a request from Alexa or from any an external source, send an
Alexa.ChangeReportevent with the current position of the camera. - If the requested motion fails after you send an
Alexa.Response, send anAlexa.ChangeReportevent with the current position of the camera.

