Skip to contentSkip to navigationSkip to topbar
Rate this page:
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 Call

hangup-a-call page anchor
Node.js
Python
C#
Java
PHP
Ruby

_10
const VoiceResponse = require('twilio').twiml.VoiceResponse;
_10
_10
_10
const response = new VoiceResponse();
_10
response.hangup();
_10
_10
console.log(response.toString());

Output

_10
<?xml version="1.0" encoding="UTF-8"?>
_10
<Response>
_10
<Hangup/>
_10
</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.

Rate this page: