Using Speech Recognition Input

VoiceXML accepts speech or digit input, based on speech grammars and or DTMF grammars that specify the input that is acceptable to the VoiceXML Interpreter at a given time.

You define grammars using the <grammar> element. The example below shows how to create an application that asks for and recognizes four words: coffee, tea, milk, and nothing.

Example 15-1Sample VoiceXML Script using Speech Recognition

Code Snippet
Copy<form>
<field name="choice">
<prompt>Would you like coffee, tea, milk, or nothing?</prompt>
<grammar xml:lang="en-US" type="application/srgs+xml
version="1.0" mode="voice">
<rule id="drinks" >
<one-of>
<item>coffee</item>
<item>tea</item>
<item>milk</item>
<item>nothing</item>
</one-of>
</rule>
</grammar>
</field>
<filled>
Just a second.
Your <value expr="choice"/> is ready.
</filled>
</form>

In the preceding example, the <one-of> element defines a set of expressions (voice replies) that are valid. The Voice Recognition engine fills in the field choice when it recognizes a valid response according to the rules of the grammar. In this example, the exchange might sound like this:

Code Snippet
CopySystem: “Would you like some coffee, tea, milk, or nothing?”
Caller: “Hot tea.”
System: “Just a second. Your tea is ready.”

The Cisco Unified CCX Voice Browser supports SRGS and Cisco RegEx grammars, which are powerful languages for specifying speech input.