Skip to main content
POST
/
calls
/
{call_control_id}
/
actions
/
streaming_start
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: 'My API Key',
});

const response = await client.calls.actions.startStreaming('call_control_id');

console.log(response.data);
{
  "data": {
    "result": "ok"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

call_control_id
string
required

Unique identifier and token for controlling the call

Body

application/json

Start streaming media request

stream_url
string

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

Example:

"wss://www.example.com/websocket"

stream_track
enum<string>
default:inbound_track

Specifies which track should be streamed.

Available options:
inbound_track,
outbound_track,
both_tracks
Example:

"both_tracks"

stream_codec
enum<string>
default: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.

Available options:
PCMU,
PCMA,
G722,
OPUS,
AMR-WB,
L16,
default
Example:

"PCMA"

stream_bidirectional_mode
enum<string>
default:mp3

Configures method of bidirectional streaming (mp3, rtp).

Available options:
mp3,
rtp
Example:

"rtp"

stream_bidirectional_codec
enum<string>
default:PCMU

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

Available options:
PCMU,
PCMA,
G722,
OPUS,
AMR-WB,
L16
Example:

"G722"

stream_bidirectional_target_legs
enum<string>
default:opposite

Specifies which call legs should receive the bidirectional stream audio.

Available options:
both,
self,
opposite
Example:

"both"

stream_bidirectional_sampling_rate
enum<integer>
default:8000

Audio sampling rate.

Available options:
8000,
16000,
22050,
24000,
48000
Example:

16000

enable_dialogflow
boolean
default:false

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

Example:

true

dialogflow_config
Dialogflow Config · object
client_state
string

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

Example:

"aGF2ZSBhIG5pY2UgZGF5ID1d"

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.

Example:

"891510ac-f3e4-11e8-af5b-de00688a4901"

Response

Successful response upon making a call control command.

data
Call Control Command Result · object
Example:
{ "result": "ok" }