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. When omitted, SignalWire uses "PCMU".
"PCMU"— 8 kHz G.711 µ-law"L16@16000h"— 16-bit linear PCM at 16 kHz"L16@24000h"— 16-bit linear PCM at 24 kHz
Always include the rate with L16: a bare "L16" is 8 kHz. If SignalWire
doesn’t accept the codec, the stream doesn’t start.
track
Which audio to stream. Sent as given.
"inbound_track"— audio received from the caller"outbound_track"— audio sent to the caller"both_tracks"— 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.