Class TelnyxMediaStreamParser<P>

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 extends "legacy" | "carrier" = "legacy"

Implements

Constructors

Methods

  • 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: string | Buffer<ArrayBufferLike>

      Raw WebSocket frame payload (JSON string or Buffer from Telnyx).

    Returns null | MediaStreamIncoming

    Normalised MediaStreamIncoming event, or null for outbound audio tracks, unknown event types, or malformed messages.

Properties

protocol: P

Selected once; omission preserves the old binary-output protocol.