<Enqueue>

The <Enqueue> verb places a call in a specified call queue. If the specified queue does not exist, a new queue will be created and the call will be placed into that new queue. Calls can be dequeued through the <Dial> verb or removed from the queue through the <Leave> verb.

Verb Attributes

Attribute
action optionalThe action attribute takes an absolute URL. When a call leaves the queue, a request to this URL is made. If a call is dequeued through the <Leave> verb, the URL is immediately requested. If the call has been bridged to another party via the <Dial> verb, then the HTTP request is made only after both parties have disconnected. If action is not provided, SignalWire will continue reading the next verb in the document. See below for specified request parameters.
method optionalSpecifies whether the redirect is a GET or a POST. Default value is POST.
waitUrl optionalURL of the document to execute while the caller is in the queue. Default points to a playlist with classical music. waitUrl supports the following verbs: <Play>, <Say>, <Pause>, <Hangup>, <Redirect>, <Leave>, and <Gather>. See below for specified request parameters.
waitUrlMethod optionalSpecifies whether the request to waitUrl is a GET or a POST. The default value is POST.

Request parameters for the action URL

The action request contains the Standard Request Parameters as well as:

Parameter
QueueResult stringThe result of the queued call. See below for all possible values.
QueueSid stringThe unique ID of the queue. Only available if a call is successfully placed into a queue.
QueueTime stringThe time a call was waiting in a queue. Only available if a call is successfully placed into a queue.

Values for parameter QueueResult

The parameter QueueResult has the following values:

Value
bridgedThe call was bridged and removed from the queue.
bridging-in-progressSignalWire is instructed to bridge the call.
errorAn error occurred either through the <Enqueue> verb or through the document retrieved from the waitUrl.
hangupThe caller hung up while still in the queue.
leaveThe caller left the queue through the <Leave> verb.
redirectedThe call was redirected out of the queue, through a REST API request, while the caller was in the queue.
redirected-from-bridgedThe queued and bridged session was transferred out.
queue-fullThe queue was full, so the placement into the queue was not accepted.
system-errorSignalWire had a malfunction while placing a call into a queue.

Request parameters for waitUrl

The waitUrl request contains the Standard Request Parameters as well as:

Parameter
QueuePosition integerThe current position in the queue.
QueueSid stringThe unique ID of the queue a caller is in.
QueueTime integerThe time a call was waiting in a queue.
AvgQueueTime integerThe average time, in seconds, that callers have been waiting in a queue.
CurrentQueueSize integerThe current number of callers in a queue.

Nouns

The noun of a TwiML verb is nested within the verb upon which the verb acts. <Enqueue> has the following nouns:

Noun
plain textThe name of a specific queue.

Nesting

No other verbs can be nested within <Enqueue> and you cannot nest
<Enqueue> within any other verbs.

Examples

A Simple Enqueue

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Enqueue waitUrl="https://example.com/hold-music.xml">support</Enqueue>
</Response>
const { RestClient } = require('@signalwire/node')
const response = new RestClient.LaML.VoiceResponse()

response.enqueue({ waitUrl: 'https://example.com/hold-music.xml' }, 'support')
console.log(response.toString())
<?php
  use SignalWire\LaML;
  $response = new LaML;

  $response->enqueue('support', array( 'waitUrl' => 'https://example.com/hold-music.xml' ));
  echo $response;
?>
using Twilio.TwiML;
using System;


class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        response.Enqueue("support", waitUrl: new Uri("https://example.com/hold-music.xml"));

        Console.WriteLine(response.ToString());;
    }
}
from signalwire.voice_response import VoiceResponse, Enqueue

response = VoiceResponse()
response.enqueue('support', wait_url='https://example.com/hold-music.xml')

print(response)
require 'signalwire/sdk'

response = Signalwire::Sdk::VoiceResponse.new do |response|
  response.enqueue(name: 'support', wait_url: 'https://example.com/hold-music.xml')
end

puts response.to_s

While a caller is in the queue, SignalWire retrieves the TwiML document 'hold-music.xml' and executes it.

Playing Wait Music

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Play>http://your-application.com/classical.mp3</Play>
</Response>
const { RestClient } = require('@signalwire/node')
const response = new RestClient.LaML.VoiceResponse()

response.play('http://your-application.com/classical.mp3')
console.log(response.toString())
<?php
  use SignalWire\LaML;
  $response = new LaML;

  $response->play('http://your-application.com/classical.mp3');
  echo $response;
?>
using Twilio.TwiML;
using System;


class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        response.Play(new Uri("http://your-application.com/classical.mp3"));

        Console.WriteLine(response.ToString());;
    }
}
from signalwire.voice_response import VoiceResponse, Play

response = VoiceResponse()
response.play('http://your-application.com/classical.mp3')

print(response)
require 'signalwire/sdk'

response = Signalwire::Sdk::VoiceResponse.new do |response|
  response.play(url: 'http://your-application.com/classical.mp3')
end

puts response.to_s

While callers in a queue are waiting, classical music is played.