Tuesday, December 27, 2011

Controlling the CCX script flow based on time and date variables

This post is the second of two that are dedicated to Cisco unified contact center express (UCCXor CCX) scripting. In this one I'll explain how variables can be used for time/date based script control. The first post can be found here. This example was created with a CCX system integrated with Cisco Unified Communication Manager (CUCM) also known as Cisco CallManager.

A common things to do in a UCCX script is to present different option to callers based on the time they are calling. If it's after hours, they should be getting a closed message and the same goes for holidays. Creating a static script behavior that is based on the "time of day" and "day of week" general steps is one way to do that, but it requires script editing whenever there is a change and it requires a script per customer in multiple queue scenario.
Another option is to act based on a database or XML file query, both are valid but require deeper programming skills and premium licensing (for the SQL query option).

There is another option that I have recently used and would like to discuss here. With this option a date variable is defined in the script and compared to other variables (which are also parameters) and the script behavior is determined based on those comparisons. By using parameters, the open/closed hours can be controlled outside of the script from the CCX appadmin interface.

To further explain here is how this can be implemented in order to check for a weekend day and act differently if this is a weekend day.
First define a date variable and call it currentDayTime, make sure it is initialized as D[now] which means it will be set to the current CCX server system time.

This is how it will look in script editor:




Now define two integer variables and set them to be a parameter, those would be used to configure the weekend days. The variables are initialized in the script to 1 and 7 which correspond to Sunday and Saturday, but this can be adjusted to other days since it's a parameter.
The relevant lines in the script editor would look like the following:






In the uccx script use an IF condition to check if the current day is a weekend day and define what to do based on the comparison. Here is how the IF condition would look like:






The xxx.dow method in a date variable represent the day of week in a numeric value of 1 through 7. This IF can be nested to check for public holidays and more variables/parameters for additional functionality. In order to check for the current hour, use the xxx.hod method, which represent the hour of the day in 0 through 23 values.

Clear as mud, right?  :)


Comment if you have questions and I'll be happy to explain.


Friday, December 23, 2011

CCX programming variables and parameters

This is the first of two posts I'm going to dedicate to Contact Center Express programming. This one is going to discuss a fundamental aspect of CCX scripting: variables and variables that are parameters. The second post can be found hereThis example was created with a CCX system integrated with Cisco Unified Communication Manager (CUCM) also known as Cisco CallManager.

This is a basic topic in programming and advanced CCX scripters would probably find it boring, but I'm going to cover it anyway :)

A variable is a memory address which store information that a program is using during its operation, and within a script it can be used to store things like calling number, hour, date and the name of a .wav file to be played. CCX supports many variable types, integers, strings and more.

When a variable is defined as a parameter, the system administrator would have the option to define it outside of the script editor. This is an important functionality because it allows the creation of a generic script that can be used in many situations.

Lets look at an example, the following image shows a script that plays a prompt based on a comparison of the current hour with an integer variable called openHour:



When this script is configure to be an application in CCX admin, the screen will look like the following:


As can be seen, the openHour variable is internal to the application and the administrator cant change its value without editing the script.


In the next example, the exact same script is shown but with the variable configured to be a parameter:


This will change the application config screen to look like the following:


As can be seen, the openHour variable is now exposed to the system admin and can be changed from the CCX admin interface for things like holiday schedule (late opening hour) or temporary extended hours (holiday season shopping support). The grayed out 0 is going to be used as the variable initial value unless the check box near the parameter is selected and a different value is entered in the content field.

The following screen capture shows how the non default screen would look like, as can be seen, the application is smart enough to tell us its an integer type of variable.



That's it on this topic, the next post will be based on this post and expand on date and time based parameters and variables.