@langwatch/scenario
    Preparing search index...

    Interface TwilioAgentAdapterOptions

    interface TwilioAgentAdapterOptions {
        accountSid: string;
        allowedCallees?: readonly string[];
        allowedCallers?: readonly string[];
        authToken: string;
        fetchImpl?: (
            input: string | URL | Request,
            init?: RequestInit,
        ) => Promise<Response>;
        httpPort?: number;
        onDtmf?: (digit: string) => void;
        phoneNumber: string;
        publicBaseUrl?: string;
        rest?: TwilioRESTHelper;
        role?: AgentRole;
        speechGate?: false | TwilioSpeechGateOptions;
        tunnelReadiness?: TunnelReadiness;
        validateSignature?: boolean;
    }
    Index
    accountSid: string
    allowedCallees?: readonly string[]

    Destination allowlist for a-leg outbound calls (#762 guardrail (c)). Unset denies EVERY a-leg destination: a-leg dials numbers this account does not own, so an unguarded to is an unbounded dialer and the capability has to be opted into per destination. Entries are validated at construction, so a typo fails at setup instead of when a PSTN call is about to be billed. b-leg is deliberately not gated on this — it can only reach numbers on this account, which is its own guardrail.

    allowedCallers?: readonly string[]

    Allowed-callers filter for inbound calls. Unset = any caller accepted.

    authToken: string
    fetchImpl?: (
        input: string | URL | Request,
        init?: RequestInit,
    ) => Promise<Response>

    Optional fetch override for the REST client. Tests pass an in-memory mock so unit tests can verify REST traffic without real Twilio.

    httpPort?: number

    HTTP server port. 0 = OS-assigned (recommended for tests).

    onDtmf?: (digit: string) => void

    Callback invoked when the remote side sends DTMF mid-call.

    phoneNumber: string

    Twilio-owned phone number in E.164 format (e.g. "+14155551234").

    publicBaseUrl?: string

    HTTPS URL routing to this machine. Required at connect() time.

    rest?: TwilioRESTHelper

    Optional REST helper override. When provided, replaces the default TwilioRESTHelper constructed from accountSid/authToken. Lets tests inject a fully-stubbed REST surface.

    role?: AgentRole

    Role under test — AGENT (default) or USER.

    speechGate?: false | TwilioSpeechGateOptions

    Energy gate on INBOUND call audio (see ./twilio-speech-gate.ts). On by default with the measured phone-line thresholds: Twilio streams a media frame every 20 ms for the life of the call, silence included, so without the gate the drain's tail-silence turn end (responseTailSilence) can never fire and the callee's turn only ends on hangup or the hard ceiling. Pass an object to tune the thresholds, or false to admit every frame (the pre-gate behaviour — only sensible for a transport that already stops sending during silence).

    tunnelReadiness?: TunnelReadiness

    Edge-readiness probe consulted before a-leg origination (#762 guardrail (c)). Unset means the caller owns a stable public URL and has nothing to wait for.

    validateSignature?: boolean

    Reject inbound webhooks without a valid X-Twilio-Signature. Tests pass false to bypass; production callers must leave on.