Skip to main content

Stream

Stream forks the audio streams of a call to your application in near real-time via websocket. The audio is sent as Web Socket Messages.

Stream is a background activity, meaning FlexML continues executing subsequent instructions after starting the stream.

Supported Attributes

These attributes can be used to modify Stream. They are inserted as name-value pairs in the opening tag.

AttributeData TypeDescription
audio_track

string

Determines which tracks to stream. Use either the track attribute or the audio_track attribute, but not both.

  • inbound - only the inbound audio.

  • outbound - only the outbound audio.

  • both - both the inbound and outbound audio as separate tracks.

  • mixed - both the inbound and outbound audio as a single track.

maxLength

string

The maximum length, in seconds, to stream.

timestampStart

string

relative (default) or absolute - this defines how the timestamp attribute of the Media Message Object is represented. relative timestamps start at 0. absolute timestamps start at the epoch (1970-01-01T00:00:00).

track

string

Determines which tracks to stream. Use either the track attribute or the audio_track attribute, but not both.

  • inbound_track - only the inbound audio.

  • outbound_track - only the outbound audio.

  • both_tracks - both the inbound and outbound audio as separate tracks.

  • mixed_tracks - both the inbound and outbound audio as a single track.

url
required

string

The relative or absolute URL of the WebSocket server. Both ws and wss protocols are supported. As the url does not support URL parameters, use Parameters to send custom key/value pairs.

Starting and Stopping the Stream

You should wrap Stream in Start tags when opening a stream and in Stop tags to stop the stream, using the name attribute to identify the stream.

...
<Start>
<Stream url="wss://example.com" name="myStream">
</Start>
...
<Stop>
<Stream name="myStream">
</Stop>
...

If you do not Stop the Stream, the Stream continues until the end of the call.

Custom Parameters

To pass custom key / value pairs to the WebSocket server, use Parameter.

<Stream>
<Parameter name="First Name" value="John"/>
<Parameter name="Last Name" value="Cleese"/>
</Stream>

Nesting Rules