Lesson 6 – Interacting with the Caller

Objectives

Lesson 6 explains how to create an Input object to request input from the caller and store the result in a variable.

After completing this lesson you will know

·          how to create an Input object,

·          how to specify a TTG grammar,

·          how to handle the result through a Variable object.

Interacting with the Caller

Phone applications typically interact with the caller, requesting information such as a name or a phone number, or presenting a choice to the caller asking for a selection of an item.

Several object types are provided by VoiceObjects to create interactive dialogs. The most common one is the Input object explained below, others are the Confirmation, List, Menu, and Recording object.

For details see Chapter 3 – How to Interact with the Caller in the Design Guide and the descriptions of the respective objects in the Object Reference.

The Input Object

The Input object is one of the most frequently used objects. It is used to request one or more pieces of information from the caller.

The Input object plays an Output object to ask for the data, and provides a grammar defining the admissible utterances (which can, in case of the voice channel, either be DTMF or voice input). The recognized values are returned in slots and assigned to variables.

The Input object belongs to the object category Components.

For detailed information on the Input object including how to deal with other channels than voice refer to Input in the Object Reference.

Creating an Input Object

The main interaction of an Input object is to play an output to the caller that requests information and to assign the recognized input from the caller to a variable. In the case of the Life Insurance application you will use a first Input object to ask the caller for his or her gender and to store the recognized answer.

To create this Input object do the following:

1.        From the New menu, select Input or click the Input button  on the toolbar. An empty Input editor will open up.



2.        In the Input editor, enter Ask for gender as the name for the new Input object in the Name field at the top of the editor window.

Specify the input request

1.        In the Input Request section, enter a request like To help me calculate what your monthly premium would be for life insurance, please say if you are male or female. in the text area of the embedded output.

2.        Leave all other values as default.

Your Input Request section will now look like this:


Specify the recognition grammar

The Grammar section defines the grammar specifying the utterances that can be recognized as input.

In case of the voice channel, the grammar can define a set of phrases that a caller might say or DTMF keys a caller might press on the phone’s keypad during a dialog in response to a particular request prompt.

For a detailed description of using grammars see Grammar in the Object Reference.

To specify the grammar for the Ask for gender Input object, do the following:

1.        Expand the Grammar section by clicking the Maximize button  in the right corner of the toolbar or by clicking the left field of the toolbar.

On the Voice/Text tab in the Grammar section, you can, in case of using the voice channel, define a grammar for voice input (as opposed to DTMF input).

By default, the TTG check box is selected, indicating that text-to-grammar is used. This enables you to define grammars by means of comma-separated lists of utterances without having to bother about grammar formats specific to the underlying media platform.

When building voice applications in a rapid prototyping approach, it is often desirable to start the definition of a grammar by just providing a couple of typical utterances a caller might say.

In the case of the Life Insurance application, a first TTG grammar will be used containing the two possible genders.

2.        Enter female and male, separated by a comma, into the text field in the Grammar section.

3.        Leave all other values as default.

Your Grammar section will look like this now:


Specify the result handling through a Variable object

When using TTG, the result (the recognized input from the caller) is returned in a slot called sltTTG. This slot name must be used in the Result Handling section of the Input editor to assign it to a Variable object.

1.        In the Result Handling section, enter sltTTG in the Slot name field.

2.        To assign the result to a variable you need to create a Variable object. To do so, click the Context Menu button   to the right of the Variable field. From the context menu, select New and then Variable. An empty Variable editor will open up.

3.        In the Variable editor, enter Caller gender as the name for the new Variable object in the Name field at the top of the editor window.



4.        Leave all other values as default and on the toolbar of the editor click Save and Close.

For further information on the Variable object refer to Variable in the Object Reference.

The Caller gender Variable object will be linked into the Ask for gender Input object.

Your Result Handling section looks like this now:



Finally, click Save and Close on the Input Editor toolbar.

For an overview on all parameters that can be specified within the Input editor refer to Input in the Object Reference.

In the Object Browser, you will now see an Input folder in the Components folder, containing your Ask for gender Input object.

Note, that the Caller gender Variable object that you created in the previous step to store the caller input also has been saved as an autonomous object and can be found in the respective folder in the Object Browser (Variable folder in the Logic folder).

Adding the Input Object to the Application

To add the Ask for gender Input object to the Module object of the Tutorial application do the following:

1.        In the Object Browser, double-click the Life Insurance Module object to open it. The corresponding Module editor will open up.

2.        In the Object Sequence section, click the Context Menu button   to the right of the Object field. From the context menu, select Browse and then Input. In the Search Result window, click the Ask for gender Input object to link it into the Object field.

3.        On the Module Editor toolbar, click Save and Close.

Look at the Life Insurance Module object in the Dialog Designer.

To display the Dialog Designer for the Life Insurance Module object, right-click it in the Object Browser and from the context menu, select Display Dialog.

As you can see the Ask for gender Input object has been added to the embedded sequence of the Life Insurance Module object.



Dialog Flow 3

After redeploying your service in the Control Center (see Redeploying an Application in Lesson 5), call your application again and test it.

The following dialog flow shows a possible dialog for the current application:


Object – Caller

Dialog Flow

Welcome to the Prime Life Insurance service!

To help me calculate what your monthly premium would be for life insurance, please say if you are male or female.


Caller

Female.

Thanks for calling. Goodbye!

Creating a Second Input Object

In the Life Insurance application a second Input object is used to ask the caller for his or her age and to store the recognized answer. Since, to simplify matters, we will not use any external grammars during the Tutorial, we will use a so-called built-in grammar for the recognition of the age (see below). Built-in grammars are a special type of grammar provided by the media platforms for standard inputs such as yes/no, a date, a phone number etc. For further information on built-in grammars see Grammar in the Object Reference.

