dtmf Element

  Microsoft Speech Technologies Homepage

Used in telephony applications to specify dual tone multi-frequency (DTMF) inputs and how to handle the collected results.

<dtmf attributes>
   <grammar attributes />  // Specifies grammar resources
   <bind attributes />     // Copies recognition results to page elements or calls a methods of the target element
   <param attributes />    // Specifies platform configuration parameters 
</dtmf>

The dtmf element consists of the following members.

Contents Description
grammar Specifies input grammar resources.
bind Copies one semantic element of recognition results to an HTML page element or calls a method of the target element.
param Specifies a Speech Platform configuration parameter.
Attributes  
id Identifies the dtmf element.
endsilence Specifies, in milliseconds, the time period when DTMF input matches the grammar but further input is still possible.
initialtimeout Specifies, in milliseconds, the time-out period for receiving the first DTMF press.
interdigittimeout Specifies, in milliseconds, the time-out period between DTMF presses after the first press is recognized.
preflush Specifies whether to automatically flush the DTMF buffer on the underlying telephony interface card before activation.
Properties  
dtmfresult Contains the results of DTMF collection.
status Indicates the success of a DTMF collection by the telephony platform.
text Contains a string holding the DTMF digits collected.
reason Returns text from the Speech Platform about the most recent error. Read-only.
Methods  
Start Starts the DTMF collection session.
Stop Stops the DTMF collection session.
Flush Flushes the DTMF collection buffer.
Events  
onerror Occurs when the DTMF collection or recognition process encounters a serious or fatal error.
onkeypress Occurs every time a user presses a grammar-defined DTMF key.
onnoreco Occurs when a DTMF key is pressed that is not valid according to the DTMF grammar, or when the interdigittimeout period is exceeded.
onreco Occurs when a DTMF session ends with a recognition.
onsilence Occurs when there has been no DTMF keypress before the initialtimeout expires.
Event Diagrams  
dtmf Event Diagram Illustrates the event timelines associated with the dtmf element.
dtmf/listen Interaction Illustrates the interaction timelines that occur when a dtmf element and a listen element are concurrently active.

Remarks

The dtmf element creates an object for the recognition of DTMF touch-tone signals.

Activate the dtmf element using scripting or inline markup language syntax. When activated and a key is pressed, DTMF input can interrupt any active prompt if the bargein attribute of the prompt element is set to true.

Example

The following code demonstrates the use of the dtmf element.

<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

listen Element | prompt Element | smex Element