W3C home > Mailing lists > Public > www-voice@w3.org > April to June 2001

logic check please

From: <DPawson@rnib.org.uk>
Date: Wed, 2 May 2001 13:58:47 +0100
Message-ID: <9B66BBD37D5DD411B8CE00508B69700F4F06FE@pborolocal.rnib.org.uk>
To: www-voice@w3.org
I've created a simple example demonstrating, hopefully,
a voice based simple one from n selection.

Not being too familiar with voicexml, I'd like someone more
knowledgable than I to check its sequence logic for errors.

logic is to prompt user for a color or exit.
Use either tones or voice as input,
select one and move on to another script.
Help offered as either clarification (count=2)
or give up (exit condition).



any comments or clarification appreciated.

Regards DaveP

<? xml version="1.0" ?>
<!DOCTYPE vxml SYSTEM "/sgml/w3c/voicexml.dtd">
<vxml version="2.0">



 <form id="color" scope="dialog">
  <block>Select one of the items in the list.</block>
  <field name="selected-link" modal="false">
   <prompt count="1">Say  red or press 1, blue or press 2, green or press 3,
yellow or press 4; or say help for further information. </prompt>
   <prompt count="2">Say either red, blue, green or yellow.</prompt>
 <catch event="help">
    <prompt>To exit this menu, say exit or press the star key.</prompt> 

 <!-- How do I exit if the hash key is pressed? -->

  </catch>
<catch event="noinput" count="2">
   <audio>Please speak up. I cannot hear anything.</audio><reprompt/>
</catch>

<grammar mode="speech">
    <rule id="rule" scope="public">
      <one-of>
        <item tag="red">red</item>
        <item tag="blue">blue</item>
        <item tag="green">green</item>
        <item tag="yellow">yellow</item>
      </one-of>
    </rule>
  </grammar>
  <grammar mode="dtmf">
    <rule id="rule" scope="public">
      <one-of>
         <item tag="red">1</item>
        <item tag="blue">2</item>
        <item tag="green">3</item>
        <item tag="yellow">4</item>
      <item tag="help">#</item>
      <item tag="exit">*</item>
      </one-of>
    </rule>
  </grammar>
   <help>Say one of the names of the colors, speaking clearly, either red,
blue, green or yellow. <reprompt/></help>
  </field>
  <filled mode="any" namelist="color">
   <if cond="color == 'red'">
    <prompt>
     You have chosen the red route
    </prompt>
    <clear/>
    <goto next="./route.vxml#red"/>
    
   </if>
   <if cond="color == 'blue'">
    <prompt>
     You have chosen the blue route
    </prompt>
    <clear/>
    <goto next="./route.vxml#blue"/>
   </if>
   <if cond="color == 'yellow'">
    <prompt>
     You have chosen the yellow route.
    </prompt>
    <clear/>
     <goto next="./route.vxml#yellow"/>
   </if>

 <if cond="color == 'exit">
    <prompt>
     You have chosen to exit
    </prompt>
    <clear/>
    <exit expr="exit"/>
   </if>



  </filled>
 </form>
</vxml>
Received on Wednesday, 2 May 2001 09:04:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 30 October 2006 12:48:54 GMT