cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

AMA-CUCM Troubleshooting: Best Practices for Reading Trace Files

409
Views
10
Helpful
8
Replies
Beginner

Using Call Studio to Set Local Time Based on Local Timezone in Order to Route Calls

Hello all,

I am trying to find an easier way to route a call based on time of day in Call Studio. 

The issue is our ICM servers are in an American time zone, but the call centers that open and close are located around the globe using different time zones.  Hence, when time changes in Denver at 2:00AM, the time suddenly "jumps" in Europe so it is an hour later, and the call centers may be set to open an hour earlier than they should.

I have dealt with this in ICM with a complex set of admin scripts to deal with the time change, but it is a pain to do this for every branch/call center I add to our solution.

I could do something similar in Call Studio (using decision elements and set elements to eventually set a local time) but I thought there may be an easier way to set the local time.

Does anyone have a better solution they would be willing to share?

I have no experience with custom java elements, but could I use one to set the local time?

 

Thank you.

8 REPLIES 8
Participant

Re: Using Call Studio to Set Local Time Based on Local Timezone in Order to Route Calls

I am curious about this as well....Global Daylight Savings time is a pain!

 

 

 

 

Please remember to rate useful posts, click on the stars below.
Beginner

Re: Using Call Studio to Set Local Time Based on Local Timezone in Order to Route Calls

I wanted to reply to this so people with the same problem can at least see what I did to deal with time zones and day light savings. 

 

This is a long reply, and contains a lot of material.  This took me a long time to create, but I can quickly copy and paste this into a new call studio script to deal with time zones in every country.  I only need to adjust the local DST rules.

 

I create 2 action elements.

In one of them I define some variables to see the offset in hours during DST and to see if DST is in effect.  I need to look up the rules for each location to see when DST starts and finishes.  I use a local variable define by a java script to set DST active or not.

If DST is active, I set a DST offset to 1 (the hours to add to the local time during DST)

The java script below is for Australia

 

I then have another action element and use some java scripts to set the local date, hour, and day.

I use the date script to later compare the local date to a holiday xml file.

(I even make allowance for leap years)

 

 

 

image.png

 

 

image.pngimage.png

*******************************************

var today = new Date();
DST = 0; // 0 for off 1 for on
dday = today.getDay(); //0-6 with 0=sunday
ddate = today.getUTCDate();
dhour = today.getUTCHours()+Number({Data.Session.S_UTC_Offset});
dmonth = today.getMonth()+1;

 

if (dhour >= 24) // correct day month and year for time difference
{
ddate = Number(ddate) + 1;
}
if (ddate >= 32 && ((dmonth == 1)|| (dmonth == 3)||(dmonth == 5)||(dmonth == 7)||(dmonth == 8)||(dmonth == 10)))
{
ddate = 1;
dmonth = Number(dmonth) +1;
}
if (ddate >= 31 && ((dmonth == 2)|| (dmonth == 4)||(dmonth == 6)||(dmonth == 9)||(dmonth == 11)))
{
ddate = 1;
dmonth = Number(dmonth) +1;
}

if (dhour >= 24)
{
dday = Number(dday) + 1;
if (dday > 6.0)
{
dday = 0;
}
}

if (dmonth >= 5.0 && dmonth <= 8.0){
DST = 0;
}
if (dmonth >= 10.0 && dmonth <= 12.0)
{
DST = 1;
}

if (dmonth >= 1.0 && dmonth <= 3.0){
DST = 1;
}
if (dmonth == 4.0)
{
if ((Number(ddate)-1) >= dday){
DST = 0;
}
if ((Number(ddate)-1) < dday){
DST = 1;
}
}
if (dmonth == 9.0)
{
if ((Number(ddate)-25) >= dday){
DST = 1;
}
if ((Number(ddate)-25) < dday){
DST = 0;
}
}

DST

 

 

*****************************************

 

I then have another action element and use some java scripts to set the local date, hour, and day.

Here is what I use for the local date

(I used to compare to a holiday xml file)

 

 

***************************

