Larson Technical Services: Voice Technology Consulting

Exercise 5.2

Write VoiceXML code for the following form:

University of West Dakota
Course Add/Drop Form

Student Name: _______________________
Student ID: _________ Date: __________

Course ID: _______ Drop: ___ Add: ____

Reason: _____________________________

Student Signature: ___________________

Simplifying assumptions:

  1. Record the student name and replay it so the student knows that his voice print has been recorded. This recording can be validated by a speaker recognition engine at a later time.
  2. Use DTMF to capture the student ID and Course ID because they are more accurate than speech recognition.
  3. There is no reason to ask the caller for today’s date because the computer can generate today’s date.
  4. Rather than attempting to speech recognize the caller’s response to Reason, record the response and save for later analysis (by both a dictation speech recognition engine and a human transcriptionist if higher accuracy is required).


<?xml version="1.0"?>
<!DOCTYPE vxml PUBLIC "-//BeVocal Inc//VoiceXML 2.0//EN"
     "http://cafe.bevocal.com/libraries/dtd/vxml2-0-bevocal.dtd">

<vxml version="2.0">  

<!-- University of West Dakota Drop/Add form   -->

<form id = "course_add_drop">

<block>
     <prompt>
          Welcome to the university of west dakota drop add system.
     </prompt>
</block>

<record name="student_name" 
        maxtime="10s" dtmfterm="true" beep="true">
     <prompt> Please say your full name? </prompt>
</record>

<block>
     <prompt>
          your name has been recorded as
          <value expr="student_name" />
     </prompt>
</block>

<field name = "student_id">
     <prompt>use the keys on your telephone to enter your six digit student i.d. </prompt>
          <grammar type="application/grammar+xml" mode="dtmf" root = "six_digits">
               <rule id = "six_digits" scope = "public">
                    <item repeat = "6">   
                         <one-of>
                              <item>0</item>
                              <item>1</item>
                              <item>2</item>
                              <item>3</item>
                              <item>4</item>
                              <item>5</item>
                              <item>6</item>
                              <item>7</item>
                              <item>8</item>
                              <item>9</item>
                         </one-of>
                    </item>
               </rule>
          </grammar>
</field>

<field name = "course_id">
     <prompt>enter the four digit course i.d. </prompt>
          <grammar type="application/grammar+xml" mode="dtmf" root = "four_digits">
               <rule id = "four_digits" scope = "public">
                    <item repeat = "4">
                         <one-of>
                              <item>0</item>
                              <item>1</item>
                              <item>2</item>
                              <item>3</item>
                              <item>4</item>
                              <item>5</item>
                              <item>6</item>
                              <item>7</item>
                              <item>8</item>
                              <item>9</item>
                         </one-of>
                    </item>
               </rule>
          </grammar>
</field>

<field name = "action">
     <prompt>say whether you want to drop or add this course? </prompt>
          <grammar type="application/grammar+xml" version="1.0" root = "drop_add">
               <rule id = "drop_add" scope = "public">
                    <one-of>
                         <item><tag>drop_add ="drop"</tag>drop</item>
                         <item> <tag>drop_add ="add" </tag>add</item>
                    </one-of>
               </rule>
          </grammar>
</field>

<record name="reason" maxtime="10s" dtmfterm="true" beep="true">
     <prompt>say why you want to <value expr="action"/> this course </prompt>
<!-- if the user doesn't say anything within final silence, catch the noinput -->
          <noinput>
               Sorry. I didn't hear you. Now returning to the main menu.
          <exit />
     </noinput>
</record>

     <block>
          <prompt>
               Thank you. your request will be processed.  Goodbye.
          </prompt>
     </block>
</form> 

</vxml>

Return to the Instructor’s Page

Comments are off for this post