Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

TwiML™ Voice: <Reject>


The <Reject> verb rejects an incoming call to your Twilio number without billing you. This is very useful for blocking unwanted calls.

If the first verb in a TwiML document is <Reject>, Twilio will not pick up the call. The call ends with a status of busy or no-answer, depending on the verb's reason attribute. Any verbs after <Reject> are unreachable and ignored.

Using <Reject> as the first verb in your response is the only way to prevent Twilio from answering a call. Any other response will result in an answered call and your account will be billed.

(warning)

Warning

If you are using Twilio's deprecated v2008 API, <Reject> will result in a billing event, because the call's state will transition from inbound to completed to reject the call. Using <Reject> with the v2010 API, as described in this document, will not result in a billing event. Learn how to upgrade from Twilio's v2008 API to the v2010 API here.


Verb Attributes

attributes page anchor

The <Reject> verb supports the following attributes that modify its behavior:

Attribute NameAllowed ValuesDefault Value
reasonrejected, busyrejected

reason

attributes-reason page anchor

The reason attribute takes the values rejected and busy. This tells Twilio what message to play when rejecting a call. Selecting busy will play a busy signal to the caller, while selecting rejected will play a standard not-in-service response. The default is rejected.

(information)

Info

This is a preference and what is actually played back is determined by the caller's service provider as they dictate what they want to playback to the caller.


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


Example 1: Reject a call playing a standard not-in-service message

examples-1 page anchor

Reject a call playing a standard not-in-service message

reject-a-call-playing-a-standard-not-in-service-message 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.reject();
_10
_10
console.log(response.toString());

Output

_10
<?xml version="1.0" encoding="UTF-8"?>
_10
<Response>
_10
<Reject />
_10
</Response>

Example 2: Reject a call playing a busy signal

examples-2 page anchor

Reject a call playing a busy signal

reject-a-call-playing-a-busy-signal 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.reject({
_10
reason: 'busy'
_10
});
_10
_10
console.log(response.toString());

Output

_10
<?xml version="1.0" encoding="UTF-8"?>
_10
<Response>
_10
<Reject reason="busy" />
_10
</Response>


Rate this page: