When to use
Use this to originate outbound phone calls programmatically: notifications, reminders,
click-to-call, IVR outreach, and voice OTP delivery. You control what the callee hears via
TwiML (fetched from a URL or passed inline), detect humans vs answering machines, receive
lifecycle status callbacks, optionally record, and tune ring timeout and DTMF injection.
Not for: authoring the TwiML that runs once the call connects (see twilio-voice-twiml);
recording retrieval/storage/transcription detail (see twilio-call-recordings); inbound call
handling (configure the number's Voice webhook instead); SMS/RCS (see twilio-rcs-messaging).
Method
- Choose a call-control source. Decision point: dynamic per-call logic → set
Url to a
TwiML endpoint (Twilio GETs/POSTs it on answer); fixed static markup → pass Twiml
inline; reusable app config → pass ApplicationSid.
- Set
To (E.164) and From (a Twilio number or verified caller ID on the account).
- Decision point: is the callee likely a machine? Enable
MachineDetection=Enable (fast,
returns a hint) or DetectMessageEnd (waits for the greeting to finish before your TwiML
runs — best for leaving voicemail). AMD result arrives as AnsweredBy on the answer
callback (human, machine_start, machine_end_beep, fax, unknown).
- Set
Timeout (ring seconds, default 60) to cap how long Twilio waits for an answer.
- Wire
StatusCallback + StatusCallbackEvent to observe lifecycle:
initiated, ringing, answered, completed.
- Decision point: record the call? Set
Record=true (or use <Record>/dual-channel via
RecordingChannels); handle the RecordingStatusCallback — see twilio-call-recordings.
- Send digits into an IVR after connect with
SendDigits (e.g. "wwww1928#"; w = 0.5s).
- Create the call: POST to the Calls resource; capture the Call SID (
CA...).
- Mid-call, modify or hang up by POSTing to the Call instance (
Status=completed ends it;
Url redirects live TwiML execution).
Example
from twilio.rest import Client
client = Client(account_sid, auth_token)
call = client.calls.create(
to="+15551234567",
from_="+15557654321",
url="https://example.com/twiml/reminder", # TwiML served on answer
machine_detection="DetectMessageEnd", # wait for greeting to end
timeout=30,
record=True,
status_callback="https://example.com/voice/status",
status_callback_event=["initiated", "ringing", "answered", "completed"],
status_callback_method="POST",
)
print(call.sid, call.status) # CAxxxx, queued
Pitfalls
From must be a Twilio number or a verified outbound caller ID, else the call is rejected.
- AMD adds latency before your TwiML executes (Twilio listens to classify);
DetectMessageEnd
can add several seconds. Do not enable it for time-sensitive human interactions.
AnsweredBy can be unknown; design TwiML to be safe for both human and machine.
Timeout is ring time, not call duration; there is no built-in max-duration param — guard
long calls in your TwiML or with a status-callback teardown.
- Error 11200 means Twilio could not retrieve your TwiML URL (5xx/timeout/bad markup);
13223/13214 indicate malformed/invalid numbers; 31003 is a downstream connection timeout.
- Inline
Twiml and Url/ApplicationSid are mutually exclusive — pass exactly one source.
- StatusCallback fires per event only if listed in
StatusCallbackEvent; ringing and
initiated are not sent by default.
Output format
A Call resource with sid (CA...) and initial status (queued/initiated). Status
callbacks POST call progress (CallStatus, AnsweredBy, CallDuration, Timestamp) to
your URL through completion. Recordings, if enabled, arrive via RecordingStatusCallback.
Reference
- Create:
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Calls.json.
- Key params:
To, From, Url (TwiML URL) or Twiml (inline) or ApplicationSid,
StatusCallback, StatusCallbackEvent (initiated|ringing|answered|completed),
StatusCallbackMethod, Record, RecordingChannels (mono|dual),
RecordingStatusCallback, Timeout (default 60s), MachineDetection
(Enable|DetectMessageEnd), MachineDetectionTimeout, SendDigits.
- Modify/end:
POST .../Calls/{CallSid}.json with Status=completed or Url to redirect.
- Call status values:
queued, initiated, ringing, in-progress, completed, busy,
no-answer, canceled, failed.
AnsweredBy: human, machine_start, machine_end_beep, machine_end_silence,
machine_end_other, fax, unknown.
- Error codes: 13214 invalid Dial number, 11200 HTTP retrieval failure, 31003 connection
timeout, 13223 invalid phone number format.
- Pricing: per-minute outbound billed in 1-minute increments by destination; AMD carries a
small per-call add-on; recording and storage bill separately. Confirm rates in Console.
1---2name: twilio-voice-outbound-calls3version: 1.0.04description: Place outbound programmable voice calls with the Twilio Calls API, controlling TwiML, answering-machine detection, status callbacks, recording, and timeouts.5author: matrixx00706tags: [twilio, voice, calls, amd, callbacks]7capabilities: []8metadata:9 source: https://skillmd.com/skills/matrixx0070/twilio-voice-outbound-calls10---1112## When to use1314Use this to originate outbound phone calls programmatically: notifications, reminders,15click-to-call, IVR outreach, and voice OTP delivery. You control what the callee hears via16TwiML (fetched from a URL or passed inline), detect humans vs answering machines, receive17lifecycle status callbacks, optionally record, and tune ring timeout and DTMF injection.1819**Not for:** authoring the TwiML that runs once the call connects (see twilio-voice-twiml);20recording retrieval/storage/transcription detail (see twilio-call-recordings); inbound call21handling (configure the number's Voice webhook instead); SMS/RCS (see twilio-rcs-messaging).2223## Method24251. Choose a call-control source. Decision point: dynamic per-call logic → set `Url` to a26 TwiML endpoint (Twilio GETs/POSTs it on answer); fixed static markup → pass `Twiml`27 inline; reusable app config → pass `ApplicationSid`.282. Set `To` (E.164) and `From` (a Twilio number or verified caller ID on the account).293. Decision point: is the callee likely a machine? Enable `MachineDetection=Enable` (fast,30 returns a hint) or `DetectMessageEnd` (waits for the greeting to finish before your TwiML31 runs — best for leaving voicemail). AMD result arrives as `AnsweredBy` on the answer32 callback (`human`, `machine_start`, `machine_end_beep`, `fax`, `unknown`).334. Set `Timeout` (ring seconds, default 60) to cap how long Twilio waits for an answer.345. Wire `StatusCallback` + `StatusCallbackEvent` to observe lifecycle:35 `initiated`, `ringing`, `answered`, `completed`.366. Decision point: record the call? Set `Record=true` (or use `<Record>`/dual-channel via37 `RecordingChannels`); handle the RecordingStatusCallback — see twilio-call-recordings.387. Send digits into an IVR after connect with `SendDigits` (e.g. `"wwww1928#"`; `w` = 0.5s).398. Create the call: POST to the Calls resource; capture the Call SID (`CA...`).409. Mid-call, modify or hang up by POSTing to the Call instance (`Status=completed` ends it;41 `Url` redirects live TwiML execution).4243## Example4445```python46from twilio.rest import Client4748client = Client(account_sid, auth_token)4950call = client.calls.create(51 to="+15551234567",52 from_="+15557654321",53 url="https://example.com/twiml/reminder", # TwiML served on answer54 machine_detection="DetectMessageEnd", # wait for greeting to end55 timeout=30,56 record=True,57 status_callback="https://example.com/voice/status",58 status_callback_event=["initiated", "ringing", "answered", "completed"],59 status_callback_method="POST",60)61print(call.sid, call.status) # CAxxxx, queued62```6364## Pitfalls6566- `From` must be a Twilio number or a verified outbound caller ID, else the call is rejected.67- AMD adds latency before your TwiML executes (Twilio listens to classify); `DetectMessageEnd`68 can add several seconds. Do not enable it for time-sensitive human interactions.69- `AnsweredBy` can be `unknown`; design TwiML to be safe for both human and machine.70- `Timeout` is ring time, not call duration; there is no built-in max-duration param — guard71 long calls in your TwiML or with a status-callback teardown.72- Error 11200 means Twilio could not retrieve your TwiML URL (5xx/timeout/bad markup);73 13223/13214 indicate malformed/invalid numbers; 31003 is a downstream connection timeout.74- Inline `Twiml` and `Url`/`ApplicationSid` are mutually exclusive — pass exactly one source.75- StatusCallback fires per event only if listed in `StatusCallbackEvent`; `ringing` and76 `initiated` are not sent by default.7778## Output format7980A Call resource with `sid` (`CA...`) and initial `status` (`queued`/`initiated`). Status81callbacks POST call progress (`CallStatus`, `AnsweredBy`, `CallDuration`, `Timestamp`) to82your URL through completion. Recordings, if enabled, arrive via RecordingStatusCallback.8384## Reference8586- Create: `POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Calls.json`.87- Key params: `To`, `From`, `Url` (TwiML URL) or `Twiml` (inline) or `ApplicationSid`,88 `StatusCallback`, `StatusCallbackEvent` (`initiated`|`ringing`|`answered`|`completed`),89 `StatusCallbackMethod`, `Record`, `RecordingChannels` (`mono`|`dual`),90 `RecordingStatusCallback`, `Timeout` (default 60s), `MachineDetection`91 (`Enable`|`DetectMessageEnd`), `MachineDetectionTimeout`, `SendDigits`.92- Modify/end: `POST .../Calls/{CallSid}.json` with `Status=completed` or `Url` to redirect.93- Call status values: `queued`, `initiated`, `ringing`, `in-progress`, `completed`, `busy`,94 `no-answer`, `canceled`, `failed`.95- `AnsweredBy`: `human`, `machine_start`, `machine_end_beep`, `machine_end_silence`,96 `machine_end_other`, `fax`, `unknown`.97- Error codes: 13214 invalid Dial number, 11200 HTTP retrieval failure, 31003 connection98 timeout, 13223 invalid phone number format.99- Pricing: per-minute outbound billed in 1-minute increments by destination; AMD carries a100 small per-call add-on; recording and storage bill separately. Confirm rates in Console.