stream
Start streaming call audio to a WebSocket endpoint. Returns a
StreamAction that you can use to
stop the stream or wait for it to finish.
This method emits calling.call.stream events. See Call Events for payload details.
Parameters
url
WebSocket URL to stream audio to (e.g., "wss://example.com/stream").
name
A name for this stream, useful for identifying multiple concurrent streams.
codec
Audio codec for the stream.
"PCMU"— G.711 mu-law (default for North America)"PCMA"— G.711 A-law (default for international)"OPUS"— Opus codec (higher quality, variable bitrate)
track
Which audio track to stream.
"inbound"— audio received from the caller"outbound"— audio sent to the caller"both"— audio in both directions
statusUrl
URL to receive stream status webhooks.
statusUrlMethod
HTTP method for status webhooks.
"GET"— send status updates via GET request"POST"— send status updates via POST request
authorizationBearerToken
Bearer token for authenticating with the WebSocket server.
customParameters
Custom key-value pairs sent with the stream start message.
controlId
Custom control ID. Auto-generated if not provided.
onCompleted
Callback invoked when the stream ends.
Returns
Promise<StreamAction> — An action handle with
stop() and wait() methods.