*** id: 810d5ec2-d0ca-48d5-add8-8a31f693e257 title: Enqueue sidebar-title: Enqueue slug: /cxml/reference/voice/enqueue position: 1 max-toc-depth: 3 ---------------- The `` 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 `` verb or removed from the queue through the `` verb. ## Verb attributes The `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 `` verb, the URL is immediately requested. If the call has been bridged to another party via the `` 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](#enqueue_action) for specified request parameters. Specifies whether the redirect is a `GET` or a `POST`. URL 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: ``, ``, ``, ``, ``, ``, and ``. See [below](#enqueue_waitUrl) for specified request parameters. Specifies whether the request to `waitUrl` is a `GET` or a `POST`. #### Request parameters for the `action` URL \[#enqueue\_action] The `action` request contains the [Standard Request Parameters](/docs/compatibility-api/cxml/reference/voice#request-parameters) as well as: The result of the queued call. See [below](#action_queueResult) for all possible values. The unique ID of the queue. Only available if a call is successfully placed into a queue. The time a call was waiting in a queue. Only available if a call is successfully placed into a queue. #### Values for parameter `QueueResult` \[#action\_queueResult] The parameter `QueueResult` has the following values: | Value | Description | | :------------------------ | :---------------------------------------------------------------------------------------------------------- | | `bridged` | The call was bridged and removed from the queue. | | `bridging-in-progress` | SignalWire is instructed to bridge the call. | | `error` | An error occurred either through the `` verb or through the document retrieved from the `waitUrl`. | | `hangup` | The caller hung up while still in the queue. | | `leave` | The caller left the queue through the `` verb. | | `redirected` | The call was redirected out of the queue, through a REST API request, while the caller was in the queue. | | `redirected-from-bridged` | The queued and bridged session was transferred out. | | `queue-full` | The queue was full, so the placement into the queue was not accepted. | | `system-error` | SignalWire had a malfunction while placing a call into a queue. | #### Request parameters for `waitUrl` \[#enqueue\_waitUrl] The `waitUrl` request contains the [Standard Request Parameters](/docs/compatibility-api/cxml/reference/voice#request-parameters) as well as: The average time, in seconds, that callers have been waiting in a queue. The current number of callers in a queue. The current position in the queue. The unique ID of the queue a caller is in. The time a call was waiting in a queue. ## Nouns The noun of an XML verb is nested within the verb upon which the verb acts. `` has the following nouns: | Noun | Description | | :----------- | :---------------------------- | | `plain text` | The name of a specific queue. | ## Nesting No other verbs can be nested within `` and you cannot nest
`` within any other verbs. ## Examples ### A simple enqueue ```xml support ``` ```javascript title="Node.js" const { RestClient } = require("@signalwire/compatibility-api"); const response = new RestClient.LaML.VoiceResponse(); response.enqueue({ waitUrl: "https://example.com/hold-music.xml" }, "support"); console.log(response.toString()); ``` ```csharp 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());; } } ``` ```python from signalwire.voice_response import VoiceResponse, Enqueue response = VoiceResponse() response.enqueue('support', wait_url='https://example.com/hold-music.xml') print(response) ``` ```ruby 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 XML document 'hold-music.xml' and executes it. ### Playing wait music ```xml http://your-application.com/classical.mp3 ``` ```javascript title="Node.js" const { RestClient } = require("@signalwire/compatibility-api"); const response = new RestClient.LaML.VoiceResponse(); response.play("http://your-application.com/classical.mp3"); console.log(response.toString()); ``` ```csharp 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());; } } ``` ```python from signalwire.voice_response import VoiceResponse, Play response = VoiceResponse() response.play('http://your-application.com/classical.mp3') print(response) ``` ```ruby 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.