Skip to main content

Streaming start

POST 
/calls/:call_control_id/actions/streaming_start

Start streaming the media from a call to a specific WebSocket address or Dialogflow connection in near-realtime. Audio will be delivered as base64-encoded RTP payload (raw audio), wrapped in JSON payloads.

Please find more details about media streaming messages specification under the link.

Request

Path Parameters

    call_control_id stringrequired

    Unique identifier and token for controlling the call

Body

required

Start streaming media request

    stream_url string

    The destination WebSocket address where the stream is going to be delivered.

    stream_track string

    Possible values: [inbound_track, outbound_track, both_tracks]

    Default value: inbound_track

    Specifies which track should be streamed.

    stream_codec StreamCodec (string)

    Possible values: [PCMA, PCMU, default]

    Default value: default

    Specifies the codec to be used for the streamed audio. When set to 'default' or when transcoding is not possible, the codec from the call will be used. Currently, transcoding is only supported between PCMU and PCMA codecs.

    stream_bidirectional_mode Bidirectional Stream Mode (string)

    Possible values: [mp3, rtp]

    Default value: mp3

    Configures method of bidirectional streaming (mp3, rtp).

    stream_bidirectional_codec Bidirectional Stream Codec (string)

    Possible values: [PCMU, PCMA, G722, OPUS, AMR-WB]

    Default value: PCMU

    Indicates codec for bidirectional streaming RTP payloads. Used only with stream_bidirectional_mode=rtp. Case sensitive.

    stream_bidirectional_target_legs Bidirectional Stream Target Legs (string)

    Possible values: [both, self, opposite]

    Default value: opposite

    Specifies which call legs should receive the bidirectional stream audio.

    enable_dialogflow boolean

    Enables Dialogflow for the current call. The default value is false.

    dialogflow_config

    object

    analyze_sentiment boolean

    Enable sentiment analysis from Dialogflow.

    partial_automated_agent_reply boolean

    Enable partial automated agent reply from Dialogflow.

    client_state string

    Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string.

    command_id string

    Use this field to avoid duplicate commands. Telnyx will ignore any command with the same command_id for the same call_control_id.

Responses

200: Successful response upon making a call control command.

default: Unexpected error

Callbacks

Request samples


curl -L 'https://api.telnyx.com/v2/calls/:call_control_id/actions/streaming_start' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"stream_url": "wss://www.example.com/websocket",
"stream_track": "both_tracks",
"client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
"command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",
"enable_dialogflow": false,
"dialogflow_config": {
"analyze_sentiment": false,
"partial_automated_agent_reply": false
}
}'

Response samples


{
"data": {
"result": "ok"
}
}