<Stream>
A WebSocket media stream of the call’s audio: one-way inside <Start>, bidirectional inside <Connect>. Custom parameters for your server are written as a JSON object in the element’s text (<Parameter> children are not supported; any non-JSON text, even whitespace around a child element, makes the stream fail to start). SIPRTC sends them, with call_sid, account_sid, stream_sid, from and to, in the stream’s start metadata as custom_parameters.
Used inside <Start>, <Connect>.
Attributes
Section titled “Attributes”| Attribute | Values | Default | Description |
|---|---|---|---|
url |
A ws:// or wss:// URL, without spaces — required | — | Your WebSocket server, ws:// or wss://. |
name |
string | — | A name for the stream, reported as StreamName. |
track |
inbound_track, outbound_track, both_tracks |
inbound_track |
Which audio to stream. |
encoding |
audio/x-mulaw, audio/L16 |
audio/x-mulaw |
Audio encoding on the WebSocket. |
sampleRate |
8000, 16000, 16k, auto |
8000 |
Sample rate for encoding=“audio/L16”; mu-law always streams at 8000. |
statusCallback |
An absolute http:// or https:// URL | — | URL notified when the stream starts, stops or fails. |
statusCallbackMethod |
GET, POST |
POST |
HTTP method for statusCallback. |
Callback parameters
Section titled “Callback parameters”Sent to statusCallback:
| Parameter | Description |
|---|---|
StreamEvent |
stream-started, stream-stopped, stream-error or stream-json. |
StreamSid |
Unique id of the stream. |
StreamName |
The name attribute. |
StreamError |
stream-error: what went wrong. |
StreamJson |
stream-json: the JSON message your server sent. |
CallSid |
The call streamed. |
AccountSid |
The account. |
Timestamp |
Time of the event. |