Start Method

  Microsoft Speech Technologies Homepage

Starts the dual tone multi-frequency (DTMF) input collection session.

dtmf.Start()

Remarks

Only one dtmf element can be active at a time. When Start is called, it clears the dtmfResult and text properties. If the Start method is called on an already active dmtf element, the call has no effect. If Start is called on a dtmf element while another is active, the onerror event is raised on the second dtmf element.

A DTMF session can run in parallel with a speech recognition (listen element) session and a speech output (prompt element) session. When the first keypress is detected during DTMF collection, the Speech Platform generates an onbargein event on any active prompt element that has its bargein attribute enabled. The same keypress also disables the initialtimeout attribute of any active listen element. It does not, however, stop the active listen element, which remains active until it is explicitly stopped. This simply prevents a listen element from causing an onsilence event while a user is entering DTMF.

The Speech Platform can perform only one DTMF collection at a time. Any attempt to start a DTMF input collection session while one is already in progress is ignored. Calling the Start method clears the dtmfResult and text properties.

Example

The following code demonstrates the use of the Start 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() {
        ...
      }
      
      function dtmfKeyPressHandler() {
        ...
      }
      -->
      </script>
  <body>
</html>

See Also

dtmf Element | listen Element | prompt Element | onbargein Event | bargein Attribute | dtmfresult Property | text Property