Stop Method

  Microsoft Speech Technologies Homepage

Stops a dual tone multi-frequency (DTMF) input collection session.

dtmf.Stop()

Remarks

The Stop method has no effect unless a DTMF input collection is in progress. The DTMF keypresses entered by the user, however, remain in the buffer (on the Speech Platform), and are not flushed. The dtmfresult and text properties are filled with the partially collected input results.

If, when the Stop method occurs, the dtmfresult property contains valid DTMF input (in-grammar result), a reco event is raised. If invalid DTMF (out-of-grammar result) is present, an onnoreco event is raised. If no result is present, an onerror event is raised.

In telephony scenarios, the Stop method executes automatically when a disconnection is detected.

Example

The following code demonstrates the use of the Stop method.

<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() {
        ...
        event.srcElement.Stop();
        event.srcElement.Flush();
        ...
      }
      
      function dtmfKeyPressHandler() {
        ...
      }
      -->
      </script>
  <body>
</html>

See Also

dtmf Element |  dtmfresult Property | text Property