Member Junction
    Preparing search index...

    The bidirectional WebSocket media pump for a single call's media leg, modeling Vonage's binary-audio / text-event split. Production wires this over the accepted websocket for the call UUID (binary frames = L16 PCM audio, text frames = JSON control events); tests inject a fake. Audio is raw PCM ArrayBuffers — no envelope, no transcode — so RealVonageBindings just forwards bytes.

    interface IVonageMediaPump {
        AbandonOutboundCall?(correlationId: string): void;
        BindOutboundCall?(correlationId: string, callUuid: string): void;
        Clear(callUuid: string): void;
        ExpectOutboundCall?(correlationId: string, token: string): void;
        OnAudio(callUuid: string, handler: (pcm: ArrayBuffer) => void): void;
        OnEvent(
            callUuid: string,
            handler: (event: VonageControlEvent) => void,
        ): void;
        SendAudio(callUuid: string, pcm: ArrayBuffer): void;
    }

    Implemented by

    Index

    Methods

    • Optional. Maps the correlation id to the real call UUID once createCall has resolved.

      Parameters

      • correlationId: string
      • callUuid: string

      Returns void

    • Optional. Registers the media token for an OUTBOUND call before createCall is issued, keyed by a correlation id (the call UUID is not known until Vonage responds, yet the media socket may connect first). A pump that does not authenticate sockets may omit the three outbound-correlation hooks.

      Parameters

      • correlationId: string
      • token: string

      Returns void

    • Registers the inbound PCM16 audio handler for the call's binary media frames.

      Parameters

      • callUuid: string
      • handler: (pcm: ArrayBuffer) => void

      Returns void

    • Sends one outbound PCM16 audio frame as a BINARY websocket message (raw L16 PCM, no envelope).

      Parameters

      • callUuid: string
      • pcm: ArrayBuffer

      Returns void