# <dtmf>

Description

(extension) Specifies a grammar for dtmf recognition. This tag was replaced in VoiceXML 2.0 by <grammar mode="dtmf">. However, VoiceGenie continues to allow this as a VoiceXML 2.0 extension, for convenience and backward compatibility.

Note: The IP Media Server interpreter converts <dtmf> to <grammar mode="dtmf"...>. However, the conversion does not work for in-line grammars that are enclosed in a CDATA block.

Syntax

    <dtmf
        src="URI"
        expr="ECMAScript_Expression"
        scope="dialog" | "document"
        type="MIME_Type"
        root="string"
        version="version"
        fetchhint="prefetch" | "safe"
        fetchtimeout="time_interval"
        maxage="integer"
        maxstale="integer"
        xmlns= "http://www.w3.org/2001/06/grammar">
      inline dtmf grammar
    </dtmf>

Attributes

Attribute | Description
src | The URI specifying the location of the dtmf grammar file. The URI can be one of the following formats: External dtmf grammar file: URL of the dtmf grammar file Built-in dtmf grammars: `builtin:dtmf/type` (refer to `<field>` element for built-in types) Optional. Exactly one of src, expr, or an inline grammar must be specified.
expr | An ECMAScript expression to be evaluated and used as the URI of the dtmf grammar file, as documented under `src`, above. Optional. Exactly one of src, expr, or an inline grammar must be specified.
scope | The scope of the dtmf grammar. This attribute can be defined only if the `<dtmf>` element is the child of a `<form>` or `<menu>` element. Optional. (Defaults to dialog.) dialog - This dtmf grammar is only active within the form. document - This dtmf grammar is active throughout the document. If the current page is an application root document, then the dtmf grammar is active throughout the application.
type | The MIME type of the dtmf grammar format. Note that the VoiceGenie interpreter only supports XML and ABNF formats for DTMF grammars.
root | The root rule of the dtmf grammar. Optional.
version | The version of the dtmf grammar. Optional. (Defaults to 1.0.)
fetchhint | Defines when the dtmf grammar file should be fetched. Optional. prefetch - grammar file may be downloaded when the page is loaded safe - only load the grammar file when needed
fetchtimeout | The length of time to wait for the dtmf grammar file to be fetched before throwing an error.badfetch event. Optional.
maxage | Indicates that this document is willing to use a cached copy of the dtmf grammar file only while the age of the cached copy is less than or equal to the number of seconds specified by this attribute. Optional.
maxstale | Indicates that this document is willing to use a cached copy of the dtmf grammar file that has exceeded its expiration time by as much as the number of seconds specified by this attribute. Optional.
xmlns | The XML DTMF format supported by VoiceGenie requires the use of this attribute (set to http://www.w3.org/2001/06/grammar) to designate the namespace for the dtmf grammar. Required (for XML only).

Attribute Notes

- If scope is used in a <link> grammar (and the VoiceXML page has at least one input field) or in an input item grammar, an error.badfetch will be thrown.
  If scope is used in a `<link>` grammar, but the VoiceXML page has no input fields, no warning will be logged and no error will be thrown.
- An error.badfetch event is thrown if more or less than one of src, expr, and an inline grammar are specified.

Parents

<choice>, <field>, <form>, <link>, <record>, <transfer>

Children

#PCDATA

Limitations/Restrictions

- Please see <record> and <transfer> for details on how <dtmf> can be used as a child of those tags.
- ABNF DTMF grammars cannot be more than 8192 characters long. This limit is imposed by the ABNF parser that is used to process DTMF grammars, and is not configurable.

Example

    <?xml version="1.0"?>
    <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
      <form>
        <field name="field1">
          <dtmf> 9 </dtmf>
          <prompt> Please enter 9. </prompt>
          <filled>
            You entered <value expr="field1"/>.
          </filled>
        </field>
      </form>
    </vxml>