Class: PlivoMediaStreamParser
Defined in: packages/agentos/src/io/channels/telephony/parsers/PlivoMediaStreamParser.ts:14
Plivo 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.
Implements
Constructors
Constructor
new PlivoMediaStreamParser(
options?):PlivoMediaStreamParser
Defined in: packages/agentos/src/io/channels/telephony/parsers/PlivoMediaStreamParser.ts:18
Selects explicit PCMU 8 kHz in the documented carrier protocol.
Parameters
options?
CarrierProtocolOptions = {}
Returns
PlivoMediaStreamParser
Properties
protocol
readonlyprotocol:"legacy"|"carrier"
Defined in: packages/agentos/src/io/channels/telephony/parsers/PlivoMediaStreamParser.ts:16
Selected once; omission preserves the released snake-case parser.
Implementation of
Methods
formatClear()
formatClear(
streamSid):string|null
Defined in: packages/agentos/src/io/channels/telephony/parsers/PlivoMediaStreamParser.ts:101
Clears queued carrier audio.
Parameters
streamSid
string
Returns
string | null
Implementation of
formatMark()
formatMark(
streamSid,name):string|null
Defined in: packages/agentos/src/io/channels/telephony/parsers/PlivoMediaStreamParser.ts:103
Sends a Plivo checkpoint.
Parameters
streamSid
string
name
string
Returns
string | null
Implementation of
formatOutgoing()
formatOutgoing(
audio,streamSid):string
Defined in: packages/agentos/src/io/channels/telephony/parsers/PlivoMediaStreamParser.ts:96
Carrier output declares codec and numeric rate; legacy output preserves its old shape.
Parameters
audio
Buffer
streamSid
string
Returns
string
Implementation of
MediaStreamParser.formatOutgoing
parseIncoming()
parseIncoming(
data):MediaStreamIncoming|null
Defined in: packages/agentos/src/io/channels/telephony/parsers/PlivoMediaStreamParser.ts:38
Parse a raw WebSocket frame from a Plivo audio stream.
The carrier profile (parseCarrierMedia) reads start with the nested
start.callId, start.streamId and start.mediaFormat, which must declare
PCMU at 8 kHz (one channel when the count is omitted); media with its
base64 media.payload, inbound track only; dtmf, playedStream (reported
as a mark) and stop. An unsupported start format, an error event or
an oversized frame throws.
The legacy profile keeps the released snake-case mapping: stream_id to
streamSid and call_uuid to callSid, with start, media and stop
alone.
Parameters
data
Raw WebSocket frame payload (JSON string or Buffer from Plivo).
string | Buffer
Returns
MediaStreamIncoming | null
Normalised MediaStreamIncoming event, or null for
unknown event types or malformed messages.