Lesson 9 introduces the concept of layers, which is a basic feature of VoiceObjects, and explains how to create a simple custom layer changing the dialog behavior depending on the hour of day the call comes in.
After completing this lesson you will know
· how to create a Layer object having different states,
· how to implement a layer into an application.
Layers are an integral part of the VoiceObjects platform. They allow designers to easily separate the core dialog logic from the way an application is presented. Layers can influence aspects such as language, channel and persona, but they can also change the application behavior itself. For instance, a menu can have additional choices for gold customers depending on specific profile data available to the application, or certain application features can be disabled outside normal business hours.
VoiceObjects provides standard layers, the so-called system layers such as language, input mode or channel, which are frequently required in applications and need not be implemented manually. They are present in many objects and can readily be used within the corresponding object editors. All other layers, which are rather application-specific such as persona, caller preferences, service level, etc., are each defined within a single Layer object.
For a detailed description of using layers see Chapter 7 - How to Use Layers in the Design Guide.
For a detailed description of the Layer object see Layer in the Object Reference.
In the case of the Life Insurance application, a time-dependent custom layer will be implemented to simply welcome the caller according to the time of the day (e.g. good morning, good evening). A more sophisticated application would probably use such a layer to also modify the application behavior according to the time of the day, i.e. to transfer the caller to an agent during the business hours only.
The layer is implemented through a Layer object. In the Layer object you specify a specific custom layer for an application by listing all states the corresponding layer can be in.
In the case of the Life Insurance application, there will be three possible states, one for the morning, one for the afternoon and one for evening.
To create the Layer object for the Life Insurance application, do the following:
1. From the New menu, select Layer. An empty Layer editor will open up.

2. In the Layer editor, enter Time of day as the name for the new Layer object.
In the State Indicator section the indicator is specified, that determines which state of the layer is used. This is typically done with a Variable or Expression object.
In the case of the Life Insurance application, the layer state depends on the hour of day when the call comes in. This is retrieved through an Expression object with the function NOW returning the current time.
1. In the State Indicator section, enter an Expression object into the Object field by selecting New and then Expression from the context menu. An empty Expression editor opens up.
2. Enter Hours of day into the Name field of the Expression editor.
3. From the drop-down list in the Function field, select NOW (belonging to the Date and Time functions) and in the Arg. (1) field enter HH to specify the format as hours. For detailed information on expression functions see Expression in the Object Reference.

4. On the toolbar, click Save and Close. The Hours of day Expression object will be linked into the Object field of the State Indicator section.

For detailed information on Expression objects see Expression in the Object Reference.
Next, specify the states.
The States section lists all states the layer can be in. Specify one state for the morning, one for the afternoon and one for the evening.
1. In the State ID field of the first State section, enter morning.
The state ID is obligatory and identifies a state within a layer. It must be unique across the project, i.e. there cannot be two states – independent of the Layer object – with the same state ID in your project. State IDs must not contain blanks or other special characters except hyphens or underscores.
The label is used for display purposes of layer states outside the Layer editor. In all editors that allow you to associate layer conditions, the label is shown instead of the state ID. If you do not specify a label, the state ID is copied into this field when saving the Layer object.
When defining a layer by means of a state indicator, a value or a comma-separated list of values is entered into the Indicator value field to compare the content of the state indicator object with. If the content of this object is equal to one of the indicator values, then this state is an active state of the layer.
2. Enter 01,02,03,04,05,06,07,08,09,10,11 into the Indicator values field as an indicator for the layer state morning (activated for all calls between 01:00h and 11:59h).

3. Specify a second state with afternoon as State ID and 12,13,14,15,16,17 as indicator value (for all calls between 12:00h and 17:59h).
4. Specify a third state with evening as State ID and 18,19,20,21,22,23,24 as indicator value (for all calls between 18:00h and 00:59h).
Your States section will look like this now (all State boxes minimized):

5. Finally, click Save and Close on the toolbar of the Layer editor.
In the Object Browser you will now find a Layers folder, containing your Time of day Layer object with three states.
You can now use the Time of day Layer object to change the behavior of your dialog depending on the time the call comes in. During this Tutorial we will just adapt the welcome message to the time of the day so we need to modify the Welcome Output object, which is linked as the welcome message into the Life Insurance Module object, accordingly.
1. Open the Welcome Output object and click the Context Menu button
to the right of the Layer field of the Output item. Select the Time of day Layer object listed at the end of the context menu and from the submenu select morning as the layer state for this Output item.

2. In the text field, modify the welcome message to Good morning and welcome to the Prime Life Insurance service!.
3. Add a second Output item to the Output section by clicking the Add button
. Again, link the Time of day Layer object into the Layer field, this time selecting the layer state afternoon as its value.
4. Enter Good afternoon and welcome to the Prime Life Insurance service! into the text field of the second Output item.
5. Add a third Output item to the Output section and link the Time of day Layer object into the Layer field, this time selecting the layer state evening as its value.
6. Enter Good evening and welcome to the Prime Life Insurance service! into the text field of the third Output item.
The Welcome Output object looks like this now (one Output item minimized for display purposes):

Finally, click Save and Close on the toolbar of the Output editor.
You have now specified three different welcome messages, which will be selected during the call depending on the time of day.
You have now enhanced the Life Insurance application, providing slightly different dialog behavior for the morning, afternoon and evening by creating and adding a custom layer.
Depending on the hour of day when the call comes in the caller will hear a different welcome message.
After redeploying your service in the Control Center, call it and test this behavior. You will most probably hear either the welcome message for the morning state or for the afternoon state depending on when you are calling.
Use a Variable object containing a fix value as state indicator instead of the expression function NOW if you want to test the other states.
The following call flow shows an example dialog for the Prime Life Insurance service for calls between 12:00h and 17:59h – i.e. for callers calling in the afternoon:
|
Object – Caller |
Dialog Flow |
|
|
Good afternoon and 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. … |
Next, we will add a Script object to the Life Insurance application in order to calculate the life insurance fee.