Holiday Check script is a great learning tool!
April 24th, 2014
Most VoIP Engineers are not necessarily Software Engineers, so bringing up a Contact Center and scripting it are usually done by two different types of engineers.   Scripting engineers tend to have backgrounds in software development with formal education in programming structure and practices.  A solid experience in Java, PHP, Perl, SQL and other languages is very different that having a background in IP networking, telecommunications, QOS and MPLS!   That is not to say their are not Engineers that can do it all,  but you can either be a mile wide and an inch deep or an inch wide and a mile deep!  You can't be an expert in everything! Scripting a Contact Center using the CISCO UCCX editor and related tools is an area of  specialization.   Most engineers carry around a basic set of "start up" scripts to get a new UCCX off the ground, but most clients have contact center requirements that require CRM, Website and advance database integration that requires some additional depth of expertise in the area of software development.  Altering call flow based on external data elements is an essential part of any contact center today.  The need to retrieve data from sources outside of the script, or to update sources once the script completes has become  the minimum daily adult requirement for contact center scripting! There is a HolidayCheck script that has been kicking around the CISCO UCCX landscape forever.  We first saw it in the Windows based UCCX before Version 8+.   It is actually a great script as it demonstrates a number of Java elements that are outside the normal cut and paste scripting ability of many newbies.   You will need to understand XML, Xpath, String Manipulation, Date Contractors and some other advanced data handling options that this script uses to modify call flow based on the day being a holiday or not.   For this reason, it makes for an  excellent learning tool if you want to get in their and dig into the details. The  Script uses a simple XML data file containing a list of dates that are declared to be Holidays.   Generally, the script is a sub flow, called on by a parent script to determine if we need to close for the day.   The script first finds out what is the date today, then goes through the XML date list comparing each entry with todays date to make a holiday determination.  If it gets through the entire date list without a match, the returned value is false.  If it finds a match the returned value is true!  Very simple, however the process uses about every programming trick in the book and for that reason it is fun to learn how the script works.  It is highly efficient using less than 15 lines of code to do its magic! We have also found the script to be useful for deriving other uses built on the same constructors.  For example, finding out if we should be open or closed based on the time of day.  The Time of Day Java bean in the UCCX library is great if you want to open and close once on a particular day.  If you want to open at 7AM, close at 11 for lunch, then open again at 1PM and close at 5, it is a bit more difficult.  Creating an XML document with the schedule for a particular CSQ, is a lot more useful!  In fact we can economize on script reuse by pulling CSQ details from a QueueOptions.xml file and dramatically alter the details of a specific CSQ while reusing the same core script!  XML is the way to fly, especially if you can use HTML and web technology to feed your script user specific call flow details like "call me back at this number" please. Do to this kind of scripting you need to have a handle on string manipulation, XML,  data type conversions and Xpath.   For this reason the HolidayCheck script is a great learning tool.   The video walks throughout the details of this script and provides, we hope, some useful instruction.   We don't know who wrote the original script, but it has been plagiarized by us all and it is remarkable when it is studied by those who want to learn its secrets! Members can download the script from the DrVoIP.com site!