# <disconnect>

Description

Disconnects the user's phone call. As a result, the interpreter context will throw the `connection.disconnect.hangup` or `telephone.disconnect.hangup` event. A `<disconnect>` differs from an `<exit>` in that it forces the interpreter context to drop the call.

Syntax

    <disconnect
        reasonexpr="ECMAScript_Expression"
        expr="ECMAScript_Expression"
        namelist="variable1 variable2 ..."/>

Attributes

Attribute | Description
reasonexpr | An ECMAScript expression to be evaluated and used as the reason for this disconnection. The expression must evaluate to an integer. Optional.
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 hang up request is sent. Returns nothing by default. See below for details on General Usage. Optional. (Only one of expr or namelist can be specified.)

Attribute Notes

- If `reasonexpr` does not evaluate to an integer, it will be ignored and a warning will be logged.

Parents

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

Children

None.

Extensions

- Added `reasonexpr` attribute.
- Added `expr` attribute.

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 a `<disconnect>` tag.

Limitations/Restrictions

- `<disconnect>` cannot be used as a child of `<foreach>` when `<foreach>` is a child of `<prompt>`.
- The `telephone.disconnect.hangup` event can only be caught once during the execution of an application; see details.

Example

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