CallXML 3.0 Development GuideHome  |  Frameset Home

  tutorial Hello World with Container Inheritance  |  TOC  |  tutorial Hello World with Choices  

Recognizing User Input

The ability for a caller to interact with our applications is a crucial feature that is used in every telephony application, so we will tackle the concept of gethering both DTMF and voice inputs in our next tutorial. For those not 'in the know', the term 'DTMF' translates to 'Dual Tone Multi Frequency' or, to those who speak English, it stands for the telephone keypad, which is the obvious choice for human to application interaction in the CallXML markup.

When dealing with DTMF input, we are going to have exactly twelve options for input; the numeric 1-0 keys, plus the 'star' and 'pound' keys. Since this may seem like a somewhat limited range of input options for our callers, the possibilities are in fact endless. Since we are using DTMF and voice as our primary input source, we need to cover how we catch, handle, and transition callers based on the input they give to the application. All of the above will be done with the CallXML <on> element.

For those who have worked with conditional logic, this will doubtlessly look familiar. For those who haven't we will cover this concept in detail. Let's look at a few simple sentences, and then we will compare it to how callXML handles DTMF input:

"If it is raining, then wear a raincoat"
"If it is a Steve Guttenberg movie then change the channel"
"If the keypress is '6' then play 'If6was9.wav'"
"If the keypress was '9' then play '99RedBaloons.wav'"


Seems pretty simple, and common-sense, right? Now, lets take a look at how this would translate in our CallXML markup:

<prompt choice="6,9">
  Press six for Jimi Hendrix, or press nine for euro-hit wonder Nina.
</prompt>

  <on event="choice:6">
    <playaudio value="If6was9.wav"/>
  </on>

  <on event="choice:9">
    <playaudio value="99Redballoons.wav"/>
  </on>


And the very same concept applies to voice recognition input as well, except that we will be using a series spelled-out strings to represent a valid input:

<prompt choice="six,nine">
  Press six for Jimi Hendrix, or press nine for euro-hit wonder Nina.
</prompt>

  <on event="choice:six">
    <playaudio value="If6was9.wav"/>
  </on>

  <on event="choice:nine">
    <playaudio value="99Redballoons.wav"/>
  </on>



A few  simple notes on the above snippets of code:

Pretty simple stuff, right? Now that we are feeling all cocky, we should seize the moment and jump headfirst into our next Lesson, where we put this knowledge into practice..



  ANNOTATIONS: EXISTING POSTS
visionik
1/30/2008 8:43 AM (EST)
Note:

While the prompt example as shown will work, it's important to note that prompt is also a container type element.  As a result, you can actually put the "on" elements inside your prompt, to group things more logically in your code.  Here's an example:


<prompt choice="6,9">
  Press six for Jimi Hendrix, or press nine for euro-hit wonder Nina.

  <on event="choice:6">
    <playaudio value="If6was9.wav"/>
  </on>

  <on event="choice:9">
    <playaudio value="99Redballoons.wav"/>
  </on>

</prompt>
rqualis
3/18/2008 6:08 PM (EDT)
I tried this sample, but it only worked when I used "choices" instead of "choice" as instructed above.
saqibsarwar
10/29/2008 8:11 AM (EDT)
change

<prompt choice="6,9">

to

<prompt choices="6,9">

and kindly upload tested code, as it wasted my time in getting it right.

thanks
voxeoAlexBring
10/29/2008 8:22 AM (EDT)
Hello,

    Thanks for catching that typo for us. The changes will be reflected in our latest build of the Docs that should go live in the next week or two.

Regards,

Alex
Voxeo Support

login
  tutorial Hello World with Container Inheritance  |  TOC  |  tutorial Hello World with Choices  

© 2008 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site