Member Junction
    Preparing search index...

    Production ITwilioClientBindings over the real Twilio REST API + Media Streams, expressed against the injected ITwilioRestLike / ITwilioMediaPump surfaces so it builds and unit-tests with no twilio install and no network.

    • createCall → REST calls.create with the <Connect><Stream> TwiML.
    • acceptInbound → no REST call (the inbound webhook already returned the connect TwiML); the websocket for the delivered Call SID is what "accepting" means — handled by onStreamAudio.
    • completeCall / redirectCall / playDigits → REST calls(sid).update.
    • pushStreamAudio / onStreamAudio → Media-Streams frames, transcoded through the T0 codec.

    Implements

    Index

    Constructors

    Methods

    • Places an outbound call via the Twilio REST API (calls.create) with TwiML that opens a bidirectional Media-Streams <Connect><Stream> to the agent's websocket.

      Parameters

      • toNumber: string

        Destination number (E.164).

      • fromNumber: string

        The agent's Twilio number / verified caller-id the call originates from.

      • Optionalargs: Record<string, unknown>

        Provider-specific options (status-callback URL, stream URL, recording flags, …).

      Returns Promise<string>

      The created Call SID.

    • Registers the inbound DTMF callback (<Gather> webhook results or Media-Streams dtmf events).

      Parameters

      • callSid: string

        The Call SID.

      • cb: (digits: string) => void

        Invoked with each received DTMF digit string.

      Returns void

    • Registers the inbound Media-Streams audio callback for the call (what the agent hears).

      Parameters

      • callSid: string

        The Call SID whose inbound stream to subscribe to.

      • cb: (pcm: ArrayBuffer) => void

        Invoked with each inbound PCM audio frame.

      Returns void

    • Pushes one outbound audio payload onto the call's Media-Streams websocket (the agent's voice).

      Parameters

      • callSid: string

        The Call SID whose stream to write to.

      • pcm: ArrayBuffer

        The audio bytes (the adapter encodes to the Media-Streams μ-law/PCM media frame).

      Returns void