Larson Technical Services: Voice Technology Consulting

Exercise 7.5

Many proper names are difficult for a speech recognition engine to understand. In these cases, many developers record the name for later manual transcription. Write a VoiceXML form field that solicits the caller’s name. Include 3 nomatch error handlers, with the third error handler recording the caller’s name.


<?xml version="1.0"?>
<vxml version="2.0">

<!--  Exercise 7.5  -->

<form id = "form1">
<field name="UserName">
     <prompt>Say your name</prompt>
     <catch event="nomatch" count= "1">
          <prompt>
               Sorry, I did not understand you, please say your name again
          </prompt>
     </catch>
     <catch event="nomatch" count= "2">
          <prompt>
               Sorry, I still did not understand you.  What is your name?
          </prompt>
     </catch>
     <catch event="nomatch" count= "3">

     <goto next = "#form2"/>
     </catch>

<grammar type="application/grammar+xml" version="1.0">
     <rule id = "aUser" scope = "public">
          <one-of>
               <item>fred</item>
               <item>sam</item>
          </one-of>
     </rule>
  </grammar>
  
<filled>
     <submit next="write_answers_to_disk.cgi" namelist="UserName" />
     <exit/>
     </filled>
</field>
</form>

<form id = "form2">
<record name="answer_1" 
          maxtime="10s" dtmfterm="true" beep="true" finalsilence="1s">
     <prompt>
          This time I will record your name.  
          Please say your name again
     </prompt>
     <filled>
     <submit next="write_answers_to_disk.cgi" namelist="UserName" />
     <exit/>
     </filled>
</record>
</form> 
</vxml>

Return to the Instructor’s Page

Comments are off for this post