Member Junction
    Preparing search index...

    Class BaseTelephonyBridgeAbstract

    Abstract base class for a telephony Realtime Bridge driver. Extends BaseRealtimeBridge with phone-call semantics — outbound dial / inbound answer, single-party audio, DTMF, and call transfer — over an injectable ITelephonyCallSdk seam.

    A concrete telephony driver (TwilioBridge, VonageBridge, RingCentralBridge) is minimal: it binds a concrete ITelephonyCallSdk via SetSdkFactory and supplies any provider-specific config interpretation. Everything else — connect/disconnect lifecycle, the media seam wiring, the single-party roster, DTMF, transfer, and the capability gating — is inherited from here.

    The shipped RealtimeBridgeContext is a meeting-shaped contract with no Direction field, so the engine forwards the session's Direction into RealtimeBridgeContext.Configuration under DIRECTION_CONFIG_KEY. Connect branches on it: 'Outbound'ITelephonyCallSdk.dial (gated by the OutboundDial feature), 'Inbound'ITelephonyCallSdk.answer (gated by InboundRouting). Both require AudioIn + AudioOut.

    A phone call carries audio only. SendMedia sends audio-out to the SDK and silently no-ops video/screen tracks (a telephony provider's SupportedFeatures does not enable them). There is no facilitator surface — no roster, no hand-raise, no who's-speaking — so GetMeetingControlsEventSource returns null. The single remote caller is surfaced through GetParticipants (caller + agent), which is all the "roster" a 1:1 call has.

    Registered like any bridge via @RegisterClass(BaseRealtimeBridge, '<X>Bridge') on the concrete subclass — the base itself is abstract and unregistered.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    callId: string = null

    The platform-native call identifier for the live call (set at Connect).

    carrierSampleRate: number = TELEPHONY_SAMPLE_RATE

    The carrier's PCM16 media rate (Hz) — what the SDK seam sends/receives audio at, between which and the model rate the bridge resamples. Defaults to TELEPHONY_SAMPLE_RATE (8 kHz); a wideband SIP/RTP driver overrides it per-call via CARRIER_SAMPLE_RATE_CONFIG_KEY.

    direction: BridgeConnectDirection = 'Outbound'

    The direction this call was established with.

    The capability flags for the provider this bridge instance serves. Populated from the RealtimeBridgeContext at BaseRealtimeBridge.Connect time (and may be set by the engine immediately after construction). Drives BaseRealtimeBridge.RequireFeature.

    fromNumber: string = ''

    The agent's own number this call originates from / is answered on.

    modelInputRate: number = 24000

    The realtime model's INPUT rate (Hz) — inbound 8 kHz caller audio is resampled UP to this.

    modelOutputRate: number = 24000

    The realtime model's OUTPUT rate (Hz) — outbound model audio is resampled DOWN to the carrier rate from this.

    providerName: string = ''

    The provider's display name for this bridge instance, used in capability-error messages. Populated from the RealtimeBridgeContext; falls back to the driver class name.

    remoteNumber: string = ''

    The remote party's number (outbound: the dialled number; inbound: best-effort caller-id).

    sdk: ITelephonyCallSdk = null

    The live telephony SDK seam for this call, created at Connect.

    sdkFactory: TelephonyCallSdkFactory = ...

    The SDK creation seam. Defaults to a factory that throws an explicit "bind the real telephony client" error, since the base ships WITHOUT a concrete provider adapter. A concrete driver (or a deployment) binds a real factory via SetSdkFactory; tests inject a fake.

    AGENT_PARTICIPANT_ID: "agent" = 'agent'

    The synthetic external id used for the agent's own leg on the roster. Subclasses may override.

    REMOTE_PARTICIPANT_ID: "caller" = 'caller'

    The synthetic external id used for the single remote caller on the roster. Stable for the life of the call so AIAgentSessionBridgeParticipant upserts are idempotent. Subclasses may override.

    Accessors

    Methods

    • Registers a callback the bridge invokes when the underlying call ends (remote hangup / carrier drop). The engine uses this to transition the bridge row to a terminal state. "Latest handler wins."

      Parameters

      • handler: () => void

        Invoked when the call has ended.

      Returns void

    • Sends DTMF tones on the call (gated by DTMF). Re-asserts the flag (defense-in-depth) so even an engine-bypassing caller cannot send tones a disabled provider forbids.

      Parameters

      • digits: string

        The DTMF digit string to send (e.g. '1234#').

      Returns Promise<void>

      when DTMF is not enabled for the provider.