Catch

Definition

The goto attribute within this tag will execute when the defined value occurs. This goto executes immediately, interrupting the currently running script.

Value

The contents within the tag watch for the defined catch scenario.

Attributes

Attribute Required Values Description
name N any text A unique name for the tag
type Y hangup digit Defines type of user input
value Y 0-9 or * Required when type="digit"
goto Y any node The predefined node to jump to

Examples

The following example shows a catch of the digit 0, automatically sending the call to the operator:

<dialplan name="Root">
    <catch goto="OpCall" name="OperatorCall" type="digit" value="0">
        <menu>
            <play type="tts" voice="female2">
                Please enter "one" if you agree. Enter zero at any time to reach an operator.
            </play>
            <keypress pressed="1">
                <stash varname="question1">1</stash>
            </keypress>
        </menu>
    </catch>
    <transfer callerid="${call.callerid}" name="OpCall">2135551212</transfer>
</dialplan>

The following occurs when the call is hung up. It takes certain information and stashes it in the Call Details report before the IVR terminates:

<dialplan name="Root">
    <catch goto="HangupSave" name="hangup" type="hangup">
        <menu name="Menu2">
            <play type="tts" voice="female2">
                Please enter "one" for strongly agree or "nine" for strongly disagree.
            </play>
            <keypress pressed="Default">
                <stash varname="question2">${call.lastinput}</stash>
            </keypress>
        </menu>
    </catch>
<stash name="HangupSave" varname="CallerInfo">${call.callerid}</stash>
</dialplan>