<Number> noun specifies a phone number to dial.
Using the noun's attributes you can specify particular behaviors that Twilio
should apply when dialing the number.
You can use up to ten
<Number> nouns within a
<Dial> verb to simultaneously
call all of them at once. The first call to pick up is connected to the
current call and the rest are hung up. For each
<Number> noun you can specify
what call progress events you want to receive webhooks for.
<Number> noun supports the following attributes that modify its behavior:
|Attribute Name||Allowed Values||Default Value|
Phone numbers should be formatted with a '+' and country code e.g.,
+16175551212 (E.164 format). Twilio will also accept unformatted US
numbers e.g., (415) 555-1212 or 415-555-1212.
The 'sendDigits' attribute tells Twilio to play DTMF tones when the call is answered. This is useful when dialing a phone number and an extension. Twilio will dial the number, and when the automated system picks up, send the DTMF tones to connect to the extension.
The 'url' attribute allows you to specify a url for a TwiML document that will
run on the called party's end, after she answers, but before the parties are
connected. You can use this TwiML to privately play or say information to the
called party, or provide a chance to decline the phone call using
<Hangup>. The current caller will continue to hear ringing while the
TwiML document executes on the other end. TwiML documents executed in this
manner are not allowed to contain the
The 'method' attribute allows you to specify which HTTP method Twilio should
use when requesting the URL in the 'url' attribute. The default is
When dialing out to a number using
<Dial>, an outbound call is initiated. The
call transitions from the
initiated state to the
ringing state when the
phone starts ringing. It transitions to the
answered state when the call is
picked up, and finally to the
completed state when the call is over. With
statusCallbackEvent, you can subscribe to receive webhooks for the different
call progress events:
completed for a
given call. Non-relative URLs must contain a valid hostname (underscores are not permitted).
statusCallbackEvent attribute allows you to specify which events Twilio
should webhook on. To specify multiple events separate them with a space:
initiated ringing answered completed. If a
statusCallback is provided and no
status callback events are specified the
completed event will be sent by default.
As opposed to creating an outbound call via the API, outbound calls created
<Dial> are initiated right away and never queued. The following shows a
timeline of possible call events that can be returned and the different call
statuses that a
<Dial> leg may experience:
statusCallback attribute allows you to specify a URL for Twilio to send
webhook requests to on each event specified in the
statusCallbackMethod attribute allows you to specify which HTTP method
Twilio should use when requesting the URL in the
The default is
The parameters Twilio passes to your application in its asynchronous request to
StatusCallback URL include all parameters passed in a synchronous request
to retrieve TwiML when Twilio receives a call to one of your Twilio numbers.
The full list of parameters and descriptions of each are in the TwiML Voice
When the call progress events are fired, the Status Callback request also passes these additional parameters:
|CallSid||A unique identifier for this call, generated by Twilio. You can use the
|ParentCallSid||A unique identifier for the parent call.|
|CallStatus||A descriptive status for the call. The value is one of
|CallDuration||The duration in seconds of the just-completed call. Only present in the
|RecordingUrl||The URL of the phone call's recorded audio. This parameter is included only if
|RecordingSid||The unique ID of the Recording from this call.
|RecordingDuration||The duration of the recorded audio (in seconds).
|Timestamp||The timestamp when the event was fired, given as UTC in RFC 2822 format.|
|CallbackSource||A string that describes the source of the webhook. This is provided to help disambiguate why the webhook was made. On Status Callbacks, this value is always
|SequenceNumber||The order in which the events were fired, starting from
In this case, we want to dial the 1928 extension at 415-123-4567. We use
<Number> noun to describe the phone number and give it the attribute
sendDigits. We want to wait before sending the extension, so we add a few
leading 'w' characters. Each 'w' character tells Twilio to wait 0.5 seconds
instead of playing a digit. This lets you adjust the timing of when the digits
begin playing to suit the phone system you are dialing.
<?xml version="1.0" encoding="UTF-8"?> <Response> <Dial> <Number sendDigits="wwww1928"> 415-123-4567 </Number> </Dial> </Response>
In this case we use several
<Number> tags to dial three phone numbers at the same time.
The first of these calls to answer will be connected to the current caller, while the rest of the
connection attempts are canceled.
<?xml version="1.0" encoding="UTF-8"?> <Response> <Dial> <Number> 858-987-6543 </Number> <Number> 415-123-4567 </Number> <Number> 619-765-4321 </Number> </Dial> </Response>
In this case we want to receive a webhook for each call progress event when
dialing a number using
<?xml version="1.0" encoding="UTF-8"?> <Response> <Dial> <Number statusCallbackEvent="initiated ringing answered completed" statusCallback="https://myapp.com/calls/events" statusCallbackMethod="POST"> +14158675309 </Number> </Dial> </Response>
In this case we want to receive a webhook for each call progress event for each
number when dialing multiple numbers using
<?xml version="1.0" encoding="UTF-8"?> <Response> <Dial> <Number statusCallbackEvent='initiated ringing answered completed' statusCallback='https://myapp.com/calls/events' statusCallbackMethod='POST'> +14155555555 </Number> <Number statusCallbackEvent='initiated ringing answered completed' statusCallback='https://example.com/events' statusCallbackMethod='POST'> +14153333333 </Number> </Dial> </Response>
<Dial>verb to dial simultaneously
Simultaneous dialing is useful when you have several phones (or several people) that you want to ring when you receive an incoming call. Keep in mind that the first call that connects will cancel all the other attempts. If you dial an office phone system or a cellphone in airplane mode, it may pick up after a single ring, preventing the other phone numbers from ringing long enough for a human to ever answer.
Hence you should take care to use simultaneous dialing in situations where you know the behavior of the called parties.