Lesson 7 – Handling Events

Objectives

Lesson 7 introduces basic event handling strategies and explains how to add global and context-sensitive event handling to your dialog.

After completing this lesson you will know

·          why event handling items should be defined,

·          how to define global event handling,

·          how to define context-sensitive event handling.

Event Handling Strategies

Event handling specifies how to proceed within a dialog in cases of exceptions. Various kinds of exceptions may occur during a call. Standard events are, for example,

No Input - the caller has been asked for input and none is detected within the timeout interval,

No Match - some input is detected, but that input does not match the underlying grammar.

Event handling can be specified on different levels of your application. At the Module object level, global event handling can be specified. At the subordinate object level, object-specific behavior for events can be set.

In the case of the Life Insurance application you will next add event handling definitions for No Input and No Match.

The event handling for the first occurrence of both events will be defined globally in the Module object with generic responses.

The event handling for a second occurrence of a No Input and No Match event will be defined locally within an Input object providing further, context-sensitive information to the caller.

For further information on advanced event handling see Chapter 8 – Advanced Event Handling in the Design Guide.

Defining a Global No Input Event

To specify a global No Input event for the Life Insurance application, do the following:

1.        In the Dialog Designer or in the Object Browser double-click the Life Insurance Module object. The corresponding Module editor will open up.

2.        Click the Event Handling tab to bring it to the front.

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

4.        In the Output editor, enter a name for the Output object (Global No Input) in the Name field.

5.        In the text area, enter the following output:
Sorry?




6.        On the toolbar of the Output editor, click Save and Close.

7.        Select ASR No Input as event type from the drop-down menu in the Event Type field.

8.        Select If >= 1 as occurrence level from the drop-down menu in the Occurence field. This means that, unless overridden by a higher occurrence level, this output message will be played on the first and all subsequent occurrences of no input.

9.        On the toolbar of the Module editor, click the Save button  to save your current object without leaving its object editor.



For further details on specifying event handling refer to Event Handling in the Object Reference.

Defining a Global No Match Event

To specify a global No Match event for the Life Insurance application, do the following:

1.        Add a second event handling item by clicking the Add button on the Event Handling toolbar.

2.        Click the Context Menu button   to the right of the Object field and select New and then Ouptut. An empty Output editor will open up.

3.        In the Output editor, enter a name for the Output object (Global No Match) in the Name field.

4.        In the text area, enter the following output:
Say again, please?



On the toolbar of the Output editor, click Save and Close.

5.        Select ASR No Match as event type from the drop-down menu in the Event Type field.

6.        Select If >= 1 as occurrence level from the drop-down menu in the Occurence field. This means that, unless overridden by a higher occurrence level, this output message will be played on the first and all subsequent occurrences of input not matching the grammar.



Finally, click Save and Close on the toolbar of the Module editor.

Defining Context-Sensitive Event Handling

Next, you will define event handling definitions for the case that a No Input or No Match event occurs a second time. In such a case, the caller might need some further instruction on what to do.

Context-sensitive event handling for the Prime Life Insurance service will be specified locally within an Input object requesting information from the caller.

To do so, double-click the Ask for age Input object in the Dialog Designer or in the Object Browser. The corresponding Input editor will open up.

Click the Event Handling tab to bring it to the front.

Specify an event handling item for a No Input event with the following parameters:


Field

Parameter

Object

Create a new Output object called Ask for age NI with the output Sorry, I still couldnīt hear you. Please say your age, for example thirty-five.

Event type

ASR No Input

Occurrence

If >=2

 

Specify an event handling item for a No Match event with the following parameters:


Field

Parameter

Object

Create a new Output object called Ask for age NM with the output Sorry, I couldnīt understand you. Just say your age, for example thirty-five.

Event type

ASR No Match

Occurrence

If >=2

 

The Event Handling section of the Ask for age Input object looks like this now:



Finally, click Save and Close on the toolbar of the Input editor.

Dialog Flow 6

After redeploying your service in the Control Center again, call it and test how your application behaves if you say nothing or say something not recognized by the grammar.

The following dialog flow shows an example dialog for the Prime Life Insurance service you have created so far – this time including event handling:


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

No Input 1

Sorry?.


Caller

No Input 2

Sorry, I still couldnīt hear you. Please say your age, for example thirty-five.


Caller

Twenty-eight years (No Match 1)

Say again, please?


Caller

Twenty-eight years (No Match 2)

Sorry, I still couldnīt hear you. Just say your age, for example thirty-five.


Caller

Twenty-eight

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

Thanks for calling. Goodbye!

What Comes Next

Next, you will add a Confirmation object to the Life Insurance application confirming the answers of the caller and, if necessary, correcting them.

Lesson 8 – Confirming Inputs