To create the Input object asking for the caller’s age, do the following:

1.        From the New menu, select Input or click the Input button  on the toolbar to open up an empty Input editor.

2.        In the Input editor, enter Ask for age as the name for the new Input object in the Name field at the top of the editor window.

3.        In the Input Request section, enter a request like Now please say your age. in the text area.

4.        Expand the Grammar section and in the Type field select Built-in from the drop-down list. In the text field just enter number to refer to the built-in grammar of your media platform for numbers.

Your Grammar section will look like this now:


 

5.        In the Result Handling section, click the Context Menu button   to the right of the Variable field to create and link a new Variable object.

6.        In the Variable editor, enter Caller age in the Name field at the top of the editor window. Leave all other values as default and on the toolbar of the editor click Save and Close. The Caller age Variable object will be linked into the Variable field in the Result Handling section of the Ask for age Input object.
In the case of built-in grammars, the Slot field is left empty.

7.        Leave all other values in the Input editor as default.

8.        Finally, click Save and Close on the Input Editor toolbar.

Again, you can find the Ask for age Input object in the Input folder of the Object Browser and the Caller age Variable object in the Variable folder.

Add the Ask for age Input object to the Life Insurance Module object as you have done with the Ask for gender Input object previously:

1.        In the Object Browser, double-click the Life Insurance Module object to open the corresponding Module editor.

2.        In the Object Sequence section, add a new row to the object list by clicking the Add button on the toolbar.

3.        Click the Context Menu button   to the right of the new Object field and link the Ask for age Input object by browsing.

4.        On the Module Editor toolbar, click Save and Close.

Again, display the Dialog Designer for the Life Insurance Module object via its context menu in the Object Browser. Find the Ask for age Input object added to the embedded sequence of the Life Insurance Module object below the Ask for gender Input object.



Dialog Flow 4

After redeploying your service in the Control Center (see Redeploying an Application in Lesson 5), call your application again and test it.

i8Note: For the convenience of the caller a so-called barge-in functionality is provided. Barge-in allows you to interrupt an output message and respond without waiting until the output has finished. This functionality is very useful for advanced users and also makes testing easier.
The feature itself is essentially provided by the media platform whereas VoiceObjects provides the possibility to switch barge-in on or off. By default barge-in is switched on. For details refer to Output in the Object Reference and to Chapter 2 – Configuring Servers and Services in the Deployment Guide.

The following dialog flow shows a possible dialog for the current application:


Object – Caller

Dialog Flow

Welcome to the Prime Life Insurance service!

To help me calculate what your monthly premium would be for life insurance, please say if you are male or female.


Caller

Female.

Now please say your age.


Caller

28.

Thanks for calling. Goodbye!

Checking the Results by an Output Object

Next, check if your inputs actually have been recognized properly. This is done by adding an Output object to the Life Insurance Module object that plays back the content of the Caller gender Variable object and the Caller age Variable object.

Different methods to create autonomous objects

Up to now you have created new objects by selecting an object type from the New menu, defining it, then saving it, and in a separate step adding it to the Life Insurance Module object.

A quicker and more convenient way to add objects to the dialog flow is to create an object directly within the editor of the object you want to add it to (as you have actually done with the Caller gender Variable object previously).

In this case, click the Context Menu button   to the right of the field into which you want to insert the new object and, via the New Menu, select the object type you want to add. After creating and saving it, the new object will be automatically linked into the object you have started from.

In both cases autonomous objects will be created that will be displayed in the Object Browser.

Create the Output object repeating the results

This time, create the new object from inside the Life Insurance Module object.

1.        Open the Life Insurance Module object.

2.        In the Object Sequence section, add a third row by clicking the Add button  on its toolbar.

3.        Click the Context Menu button   to the right of the empty Object field. From the context menu, select New and then Output. An empty Output editor will open up.

4.        In the Output editor, enter Repeat caller gender and age as the name for the new Output object in the Name field at the top of the editor window.

5.        In the Output section, enter Ok, I have recognized your gender as in the text field.

6.        At the end of this text, link the Caller gender Variable object by browsing for it via the context menu.

7.        Enter and your age as followed by the Caller age Variable object.

8.        Leave all other values as default and on the toolbar of the editor click Save and Close.

The Repeat Caller gender and age Output object will be linked into the object sequence of the Life Insurance Module object.

The Dialog Designer for the Life Insurance Module object now looks like this:


Dialog Flow 5

After redeploying your service in the Control Center again (see Redeploying an Application in Lesson 5), test how your application has changed.

The following dialog flow shows a possible dialog for the current application:


Object – Caller

Dialog Flow

Welcome to the Prime Life Insurance service!

To help me calculate what your monthly premium would be for life insurance, please say if you are male or female.


Caller

Female.

Now please say your age.


Caller

Twenty-eight.

Ok, I have recognized your gender as female and your age as twenty-eight.

Thanks for calling. Goodbye!


After providing a gender and an age the most recently created Output object will play the results back to you. By this, you can now check if your input has been recognized and stored correctly.

i8Note: Sometimes it is desirable to test the application functionality without having access to a media platform. This can be accomplished by using the Debug Viewer. A Debug Viewer session can be directly started from within the Control Center via the entry Debug Viewer in a service’s context menu. This entry is only available for started services. For detailed information on the Debug Viewer refer to Chapter 4 – Service Deployment in the Deployment Guide.

What Comes Next

Next, you will learn how to handle exceptions, i.e. if you do not recognize any input from the caller or receive input that is not expected.

Lesson 7 – Handling Events