The <Dial> verb's <Queue> noun specifies a queue to dial. When dialing a queue, the caller will be connected with the first enqueued call in the specified queue. If the queue is empty, Dial will wait until the next person joins the queue or until the timeout duration is reached. If the queue does not exist, Dial will post an error status to its action URL.
The <Queue> noun supports the following attributes that modify its behavior:
| Attribute Name | Allowed Values | Default Value |
|---|---|---|
| url | relative or absolute URL | none |
| method | GET, POST | POST |
The 'url' attribute takes an absolute or relative URL as a value. The url points to a Twiml document that will be executed on the queued caller's end before the two parties are connected. This is typically used to be able to notify the queued caller that he or she is about to be connected to an agent or that the call may be recorded. The allowed verbs in this TwiML document are Play, Say, Pause and Redirect.
Twilio will pass the following parameters in addition to the standard TwiML Voice request parameters with its request to the value of the 'url' attribute:
| Parameter | Description |
|---|---|
| QueueSid | The SID of the queue. |
| CallSid | The CallSid of the dequeued call. |
| QueueTime | The time the call spent in the queue. |
| DequeingCallSid | The CallSid of the call dequeuing the caller. |
The 'method' attribute takes the value 'GET' or 'POST'. This tells Twilio whether to request the 'url' above via HTTP GET or POST. This attribute is modeled after the HTML form 'method' attribute. 'POST' is the default value.
In this example, the caller wants to dequeue a call from the 'support' queue. Before connecting, the following TwiML might be executed:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>
<Queue url="about_to_connect.xml">support</Queue>
</Dial>
</Response>
And the 'about_to_connect.xml" TwiML document which will be played to the caller waiting in the queue before connecting might look something like this:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>You will now be connected to an agent.</Say>
</Response>