PizzaTalk
The PizzaTalk application is the flagship sample application for Voice Platform. It models an automated dialog for ordering and specifying delivery of a pizza using a variety of VoiceXML features. The PizzaTalk application:
- Demonstrates how to organize a dialog in a series of files.
- Provides a model for an application root document.
- Shows how dynamic content can be generated using Java Server Pages (JSP).
- Demonstrates sophisticated design by using context-specific prompts.
- Shows how to send logs and alarms to the Management Station.
Notes for running PizzaTalk
The initial page URI for the PizzaTalk application is:
http://hostname:8090/PizzaTalk/dialogs/Welcome.vxml
Sample dialogs
The first sample dialog provides a simplest case interaction with the application.
|
Application |
[Nuance earcon] Hi, and thanks for calling PizzaTalk with speech recognition by Nuance. So. . . what size pizza would you like? |
|
Caller |
Medium. |
|
Application |
And what do you want on it? |
|
Caller |
Pepperoni, mushrooms, and green peppers. |
|
Application |
You want a medium pizza with pepperoni, mushrooms, and green peppers. Is that right? |
|
Caller |
Yes. |
|
Application |
Great! Now what’s your phone number? |
|
Caller |
605-847-5555. |
|
Application |
I heard 605-847-5555. Did I get that right? |
|
Caller |
Yes. |
|
Application |
Thanks. By the way, we’ve already got your address on file. Now do you want your order to be delivered within the next hour? |
|
Caller |
Yes. |
|
Application |
Okay. I got a medium pizza with pepperoni, mushrooms, and green peppers to be delivered to 1380 Willow Road. Thanks for calling PizzaTalk. Ciao! |
In the next sample dialog, the caller can’t make up his mind about the toppings and wants delivery at a later time.
|
Application |
[Nuance earcon] Hi, and thanks for calling PizzaTalk with speech recognition by Nuance. So. . . what size pizza would you like? |
|
Caller |
Medium. |
|
Application |
And what do you want on it? |
|
Caller |
[no speech]. |
|
Application |
Sorry. I couldn’t hear you. What do you want on your pizza? Or you can ask, “What are the toppings?” |
|
Caller |
What are the toppings? |
|
Application |
Okay. Here’s what we’ve got: pepperoni, sausage, mushrooms, anchovies, ground beef, extra cheese, garlic, lotsa garlic, bacon, Canadian bacon, pineapple, chicken, olives, artichoke hearts, green peppers, jalapenos, linguiça, onions, red onions, pastrami, salami, shrimp, spinach, tomatoes, and zucchini. Sorry. I couldn’t hear you. What do you want on your pizza? Or you can ask, “What are the toppings?” |
|
Caller |
Pepperoni, mushrooms, and green peppers. |
|
Application |
You want a medium pizza with pepperoni, mushrooms, and green peppers. Is that right? |
|
Caller |
No. |
|
Application |
Would you like to try again? |
|
Caller |
Yes. |
|
Application |
What should I change: the size, the toppings, or both? |
|
Caller |
The toppings. |
|
Application |
No problem. What did you want on that? |
|
Caller |
Pepperoni, mushrooms, and jalapenos. |
|
Application |
You want a medium pizza with pepperoni, mushrooms, and jalapenos. Is that right? |
|
Caller |
Yes. |
|
Application |
Great! Now what’s your phone number? |
|
Caller |
605-847-5555. |
|
Application |
I heard 605-847-5555. Did I get that right? |
|
Caller |
Yes. |
|
Application |
Thanks. By the way, we’ve already got your address on file. Now do you want your order to be delivered within the next hour? |
|
Caller |
No. |
|
Application |
Okay. Then what time? |
|
Caller |
6:30. |
|
Application |
That’s 6:30 p.m., correct? |
|
Caller |
Yes. |
|
Application |
Okay. I got a medium pizza with pepperoni, mushrooms, and jalapenos to be delivered to 1380 Willow Road. Thanks for calling PizzaTalk. Ciao! |
The application root document
Looking at the dialog files, you’ll notice that every one includes application="pizza.vxml" in the <vxml> element. Thus pizza.vxml is the application root document, which is loaded whenever the application is entered. The variables, grammars, and handlers defined in it are available to all the documents that call it. The pizza.vxml file itself does the following:
- Sets several VoiceXML properties to override Voice Platform platform default values.
- Declares a variable that defines the path to the prompt files.
- Declares a set of variables that allow the application to store the details of the pizza order (the order variables are PizzaSize, PizzaToppings, PhoneNumber, and DeliveryTime), and initializes the value of each to null.
- Uses <link> elements to specify application-level grammars for any “help,” “repeat,” “cancel,” and “goodbye” universal commands. These <link> elements also specify the page to go to if the “cancel” or “goodbye” grammar is matched.
- Uses <catch> elements to set up global error and help handling by assigning particular values to the entry variable depending on the event. For example, for a nomatch event, entry is set to rej. The value of the entry variable is tested in each dialog so the prompt that is played suits the caller’s situation. (For more detail on the prompts, see Context-specific prompts.)
- Sets up error handling, which includes logging the error and playing a “technical difficulties” prompt.
- Includes a form that re-initializes all the order variables and then directs the application to the Welcome.vxml dialog for cases when a caller says “cancel.”
Basic dialog flow
The following figure shows the basic dialog flow for the application. The voice browser group property sets Welcome.vxml as the initial page of the application. Welcome.vxml and every other file call pizza.vxml as their application root document. Each page links to the next with a <goto next= .../> element.
Each file represents one dialog state and contains one form that contains one field. (The “Get...” files, which collect information, also have a second form that sets the value of the entry variable to “reentry” and returns to the first form when the field is not filled. See Context-specific prompts.) The dialog states where content is generated dynamically are JSP files rather than VXML, so they can use server-side processing to assemble confirmation message.
Context-specific prompts
Careful prompt design makes PizzaTalk sound natural to callers. This is in part accomplished by having several versions of each prompt, depending on how the caller arrived at this point in the dialog. The entry variable tracks how the caller arrived at this point and is used to specify the prompt to play.
The following table lists the possible values of the entry variable and the contexts they describe.
|
Value |
Caller context |
|---|---|
|
init |
entering a dialog state the first time |
|
nst |
following a noinput event |
|
rej |
following a nomatch event |
|
help |
following a help event or repeat event |
|
reentry |
caller did not confirm the item |
For example, there are five versions of the GetPizzaSize prompt, as follows:
|
Entry value |
Prompt |
|---|---|
|
init |
So. . . what size pizza would you like? |
|
nst |
Sorry, I couldn’t hear what size. Do you want a personal, small, medium, large or extra-large? |
|
rej |
I didn’t get that. Do you want a personal, small, medium, large or extra-large? |
|
help |
Sure. I need to know what size pizza you want. Just say personal, small, medium, large or extra-large. |
|
reentry |
No problem. Tell me what size you want one more time. |
Tracking task completion
PizzaTalk provides an example of using the taskbegin and taskend Nuance extensions. The Welcome.vxml page includes the line:
<nuance:taskbegin name="sold_a_pizza" />
and the Wrapup.jsp page includes the line:
<nuance:taskend name="sold_a_pizza" cond="true" reason="" />
If a user does not confirm the pizza size and toppings when prompted, the ConfirmSizeAndToppings.jsp page asks, “Would you like to try again?” If the user says no, the application marks this task as unsuccessful as follows:
<nuance:taskend name="sold_a_pizza" cond="false" reason="User did not confirm"/>
For details, see Tracking tasks in your applications.