VoiceXML Example : Vestec

Simple inline grammar

<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml" xml:lang="es-ES">
  <property name="confidencelevel" value="0.6"/>
  <property name="inputmodes" value="voice"/>
  <form id="deck">
    <field name="name">
      <grammar xml:lang="es-ES" root="name">
        <rule id="name">
          <one-of>
            <item>chocolate
              <tag>chocolate</tag>
            </item>
            <item>vainilla
              <tag>vainilla</tag>
            </item>
          </one-of>
        </rule>
      </grammar>
      <prompt>¿Que prefiere, el chocolate o la vainilla ?</prompt>
    </field>
    <filled>
      <prompt>Usted ha dicho
        <value expr="name"/>
      </prompt>
    </filled>
  </form>
</vxml>

The VoiceXML browser will use an grammar definied in the document. This is a case of a SRGS/GRXML simple grammar.

Download : vestec1.vxml

Simple ABNF reference grammar

<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml" xml:lang="es-ES">
 <form>
  <property name="inputmodes" value="voice"/>
  <property name="timeout" value="5s"/>
  <field name="text">
   <grammar mode="voice" src="yesno_es.grm"/>
   <catch event="noinput nomatch">
    <reprompt/>
   </catch>
   <prompt>
    Por favor diga, si o no
   </prompt>
  </field>
  <filled>
   <prompt>
    Ha dicho :
    <value expr="text.Yesno" />
   </prompt>
   <clear namelist="text" />
  </filled>
 </form>
</vxml>
/*
  Vestec Automatic Speech Recognition Engine Version 1.0
  Copyright (c) 2009 Voice Enabling Systems Technology, Inc. All rights reserved.
 */

#ABNF 1.0;

$Yesno = $Yes {si} | $No {no};

$Yes =
  si
  | sip
  | claro
  ;

$No =
  no
  ;

The VoiceXML browser will use a grammar file with the ABNF syntax.

Download : vestec2.vxml yesno_es.grm