Twilio

This document is for Twilio's old API version 2008-08-01. See whats new with the latest API: Changelog

TwiML Voice: Redirect Verb

The <Redirect> verb transfers control of a call to a different TwiML URL.

Verb Attributes

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

Attribute Name Allowed Values Default Value
method GET, POST POST

method

The method attribute takes the value GET or POST. This tells Twilio whether to request the <Redirect> URL via HTTP GET or POST. POST is the default.

Nouns

The "noun" of a Twilio verb is the body of the element, the thing the verb acts upon. In the case of <Redirect>, the noun is an absolute or relative URL to a different TwiML document.

Nesting Rules

The <Redirect> verb can be nested within the following elements:

The following verbs can be nested within <Redirect>:

  • none

Examples

Example 1: Absolute URL Redirect

<?xml version="1.0" encoding="UTF-8"?>
<Response>
     <Dial>415-123-4567</Dial>
     <Redirect>
        http://www.foo.com/nextInstructions
     </Redirect>
</Response>

In this example, we have a <Redirect> verb after a <Dial> verb with no URL. When the <Dial> verb finishes, the <Redirect> executes. <Redirect> makes a request to http://www.foo.com/nextInstructions and transfers control to a different URL.

Example 2: Relative URL Redirect

<?xml version="1.0" encoding="UTF-8"?> 
<Response> 
    <Redirect> 
        ../nextInstructions 
    </Redirect> 
</Response> 

Redirects flow control to a the specified URL relative to the current URL.