# TwiML™ Voice: \<Leave>

The `<Leave>` verb is used in conjunction with [\<Enqueue>](/docs/voice/twiml/enqueue) to manage control of a call that is in a queue.

When Twilio executes the `<Leave>` verb on a call, the call is removed from the queue and Twilio executes the next TwiML verb after the original [\<Enqueue>](/docs/voice/twiml/enqueue).

## Verb Attributes \[#attributes]

The `<Leave>` verb doesn't support any attributes.

### Example: Leaving a Queue \[#examples-1]

Consider the following scenario: There are several calls waiting in a call queue for a customer support agent. The customer support line closes at 9PM and the callers must be notified that they have been removed from the queue and will have to try again tomorrow.

The original call TwiML might look like this:

Enqueue call in a closed line

```js
const VoiceResponse = require('twilio').twiml.VoiceResponse;


const response = new VoiceResponse();
response.enqueue({
    waitUrl: 'wait.xml'
}, 'support');
response.say('Unfortunately, the support line has closed. Please call again tomorrow.');

console.log(response.toString());
```

```py
from twilio.twiml.voice_response import Enqueue, VoiceResponse, Say

response = VoiceResponse()
response.enqueue('support', wait_url='wait.xml')
response.say(
    'Unfortunately, the support line has closed. Please call again tomorrow.'
)

print(response)
```

```cs
using System;
using Twilio.TwiML;
using Twilio.TwiML.Voice;


class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        response.Enqueue("support", waitUrl: new Uri("wait.xml", UriKind
            .Relative));
        response
            .Say("Unfortunately, the support line has closed. Please call again tomorrow.");

        Console.WriteLine(response.ToString());
    }
}
```

```java
import com.twilio.twiml.voice.Enqueue;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.voice.Say;
import com.twilio.twiml.TwiMLException;


public class Example {
    public static void main(String[] args) {
        Enqueue enqueue = new Enqueue.Builder("support").waitUrl("wait.xml")
            .build();
        Say say = new Say
            .Builder("Unfortunately, the support line has closed. Please call again tomorrow.").build();
        VoiceResponse response = new VoiceResponse.Builder().enqueue(enqueue)
            .say(say).build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
```

```go
package main

import (
	"fmt"

	"github.com/twilio/twilio-go/twiml"
)

func main() {
	twiml, _ := twiml.Voice([]twiml.Element{
		&twiml.VoiceEnqueue{
			Name:    "support",
			WaitUrl: "wait.xml",
		},
		&twiml.VoiceSay{
			Message: "Unfortunately, the support line has closed. Please call again tomorrow.",
		},
	})

	fmt.Print(twiml)
}
```

```php
<?php
require_once './vendor/autoload.php';
use Twilio\TwiML\VoiceResponse;

$response = new VoiceResponse();
$response->enqueue('support', ['waitUrl' => 'wait.xml']);
$response->say('Unfortunately, the support line has closed. Please call again tomorrow.');

echo $response;
```

```rb
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response.enqueue(wait_url: 'wait.xml', name: 'support')
response
  .say(message: 'Unfortunately, the support line has closed. Please call again tomorrow.')

puts response
```

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Enqueue waitUrl="wait.xml">support</Enqueue>
    <Say>Unfortunately, the support line has closed. Please call again tomorrow.</Say>
</Response>
```

Configure wait.xml to play hold music before 9pm:

Play audio

```js
const VoiceResponse = require('twilio').twiml.VoiceResponse;


const response = new VoiceResponse();
response.play('http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3');

console.log(response.toString());
```

```py
from twilio.twiml.voice_response import Play, VoiceResponse

response = VoiceResponse()
response.play(
    'http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3'
)

print(response)
```

```cs
using System;
using Twilio.TwiML;
using Twilio.TwiML.Voice;


class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        response
            .Play(new Uri("http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3"));

        Console.WriteLine(response.ToString());
    }
}
```

```java
import com.twilio.twiml.voice.Play;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.TwiMLException;


public class Example {
    public static void main(String[] args) {
        Play play = new Play
            .Builder("http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3").build();
        VoiceResponse response = new VoiceResponse.Builder().play(play).build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
```

```go
package main

import (
	"fmt"

	"github.com/twilio/twilio-go/twiml"
)

func main() {
	twiml, _ := twiml.Voice([]twiml.Element{
		&twiml.VoicePlay{
			Url: "http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3",
		},
	})

	fmt.Print(twiml)
}
```

```php
<?php
require_once './vendor/autoload.php';
use Twilio\TwiML\VoiceResponse;

$response = new VoiceResponse();
$response->play('http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3');

echo $response;
```

```rb
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response
  .play(url: 'http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3')

puts response
```

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
     <Play>http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3</Play>
</Response>
```

After 9PM, wait.xml dequeues the call and returns call control to the `<Say>`
block in the original call TwiML:

Leave a call

```js
const VoiceResponse = require('twilio').twiml.VoiceResponse;


const response = new VoiceResponse();
response.leave();

console.log(response.toString());
```

```py
from twilio.twiml.voice_response import Leave, VoiceResponse

response = VoiceResponse()
response.leave()

print(response)
```

```cs
using System;
using Twilio.TwiML;
using Twilio.TwiML.Voice;


class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        response.Leave();

        Console.WriteLine(response.ToString());
    }
}
```

```java
import com.twilio.twiml.voice.Leave;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.TwiMLException;


public class Example {
    public static void main(String[] args) {
        Leave leave = new Leave.Builder().build();
        VoiceResponse response = new VoiceResponse.Builder().leave(leave)
            .build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
```

```go
package main

import (
	"fmt"

	"github.com/twilio/twilio-go/twiml"
)

func main() {
	twiml, _ := twiml.Voice([]twiml.Element{
		&twiml.VoiceLeave{},
	})

	fmt.Print(twiml)
}
```

```php
<?php
require_once './vendor/autoload.php';
use Twilio\TwiML\VoiceResponse;

$response = new VoiceResponse();
$response->leave();

echo $response;
```

```rb
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response.leave

puts response
```

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
     <Leave />
</Response>
```
