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"
}
}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.
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"
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Unique identifier and token for controlling the call
Start streaming media request
The destination WebSocket address where the stream is going to be delivered.
"wss://www.example.com/websocket"
Specifies which track should be streamed.
inbound_track, outbound_track, both_tracks "both_tracks"
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.
PCMU, PCMA, G722, OPUS, AMR-WB, L16, default "PCMA"
Configures method of bidirectional streaming (mp3, rtp).
mp3, rtp "rtp"
Indicates codec for bidirectional streaming RTP payloads. Used only with stream_bidirectional_mode=rtp. Case sensitive.
PCMU, PCMA, G722, OPUS, AMR-WB, L16 "G722"
Specifies which call legs should receive the bidirectional stream audio.
both, self, opposite "both"
Audio sampling rate.
8000, 16000, 22050, 24000, 48000 16000
Enables Dialogflow for the current call. The default value is false.
true
Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string.
"aGF2ZSBhIG5pY2UgZGF5ID1d"
Use this field to avoid duplicate commands. Telnyx will ignore any command with the same command_id for the same call_control_id.
"891510ac-f3e4-11e8-af5b-de00688a4901"
Was this page helpful?