Skip to main content

Twilio Voice Call

Using the Twilio REST API, you can make outgoing calls to phones, SIP-enabled endpoints, and Twilio Voice SDK connections.

Configuration

Database Setup

Create a new entry in the notify_providers table with the following settings:
FieldValue
channel_type10 (Twilio Voice Call)
is_enabled1

Configuration Fields

TWILIO_VC_ACCOUNT_SID
string
required
Twilio account SID
TWILIO_VC_AUTH_TOKEN
string
required
Twilio account auth token
Example Configuration:
{
  "TWILIO_VC_ACCOUNT_SID": "twilio-account-sid",
  "TWILIO_VC_AUTH_TOKEN": "twilio-auth-token"
}

Request Format

Sample Request Body

{
  "providerId": 10,
  "data": {
    "from": "+15005550006",
    "to": "+91xxxxxxxxxx",
    "url": "http://your-server-url/calls/message"
  }
}

Using TwiML Directly

{
  "providerId": 10,
  "data": {
    "from": "+15005550006",
    "to": "+91xxxxxxxxxx",
    "twiml": "<Response><Say>Hello there!</Say></Response>"
  }
}

Request Fields

from
string
required
The phone number, SIP address, or client identifier to use as the caller ID
to
string
required
The phone number or client identifier to call
url
string
The absolute URL that returns the TwiML instructions for the call. Twilio will call this URL when the call connects.
twiml
string
TwiML instructions for the call. Max 4000 characters. Use this instead of url for simple voice messages.
If both url and twiml are provided, the twiml parameter will be ignored.

TwiML Examples

<Response>
  <Say voice="alice">Hello! This is an automated message from OsmoX.</Say>
</Response>

Dependencies

PackageVersionDescription
twilio^5.8.0Twilio client for voice and messaging

References