Skip to contentSkip to navigationSkip to topbar
On this page

TwiML™ Voice: <Hangup>


The <Hangup> verb ends a call. If used as the first verb in a TwiML response it does not prevent Twilio from answering the call and billing your account. The only way to not answer a call and prevent billing is to use the <Reject> verb.


Verb Attributes

attributes page anchor

The <Hangup> verb has no attributes.


You can't nest any verbs within <Hangup> and you can't nest <Hangup> within any other verbs.


Example 1

examples-1 page anchor

The following code tells Twilio to answer the call and hang up immediately.

Hangup a CallLink to code sample: Hangup a Call
1
const VoiceResponse = require('twilio').twiml.VoiceResponse;
2
3
4
const response = new VoiceResponse();
5
response.hangup();
6
7
console.log(response.toString());

Output

1
<?xml version="1.0" encoding="UTF-8"?>
2
<Response>
3
<Hangup/>
4
</Response>

Hints and Advanced Uses

hints page anchor
  • When receiving a Twilio request to an 'action' URL within <Gather>, <Record>, <Dial> or <Sms>, you can return a response containing the <Hangup> verb to end the current call.

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.