Predefined events

The VoiceXML browser supports the complete set of predefined events documented in VoiceXML 2.0, as described in Table 1:

Table 1. Predefined events and event handlers for US English
Event Description Implementation details
cancel The VoiceXML browser throws this event when the user says a valid word or phrase from the Quiet/Cancel grammar. The default event handler stops the playback of the current audio prompt.
error.badfetch The VoiceXML browser throws this event when it detects a problem, such as an unknown audio type, an invalid URI, or the expiration of a fetchtimeout, that prevents the browser from jumping to the next URI. The default event handler plays the message “Sorry, must exit due to processing error” and then exits.
error.badfetch.http.<responsecode> The VoiceXML browser uses this event to return an http response code in the event of a fetch failure. The default event handler plays the message “Sorry, must exit due to processing error” and then exits.
error.badfetch.protocol.<responsecode> The VoiceXML browser uses this event to return a protocol specific response code in the event of a fetch failure. The default event handler plays the message “Sorry, must exit due to processing error” and then exits.
error.semantic The VoiceXML browser throws this event when it detects an error within the content of a VoiceXML document (such as a reference to a non-existent application root document) or when a critical error (such as an error communicating with the speech recognition engine) occurs during operation. The default event handler plays the message “Sorry, must exit due to processing error” and then exits.
error.unsupported.element The VoiceXML browser throws this event when it encounters a reference to an unsupported element. For example, if a document contains a <transcribe> element, the VoiceXML browser will throw an error.unsupported.transcribe event. The default event handler plays the message “Sorry, must exit due to processing error” and then exits.
error.unsupported.format.element The VoiceXML browser throws this event when it encounters a reference to an unsupported resource format, such as an unsupported MIME type, grammar format, or audio file format. The default event handler plays the message “Sorry, must exit due to processing error” and then exits.
exit The VoiceXML browser throws this event when it processes a <throw event=“exit”>. The VoiceXML browser performs some cleanup and then exits.
help The VoiceXML browser throws this event when the user says a valid word or phrase from the Help grammar. The default event handler plays the message “Sorry, no help available” and then re-prompts the user. For guidelines on choosing a scheme for your own help messages, see Choosing help mode or self-revealing help.
noinput The VoiceXML browser throws this event when the timeout interval, as defined by a timeout attribute on the current prompt, the timeout property, or the vxml.timeout Java system property, is exceeded. The default event handler re-prompts the user. If you adhere to the guidelines for self-revealing help, this event can use the same messages as the help event. See Implementing self-revealing help for details.
nomatch The VoiceXML browser throws this event when the user says something that is not in any of the active grammars. The default event handler plays the message, “Sorry, I didn't understand” and then re-prompts the user. If you adhere to the guidelines for self-revealing help, this event can use the same messages as the help event. See Implementing self-revealing help for details.

If the user pauses after uttering a partial response, and the silence period exceeds the duration specified by the incompletetimeout property, the VoiceXML browser's response depends on whether the user's partial utterance matches a valid utterance from any active grammar:

  • If the partial user utterance is itself a valid utterance, the VoiceXML browser returns a result. For example, if the built-in phone grammar is active and the user pauses after uttering 7 digits of a 10-digit telephone number, the VoiceXML browser will return the 7-digit number.
  • If the partial user utterance is not itself a valid utterance (for example, if the user pauses in the middle of a word), the VoiceXML browser throws a nomatch event.
connection.disconnect.hangup The VoiceXML browser throws this event when the user hangs up the telephone or when a <disconnect> element is encountered. Supported as documented in VoiceXML 2.0.

The default event handler exits; however, you can override this handler if application-specific cleanup is desired.

connection.disconnect.transfer The VoiceXML browser throws this event when the user has been unconditionally transferred to another line (by the <transfer> element) and will not return. Supported as documented in VoiceXML 2.0. The <transfer> event is thrown after the transfer is initiated and before the interpreter exits. The default event handler exits; however, you can override this handler if application-specific cleanup is desired.
Note: UK English uses the same default event handlers. For language versions other than US English, see the appropriate appendixes.

If desired, you can override the predefined event handlers by specifying your own <catch> element to handle the events. For example, to go to field1 after catching the event error.badfetch:

<catch event="error.badfetch">
   Caught bad fetch.
   <goto nextitem="field1"/>
</catch>