Application-defined events

An application may throw a custom event under any name it chooses. The event will semantically behave like any other event. These events can be thrown using one of three methodologies:

  • Standard VoiceXML element constructs—The <choice>, <link>, <throw>, and <return> elements provide the ability to generate custom events. These elements also provide a mechanism for passing an information message along with the event that will be available in the <catch> handler as _message.
  • JavaScript—Events thrown from JavaScript may be caught by the event name they were given in JavaScript, for example:
<form>
    <catch event="my.javascript.event">
        <prompt>Caught the event!</prompt>
        <exit/>
    </catch>
    <block>
        <script> throw "my.javascript.event"; </script>
    </block>
</form>