Class: TelnyxMediaStreamParser<P>
Defined in: packages/agentos/src/io/channels/telephony/parsers/TelnyxMediaStreamParser.ts:14
Telnyx media parser with an explicit documented carrier profile and a retained legacy profile. Carrier mode requires PCMU 8 kHz mono and preserves carrier timestamps and chunk counters. Legacy mode exists for existing callers and fixtures; it is not a live-carrier conformance claim.
Type Parameters
P
P extends "legacy" | "carrier" = "legacy"
Implements
Constructors
Constructor
new TelnyxMediaStreamParser<
P>(options?):TelnyxMediaStreamParser<P>
Defined in: packages/agentos/src/io/channels/telephony/parsers/TelnyxMediaStreamParser.ts:18
Carrier mode requires Telnyx bidirectional RTP with PCMU configured by the host.
Parameters
options?
protocol?
P
Returns
TelnyxMediaStreamParser<P>
Properties
protocol
readonlyprotocol:P
Defined in: packages/agentos/src/io/channels/telephony/parsers/TelnyxMediaStreamParser.ts:16
Selected once; omission preserves the old binary-output protocol.
Implementation of
Methods
formatClear()
formatClear(
streamSid):string|null
Defined in: packages/agentos/src/io/channels/telephony/parsers/TelnyxMediaStreamParser.ts:119
Stops queued carrier playback.
Parameters
streamSid
string
Returns
string | null
Implementation of
formatConnected()
formatConnected(
_streamSid):null
Defined in: packages/agentos/src/io/channels/telephony/parsers/TelnyxMediaStreamParser.ts:114
No explicit connection acknowledgment is required by Telnyx.
Unlike Twilio, Telnyx does not need a connected handshake message
before it starts sending media events.
Parameters
_streamSid
string
Unused (accepted for interface parity).
Returns
null
Always null.
Implementation of
MediaStreamParser.formatConnected
formatMark()
formatMark(
streamSid,name):string|null
Defined in: packages/agentos/src/io/channels/telephony/parsers/TelnyxMediaStreamParser.ts:121
Marks carrier playback.
Parameters
streamSid
string
name
string
Returns
string | null
Implementation of
formatOutgoing()
formatOutgoing(
audio,streamSid):Pextends"carrier"?string:Buffer
Defined in: packages/agentos/src/io/channels/telephony/parsers/TelnyxMediaStreamParser.ts:101
Carrier mode sends JSON media; legacy mode returns the original bytes.
Parameters
audio
Buffer
streamSid
string
Returns
P extends "carrier" ? string : Buffer
Implementation of
MediaStreamParser.formatOutgoing
parseIncoming()
parseIncoming(
data):MediaStreamIncoming|null
Defined in: packages/agentos/src/io/channels/telephony/parsers/TelnyxMediaStreamParser.ts:37
Parse a raw WebSocket frame from a Telnyx media stream.
The carrier profile (parseCarrierMedia) reads start with the nested
start.call_control_id and start.media_format, which must declare PCMU at
8 kHz mono; media with its base64 media.payload, inbound track only;
dtmf, mark and stop. An unsupported start format, an error event or
an oversized frame throws.
The legacy profile keeps the released mapping: stream_id to streamSid, a
top-level call_control_id to callSid and the audio in media.chunk, with
start, media and stop alone.
Parameters
data
Raw WebSocket frame payload (JSON string or Buffer from Telnyx).
string | Buffer
Returns
MediaStreamIncoming | null
Normalised MediaStreamIncoming event, or null for
outbound audio tracks, unknown event types, or malformed messages.