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-calls3description: Place outbound programmable voice calls with the Twilio Calls API, controlling TwiML, answering-machine detection, status callbacks, recording, and timeouts.4---56## When to use78Use this to originate outbound phone calls programmatically: notifications, reminders,9click-to-call, IVR outreach, and voice OTP delivery. You control what the callee hears via10TwiML (fetched from a URL or passed inline), detect humans vs answering machines, receive11lifecycle status callbacks, optionally record, and tune ring timeout and DTMF injection.1213**Not for:** authoring the TwiML that runs once the call connects (see twilio-voice-twiml);14recording retrieval/storage/transcription detail (see twilio-call-recordings); inbound call15handling (configure the number's Voice webhook instead); SMS/RCS (see twilio-rcs-messaging).1617## Method18191. Choose a call-control source. Decision point: dynamic per-call logic → set `Url` to a20 TwiML endpoint (Twilio GETs/POSTs it on answer); fixed static markup → pass `Twiml`21 inline; reusable app config → pass `ApplicationSid`.222. Set `To` (E.164) and `From` (a Twilio number or verified caller ID on the account).233. Decision point: is the callee likely a machine? Enable `MachineDetection=Enable` (fast,24 returns a hint) or `DetectMessageEnd` (waits for the greeting to finish before your TwiML25 runs — best for leaving voicemail). AMD result arrives as `AnsweredBy` on the answer26 callback (`human`, `machine_start`, `machine_end_beep`, `fax`, `unknown`).274. Set `Timeout` (ring seconds, default 60) to cap how long Twilio waits for an answer.285. Wire `StatusCallback` + `StatusCallbackEvent` to observe lifecycle:29 `initiated`, `ringing`, `answered`, `completed`.306. Decision point: record the call? Set `Record=true` (or use `<Record>`/dual-channel via31 `RecordingChannels`); handle the RecordingStatusCallback — see twilio-call-recordings.327. Send digits into an IVR after connect with `SendDigits` (e.g. `"wwww1928#"`; `w` = 0.5s).338. Create the call: POST to the Calls resource; capture the Call SID (`CA...`).349. Mid-call, modify or hang up by POSTing to the Call instance (`Status=completed` ends it;35 `Url` redirects live TwiML execution).3637## Example3839```python40from twilio.rest import Client4142client = Client(account_sid, auth_token)4344call = client.calls.create(45 to="+15551234567",46 from_="+15557654321",47 url="https://example.com/twiml/reminder", # TwiML served on answer48 machine_detection="DetectMessageEnd", # wait for greeting to end49 timeout=30,50 record=True,51 status_callback="https://example.com/voice/status",52 status_callback_event=["initiated", "ringing", "answered", "completed"],53 status_callback_method="POST",54)55print(call.sid, call.status) # CAxxxx, queued56```5758## Pitfalls5960- `From` must be a Twilio number or a verified outbound caller ID, else the call is rejected.61- AMD adds latency before your TwiML executes (Twilio listens to classify); `DetectMessageEnd`62 can add several seconds. Do not enable it for time-sensitive human interactions.63- `AnsweredBy` can be `unknown`; design TwiML to be safe for both human and machine.64- `Timeout` is ring time, not call duration; there is no built-in max-duration param — guard65 long calls in your TwiML or with a status-callback teardown.66- Error 11200 means Twilio could not retrieve your TwiML URL (5xx/timeout/bad markup);67 13223/13214 indicate malformed/invalid numbers; 31003 is a downstream connection timeout.68- Inline `Twiml` and `Url`/`ApplicationSid` are mutually exclusive — pass exactly one source.69- StatusCallback fires per event only if listed in `StatusCallbackEvent`; `ringing` and70 `initiated` are not sent by default.7172## Output format7374A Call resource with `sid` (`CA...`) and initial `status` (`queued`/`initiated`). Status75callbacks POST call progress (`CallStatus`, `AnsweredBy`, `CallDuration`, `Timestamp`) to76your URL through completion. Recordings, if enabled, arrive via RecordingStatusCallback.7778## Reference7980- Create: `POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Calls.json`.81- Key params: `To`, `From`, `Url` (TwiML URL) or `Twiml` (inline) or `ApplicationSid`,82 `StatusCallback`, `StatusCallbackEvent` (`initiated`|`ringing`|`answered`|`completed`),83 `StatusCallbackMethod`, `Record`, `RecordingChannels` (`mono`|`dual`),84 `RecordingStatusCallback`, `Timeout` (default 60s), `MachineDetection`85 (`Enable`|`DetectMessageEnd`), `MachineDetectionTimeout`, `SendDigits`.86- Modify/end: `POST .../Calls/{CallSid}.json` with `Status=completed` or `Url` to redirect.87- Call status values: `queued`, `initiated`, `ringing`, `in-progress`, `completed`, `busy`,88 `no-answer`, `canceled`, `failed`.89- `AnsweredBy`: `human`, `machine_start`, `machine_end_beep`, `machine_end_silence`,90 `machine_end_other`, `fax`, `unknown`.91- Error codes: 13214 invalid Dial number, 11200 HTTP retrieval failure, 31003 connection92 timeout, 13223 invalid phone number format.93- Pricing: per-minute outbound billed in 1-minute increments by destination; AMD carries a94 small per-call add-on; recording and storage bill separately. Confirm rates in Console.