Class TwilioVoiceProvider

Twilio voice call provider.

Uses the Twilio REST API 2010-04-01 for outbound call control and HMAC-SHA1 for inbound webhook signature verification.

Example

const provider = new TwilioVoiceProvider({
accountSid: process.env.TWILIO_ACCOUNT_SID!,
authToken: process.env.TWILIO_AUTH_TOKEN!,
});

Implements

Constructors

Methods

  • Initiate an outbound call via the Twilio Calls API.

    Posts to /Accounts/{accountSid}/Calls.json with a form-encoded body (not JSON -- this is Twilio's 2010-era API convention). All four status callback events (initiated, ringing, answered, completed) are requested so the CallManager receives the full state progression.

    Parameters

    Returns Promise<InitiateCallResult>

    Result containing the Twilio CallSid on success.

    Throws

    Never throws; returns { success: false, error: '...' } on failure.

  • Inject TTS into a live call using a TwiML <Say> verb.

    Sends a Twiml form parameter containing a minimal <Response><Say> document. Twilio will parse the TwiML, synthesise the speech, and play it to the caller in real-time.

    The optional voice attribute maps to Twilio's built-in voice names (e.g., alice, Polly.Joanna).

    Parameters

    Returns Promise<void>

Properties

name: "twilio" = ...

Provider identifier, always 'twilio'.