<Number>
is a noun for the TwiML verb <Dial>
and it 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.
The <Number>
noun supports the following attributes that modify its behavior:
Attribute Name | Allowed Values | Default Value |
---|---|---|
sendDigits | Any digits | None |
url | Relative or absolute URL | None |
method | GET , POST | POST |
byoc | BYOC Trunk SID | None |
statusCallbackEvent | initiated , ringing , answered , completed | completed |
statusCallback | Any URL | None |
statusCallbackMethod | GET , POST | POST |
machineDetection | Enable , DetectMessageEnd | None |
machineDetectionTimeout | 3 -60 | 30 |
machineDetectionSpeechThreshold | 1000 -6000 | 2400 |
machineDetectionSpeechEndThreshold | 500 -5000 | 1200 |
machineDetectionSilenceTimeout | 2000 -10000 | 5000 |
amdStatusCallback | Any URL | None |
amdStatusCallbackMethod | GET , POST | POST |
Phone numbers should be formatted with a +
and country code, for example: +16175551212
([E.164][1] 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 that will return a TwiML response to be run on the called party's end, after they answer, but before the parties are connected.
You can use this TwiML to privately <Play>
or <Say>
information to the called party. You could also provide a chance to decline the phone call using <Gather>
and <Hangup>
. The url
attribute does not support any other TwiML verbs.
If the [answerOnBridge][dial-answer-on-bridge] attribute is used on <Dial>
, 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 <Dial>
verb.
The method
attribute allows you to specify which HTTP method Twilio should use when requesting the URL in the url
attribute. The default is POST
.
The byoc
attribute allows you to specify which configured customer [BYOC Trunk][bring-your-own-carrier] Twilio should use to route the call to the PSTN. The default is none, in which case the call will be routed via the Twilio Super Network.
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 for a given call: initiated
, ringing
, answered
, or completed
. Non-relative URLs must contain a valid hostname (underscores are not permitted).
The statusCallbackEvent
attribute allows you to specify which events Twilio should trigger a 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 using <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:
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.
In this case, we want to receive a webhook for each call progress event when dialing a number using <Dial>
.
In this case, we want to receive a webhook for each call progress event for each number when dialing multiple numbers using <Dial>
.
In this case, we want to connect two parties using <Dial>
, but we also want TwiML instructions to be sent to the party we are calling before they are connected to the call. By setting the url
attribute, we can specify a URL that will return a TwiML response to be run on the called party's end. This TwiML will run after they answer, but before the parties are connected.
<Dial>
verb to dial simultaneously.