Audio Stream
The audio Stream object
The audio Steam object lets you receive the raw audio of a live phone call over a configured WebSocket in near real time.
API Endpoint
POST
Attributes
Attributes | Description |
---|---|
Service_url (string, required) | WebSocket URL to which the audio stream is initiated. Example: wss://mystream.ngrok.io/audiostream If a valid URL is not provided or an active stream already exists at the URL, a 400 error is returned. |
bidirectional (boolean) | Specifies whether the WebSocket stream is bidirectional. If true , Plivo accepts the following input types from your app: - event : takes playAudio as value - media : JSON object with: • contentType : raw , wav • sampleRate : 8000 , 16000 • payload : base64-encoded raw audio |
audio_track (string) | Audio track of the call to stream. Allowed values: - inbound : audio received by Plivo - outbound : audio sent by Plivo - both : both directions Default: inbound |
stream_timeout (integer) | Max duration (in seconds) the audio will be streamed. Must be a positive integer. Default: 86400 (24 hours). This does not affect the rest of the call flow. |
status_callback_url (string) | URL to notify when stream events occur: - Stream connected - Stream stopped - Timeout reached - Stream connection failed or dropped |
status_callback_method (string) | HTTP method used to invoke status_callback_url . Allowed values: GET , POST Default: POST |
content_type (string) | Preferred codec and sampling rate. Allowed values: - audio/x-l16;rate=8000 - audio/x-l16;rate=16000 - audio/x-mulaw;rate=8000 Default: audio/x-l16;rate=8000 |
extra_headers (string) | Key-value pairs sent with the stream to the WebSocket service. Format: "key1=value1,key2=value2" Max size: 512 bytes. Only alphanumeric characters [A-Z][a-z][0-9] allowed. |
When the bidirectional value is set to true, the audio_track value should not be set to outbound or both.