Redirect

The Redirect command transfers control of a Call to the PerCL at a different URL. Redirect is a terminal command — any actions following it are never executed.

When Redirect is used at the end of a percl script that doesn’t have any terminal commands, e.g., [{play},{say},{play},{say},{redirect}] it allows the call control to continue via the Redirect webhook.

When Redirect is used as the first (and therefore only) command of a percl script, i.e., [{redirect}] it will replay the previous request to the new url including the original request type and will preserve all the original request parameters.

The maximum number of redirections allowed during the life time of a Call is 256. This is intended to prevent a Call from possibly looping infinitely due to errors in PerCL being generated.

Nesting Rules

No actions can be nested within Redirect and Redirect cannot be nested in any other actions.

Example

[
   {
      "Redirect"  : {
         "actionUrl" : "http://www.example.com/redirects"
      }
   }
]

Command Attributes

Redirect supports the following attributes that modify its behavior:

actionUrl

REQUIRED

Type: absolute URL

URL to request a new PerCL script to continue with the current Call's processing. When Redirect invokes the actionUrl, a redirect Webhook is sent. This request therefore looks identical to the initial request (made to the voiceUrl of the number that was called) for an inbound Call.

📘

A PerCL response is expected to control the Call.