<catch>
<catch>
The <catch> element associates a catch with a document, dialog, or form item. This element is a specific type of XML Events handler that acts as an observer of its parent element. It contains executable content.
Attributes
Name | Data type | Description |
---|---|---|
event | String | The event or events to catch. A space-separated list of events may be specified, indicating that this <catch> element catches all the events named in the list. In such a case, a separate event counter (see “count” attribute) is maintained for each event. If the attribute is unspecified, all events are to be caught. |
count | Integer | (defaults to 1) The occurrence of the event. The count allows you to handle different occurrences of the same event differently. Each <form>, <menu>, and form item maintains a counter for each event that occurs while it is being visited; these counters are reset each time the <menu> or form item's <form> is re-entered. The form-level counters are used in the selection of an event handler for events thrown in a form-level <filled>. Counters are incremented against the full event name and every prefix matching event name. For example, occurrence of the event “event.foo.1” increments the counters associated with handlers for “event.foo.1” plus “event.foo” and “event”. |
cond | String | (defaults to true) An expression that must evaluate to true after conversion to Boolean in order for the event to be caught. |
Notes
The <error>
, <help>
, <noinput>
, and <nomatch>
elements are shorthand for types of <catch>
elements.
Example
The catch tag can be used to catch application level errors, such as when the IVR attempts to fetch a script that doesn't exist (error.badfetch) or the user hangs up (error.disconnect.hangup).
The following is a scenario where the user enters a valid 5 digit number:
Computer: Please enter your customer identification number. User: <enters 1 2 3 4 5> Computer: Thank You. (attempts to fetch process_customer.php, which does not exist) <catch: error.badfetch> Computer: I'm sorry, it appears we are having technical difficulties. Please try your call again later. *application hangs up*
The catch tag can also be used to define custom nomatch and noinput events. The following is a scenario where the user does not enter any input:
Computer: Please enter your customer identification number. User: <silence: user enters nothing> <noinput x1> Computer: Your input was not valid. Your customer identification number is the five digit number on your membership card. Computer: Please enter your customer identification number. User: <silence: user enters nothing> <noinput x2> Computer: Your input was not valid. Your customer identification number is the five digit number on your membership card. Computer: Please enter your customer identification number. User: <silence: user enters nothing> <noinput x3> Computer: It seems you are having difficulty with your customer identification number. Please call the number on the back of your membership card. Goodbye. *application hangs up*
Child Tags
<audio>, <assign>, <clear>, <disconnect>, <data>, <enumerate>, <exit>, <foreach>, <goto>, <if>, <log>, <prompt>, <reprompt>, <return>, <script>, <submit>, <throw>, <value>, <var>
Parent Tags
<field>, <form>, <initial>, <menu>, <record>, <subdialog>, <transfer>, <vxml>
Last updated