# <exit>

Description

Exit the interpreter session. Returns control to the interpreter context, which determines what to do next. This element differs from the `<return>` element in that `<exit>` terminates all loaded elements while `<return>` returns from a `<subdialog>` invocation. Note that the `<exit>` element does not cause an "exit" event to be thrown.

Syntax

    <exit
        expr="ECMAScript_Expression"
        namelist="variable1 variable2 ..."/>

Attributes

Attribute | Description
expr | An ECMAScript expression to be evaluated, assigned to the variable name "_VG_EXIT_EXPR", and returned. See below for details on General Usage. Optional. (Only one of expr or namelist can be specified.)
namelist | A space-separated list of variables to be returned to the interpreter context when the exit request is sent. Returns nothing by default. See below for details on General Usage as well as Usage with Multiphase Transfers. Optional. (Only one of expr or namelist can be specified.)

Parents

<block>, <catch>, <error>, <filled>, <foreach>, <help>, <if>, <noinput>, <nomatch>

Children

None.

Extensions

None.

Limitations/Restrictions

- `<exit>` cannot be used as a child of `<foreach>` when `<foreach>` is a child of `<prompt>`.

General Usage

These attributes are useful for advanced applications that use external elements in addition to the VoiceXML server. In such applications, calls are routed to the VoiceXML server from the external servers whenever VoiceXML must be executed to collect user input. After input has been collected, information can be passed back to the external servers with an `<exit>` tag.

Usage with Multiphase Transfers

One exception to the above generalization is the use of `<exit>`'s `namelist` in multiphase transfers (i.e. when `<transfer>`'s `consultexpr` is set). After interacting with the callee, a child script can pass information (including the `accepttransfer` boolean variable to indicate whether or not the call is accepted) back to the parent page by exiting with `<exit namelist="<var1> <var2> .../>`. The combined length of the variable names and values must not exceed 4096 characters. The parent page can then access these results through the `<transfer>`'s shadow variable(s) `<transfer_name>$.result.<vari>`.

Example

    <?xml version="1.0"?>
    <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
      <form>
        <block>
          Thanks for calling.
          <exit/>
        </block>
      </form>
    </vxml>