var today = new Date();
var dateString;
ddate = today.getUTCDate();
dhour = today.getUTCHours()+ Number({Data.Session.S_UTC_Offset})+Number({Data.Session.S_DST});
dmonth = today.getMonth()+1;
dyear = today.getUTCFullYear();
if (Number(dhour) >= 24) // correct day month and year for time difference
{
ddate = Number(ddate) + 1;
}
if (dhour <= 0)
{
ddate = Number (ddate) -1;
}
if (ddate >= 32 && ((dmonth == 1)|| (dmonth == 3)||(dmonth == 5)||(dmonth == 7)||(dmonth == 8)||(dmonth == 10)))
{
ddate = 1;
dmonth = Number(dmonth) +1;
}
if (ddate >= 31 && ((dmonth == 2)|| (dmonth == 4)||(dmonth == 6)||(dmonth == 9)||(dmonth == 11)))
{
ddate = 1;
dmonth = Number(dmonth) +1;
}
if (ddate >= 32 && dmonth == 12)
{
ddate = 1;
dmonth = Number(dmonth) + 1;
dyear = Number(dyear) + 1;
}
if (ddate < 1 && ((dmonth == 2)|| (dmonth == 4)||(dmonth == 6)||(dmonth == 8)||(dmonth == 9)||(dmonth == 11)))
{
ddate = 31;
dmonth = Number(dmonth) - 1;
}
if (ddate < 1 && ((dmonth == 3)|| (dmonth == 5)||(dmonth == 7)||(dmonth == 10)||(dmonth == 12)))
{
ddate = 1;
dmonth = Number(dmonth) +1;
}
if (ddate < 1 && dmonth == 1)
{
ddate = 31;
dmonth = 12;
dyear = Number(dyear) - 1;
}
if ((dyear%400==0 || dyear%100!=0) && (dyear%4==0)) //check for leap year
{
if (ddate >= 30 && dmonth == 2)
{
ddate = 1;
dmonth = Number(dmonth) +1;
}

}else
{
if (ddate >= 29 && dmonth == 2)
{
ddate = 1;
dmonth = Number(dmonth) +1;
}
}

dateString = ddate.toString()+"/"+dmonth.toString()+"/"+dyear.toString();


dateString

 

**************************************************

 

 

Day of the week

 

***************************************

var today = new Date();
dHour = today.getUTCHours()+ Number({Data.Session.S_UTC_Offset})+Number({Data.Session.S_DST}); //0-23
var dDay = today.getDay(); //0-6 with 0=sunday
if (dHour >= 24)
{
dDay == Number(dDay) + 1
if (dDay > 6.0)
{
dDay = 0;
}
}
if (dHour < 0)
{
dDay == Number(dDay) - 1
if (dDay < 0.0)
{
dDay = 6.0;
}
}

dDay

*************************************************

Local Hour

 

*************************************************

var today = new Date();
dhour = today.getUTCHours()+ Number({Data.Session.S_UTC_Offset})+Number({Data.Session.S_DST}); //0-23
if (dHour >= 24)
{
dHour = Number(dhour) - 24;
}
if (dHour < 0)
{
dHour = Number(dhour) + 24;
}
dHour

 

**************************************************

 

 

 

Rising star

Re: Using Call Studio to Set Local Time Based on Local Timezone in Order to Route Calls

I ended up creating a custom function that did the DST timeset for me... took me forever to do it. The drawback is that I could only put 5 years' worth of DST. Had to do this for a customer that basically has an office in well over 50 countries. This worked really good for a solid 3-4 years, but supervisors started to complain that they wanted the ability to dictate that, especially when some countries would either move or cancel DST all together. What we ended up doing is bringing in Aceyus director where we can do all this from a single pane of glass and allow supervisors to control time, holidays, etc... eGain has a similar product. Cisco has built a similar application for CCX 12 and I'm hoping there's a roadmap to bring it to CCE.

 

What you did is really cool and I appreciate you sharing it

Collaborator

Re: Using Call Studio to Set Local Time Based on Local Timezone in Order to Route Calls

Most partners have an hours of operations application and honestly that's the only way to go. You don't even need to enable the ability for users to modify the hours, but just having this in a DB will make your life so much easier. Trying to do this with CVP code or a function is really a short term solution or a solution for a center which doesn't span too many time zones.

 

david

Rising star

Re: Using Call Studio to Set Local Time Based on Local Timezone in Order to Route Calls

A lot of customers don't want to pay for that application :)
Collaborator

Re: Using Call Studio to Set Local Time Based on Local Timezone in Order to Route Calls

Yeah specially when a partner is going to charge them $10K+ for something which they already wrote. We created one which we sell for a lot less. I still think that customers not understanding the value of giving their staff control over close/open hours will save so much IT time the ROI will be achieved in 12 months or less.

 

I'm looking forward to playing with what Cisco built for 12 and hope it's good.

 

david

Contributor

Re: Using Call Studio to Set Local Time Based on Local Timezone in Order to Route Calls

It's PCCE only unfortunately, and don't think it will give you all that you're looking for.

Highlighted
Beginner

Re: Using Call Studio to Set Local Time Based on Local Timezone in Order to Route Calls

It took me a lt of work for the initial set up. However, now that I have it finished, I just need to set a couple of variables and perhaps change the rules that reflect how a county decides when/if to use DST.

Adding a new location takes a few minutes as it is copy and paste. Adding a new country that uses a nes set of rules for when DST comes into effect takes about an hour.
CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards