Interface TelephonyStreamTransportConfig

Optional construction-time configuration for TelephonyStreamTransport.

interface TelephonyStreamTransportConfig {
    outputSampleRate?: number;
    protocol?: "legacy" | "carrier";
    authorizeStart?: ((start) => boolean);
    playbackTimeoutMs?: number;
}

Properties

outputSampleRate?: number

Sample rate the pipeline expects for inbound AudioFrame events. Incoming 8 kHz telephony audio is upsampled to this rate. Carrier mode accepts 8000 or 16000.

Default Value

16000
protocol?: "legacy" | "carrier"

Omission retains the original transport; carrier mode requires a carrier parser.

authorizeStart?: ((start) => boolean)

Validates the call and custom parameters against the already verified upgrade. Must be synchronous.

Type declaration

    • (start): boolean
    • Parameters

      • start: {
            type: "start";
            streamSid: string;
            callSid: string;
            metadata?: Record<string, unknown>;
        }
        • type: "start"

          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.

        • streamSid: string

          Provider-assigned stream identifier.

        • callSid: string

          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.

      Returns boolean

playbackTimeoutMs?: number

Deadline for each write and each playback checkpoint; default 10000 ms, maximum 30000 ms. A chunk with a generation has it for its writes and its checkpoint together; a chunk without one, written in order, has it for its checkpoint from when it is the oldest written chunk awaiting one.