Inbound audio chunk encoded as mu-law 8-bit 8 kHz PCM.
Audio arrives as small chunks (typically 20ms / 160 bytes) at regular intervals for the duration of the call. The pipeline must decode mu-law -> PCM Int16 -> resample -> Float32 before feeding to STT/VAD.
Raw mu-law bytes decoded from whatever encoding the provider uses.
Provider-assigned stream identifier.
Optional sequenceMonotonically increasing sequence number, when provided.
Optional mediaCarrier's per-track chunk counter, distinct from its all-event sequence.
Optional timestampCarrier media timestamp in milliseconds, preserved without treating it as wall time.
DTMF tone detected by the provider during the call.
In the legacy profile only the Twilio parser reports DTMF from the media
stream; the Telnyx and Plivo carrier profiles also parse their carriers'
dtmf media events. Key presses can also arrive through the provider's
HTTP webhooks.
Single character digit pressed by the caller (0-9, *, #, A-D).
Provider-assigned stream identifier.
Optional durationDuration the key was held, in milliseconds, when reported.
Stream successfully started; metadata about the call is available.
This is always the first meaningful event on a new stream connection.
The TelephonyStreamTransport transitions from connecting to
open upon receiving this event and sends the optional
MediaStreamParser.formatConnected acknowledgment.
Provider-assigned stream identifier.
Provider call-leg identifier (e.g. Twilio CallSid, Telnyx call_control_id).
Optional metadata?: Record<string, unknown>Additional provider-specific metadata attached to the start event.
Call ended or stream was explicitly stopped.
The TelephonyStreamTransport transitions to closed and
emits a 'close' event upon receiving this.
Provider-assigned stream identifier.
Named marker injected into the audio stream for synchronisation.
Marks are used to correlate outbound audio playback completion with
application logic (e.g., knowing when a TTS utterance finished playing
so the agent can transition from speaking to listening).
The label assigned to this mark point.
Provider-assigned stream identifier.
Discriminated union of all normalised events that can arrive on a media stream WebSocket connection, regardless of the underlying telephony provider.
Variant summary
typeaudiopayload(mu-law Buffer)dtmfdigit,durationMs?startcallSid,metadata?stopstreamSid)marknameAll variants carry a
streamSidfield to identify which stream the event belongs to (important when a single server handles multiple concurrent calls).