onerror Event

  Microsoft Speech Technologies Homepage

Occurs when the dual tone multi-frequency (DTMF) collection or recognition process encounters a serious or fatal error.

HTML <dtmf onerror="errorHandler()">
Scripting dtmf.onerror = errorHandler;
Named Script <SCRIPT FOR = dtmf EVENT = onerror>

Remarks

When a serious or fatal error occurs during active DTMF collection, the onerror event is raised and the status property is updated with an error code as described in the following table:

Value Description
-1 A generic Speech Platform error occurred during DTMF collection.
-3 An invalid property/attribute setting caused a problem with the DTMF collection request.
-4 Failed to find the Uniform Resource Identifier (URI) of a DTMF grammar resource.
-5 Failed to load or compile a grammar resource.
-8 DTMF collection was attempted without an active grammar element.
-9 DTMF collection was attempted while another DTMF collection was in progress.
-11 No DTMF input was detected within the period specified by the initialtimeout attribute.
-13 An invalid (out of grammar) keypress was detected.
-16 No DTMF input was detected within the period specified by the interdigittimeout attribute.
-18 Semantic Markup Language (SML) generation failure. The DTMF grammar script may contain invalid code or it may be taking too long to execute.
-30 DTMF collection was attempted after a disconnect.

In addition to setting the status property, the dtmfresult and text properties are flushed. If a DTMF collection is in progress when an error occurs, that collection is stopped.

Although the event handler does not receive properties directly, the handler can query the event object for data.

Example

The following code demonstrates the use of the onerror event.

<html xmlns:salt="http://www.saltforum.org/2002/SALT">
  ...
  <body>
    <input type="text" name="iptAreaCode" onFocus="dtmfAreaCode.Start()" />
    <input type="text" name="iptPhoneNumber" />
    ...
    <salt:dtmf id="dtmfAreaCode" onkeypress="dtmfKeyPressHandler()" onreco="dtmfPhoneNumber.Start()"    onsilence="dtmfSilenceHandler()" onerror="dtmfErrorHandler()" onnoreco="dtmfErrorHandler()"    initialtimeout="5000" interdigittimeout="2000" preflush="true">
      <!-- grammar result will contain "smlAreaCode" node -->
      <salt:grammar src="3digits.grxml" />
      <salt:bind value="//smlAreaCode" targetelement="iptAreaCode" />
    </salt:dtmf>
    <salt:dtmf id="dtmfPhoneNumber" onkeypress="dtmfKeyPressHandler()" onerror="dtmfErrorHandler()"    initialtimeout="5000" interdigittimeout="2000" preflush="true">
       <!-- grammar result will contain "smlPhoneNumber" node -->
      <salt:grammar src="7digits.grxml" />
      <salt:bind value="//smlPhoneNumber" targetelement="iptPhoneNumber" />
    </salt:dtmf>
    <script language="jscript">
    <!--
      function dtmfSilenceHandler() {
        ...
      }
  
      function dtmfErrorHandler() {
        ...
      }
      
      function dtmfKeyPressHandler() {
        ...
      }
      -->
      </script>
  <body>
</html>

See Also

dtmf Element |  status Property | dtmfresult Property | text Property