Scripting help - Time of day routing for specific dates

Unanswered Question
Sep 24th, 2009

I need to be able to route calls based on time of day and the date (for holidays, etc.). For example, one department is open from 8am-1pm on Labor Day. The generic holiday.aef and holiday file for AMPM does not work in this case. Any suggestions?



I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Steven Griffin Mon, 09/28/2009 - 09:24

If you write a lot of scripts you'll want to create a subflow for this kind of thing. You can use it over and over again.

The built-in Java date/time and calendar classes are broken and esentially useless. My suggestion is to abandon them and use a third-party class library. Personally I use the Joda Time class library in my UCCX scripts and it works like a charm.

>>The built-in Java date/time and calendar classes are broken and esentially useless.

I'll debate this.

The Java Gregorian Calendar class is a complete specification. It's not broken - it just takes a little bit of work to learn how to use, because it has capabilities way beyond the typical IVR programming.

The Date/Time class that the IVR scripts use is a deprecated class - but that's a Cisco issue, and anyway, it still works.



Steven Griffin Fri, 10/02/2009 - 13:01


It may be a complete specification but it is unwieldy to use and it has a host of quirks and buggy behaviors. I am not the only one who thinks this way. A Google search will turn up a host of rants and raves about the class which are too numerous to mention and much better articulated.

However, I will give my personal gripe with the Calendar class which is that you cannot perform date comparisons or do any useful date/time math using the definitions supplied to the objects themselves. The Calendar class always uses the local date/time of the system it is running. So, to compare two objects who have different time zone values you must first generate printable output and then do your own math on it.

Why the class cannot be smart enough to subtract two date objects or tell me if one date object is greater than another is simply unacceptable to me. I frequently need to open / close call centers in different time zones where the UCCX server may be in the America/Los_Angeles timezone and the call center is in America/Denver. It requires way too much coding to do this in the Calendar class (using UCCX scripting or in just plain Java itself.) The Joda Time class has this all built-in and it is quite simple and intuitive to use.

I am afraid I must dissent here and continue to assert that the Calendar class is broken and useless.

jmorlan Mon, 10/05/2009 - 15:14

Would you be willing to post some example scripts of yours on opening and closing using Joda?


Steven Griffin Mon, 10/05/2009 - 15:23

Not quite up to me. There are questions of intellectual property and all that I'll have to get cleared.

Henrik Larsen Thu, 10/01/2009 - 05:11

Hi Tom

We have a solution where opening hours is checked by subscript. This script checks current date/time against 2 XML files. First file contains Holidays and if date/time dosn't match here, second XML file with normal opening hours (mon-sun)

Both files contain upto 3 different open time definitions with corresponding welcome/close prompts.

Depending on returned values from subscript, main script can act as requested.

Example for dec. 24, where subscript would return closed, since no time is defined but date is matched(99 states the function is not used)



















Hope this can give some inspiration



This Discussion