[cisco-voip] UCCX Script to get Time Zone by Area Code
Anthony Holloway
avholloway+cisco-voip at gmail.com
Tue Jan 24 00:05:55 EST 2017
I have never done this before.
Seems to me like there are two major hurdles here:
1) How do you know that the caller is actually in that timezone at the time
of the call? For instance, I could be visiting a relative in another
state/timezone, but using my cell to call in, OR I could be using their
home phone, but trying to schedule service in my home timezone.
Furthermore, business SIP Trunks are national DID serviced, and I could
call "from anywhere in the country" from my office SIP trunk.
2) How will you keep the data current? The best option is to let someone
else keep the data current and subscribe to their web api service.
However, from a quick glance, no one is mapping area code to timezone,
rather it seems to be lat/long to timezone. So, you need to pull twice: 1)
area code to lat/long (if that even exists), 2) lat/long to timezone. But
then what will you do when that service is discontinued?
I guess, if nothing else, you could roughly divide up the country's
timezones by state borders, and for those border areas, they get to
suffer +/- 1 hour to ease your administration.
E.g.,
Scrap the small south west corner of North Dakota that's in Mountain Time
and just make the entire ND state in Central Time.
The only states you'd "really" be messing with are:
OR, ID, ND, SD, NE, KY, TN, FL
All the rest are practically, or exactly, in one single timezone.
Just make a decision on a heat map of population density, or timezone
coverage to see which way you go in those borderline states.
And now you can create mapping for state to timezone approximations with
just four simple String variables, and four simple If steps like this:
*String eastern_states = "NY,NJ,MD,etc.";*
*String central_states = "ND,SD,NE,etc..";*
*String mountain_states = "MT,AZ,ID,etc.";*
*String pacific_states = "WA,CA,NV,etc.";*
*if (eastern_states.contains(calling_state)) {*
* /* Eastern TimeZone State */*
*}*
*if (central_states.contains(calling_state)) {*
* /* Central TimeZone State */*
*}*
*if (mountain_states.contains(calling_state)) {*
* /* Mountain TimeZone State */*
*}*
*if (pacific_states.contains(calling_state)) {*
* /* Pacific TimeZone State */*
*}*
But you'll still have to convert area code to state first , so, pull up the
list of area codes by state on wikipedia:
https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes#United_States
And get to creating your area code to state mapping. This one is a little
bigger data set, so maybe not a String variable setup like above, but
rather a nice little XML file? TIP: Notepad++ Regex Find/Replace, or if
you're feeling really progressive, periodic Python web scraping, which
generates the XML for you.
*<?xml version="1.0" encoding="UTF-8"?>*
*<area_codes>*
* <area_code id="612">MN</area_code>*
* ...etc... *
*</area_codes>*
*calling_state = Get XML Document Data ("//area_code[@id="' + area_code +
'"]")*
On Mon, Jan 23, 2017 at 3:12 PM Matthew Loraditch <
MLoraditch at heliontechnologies.com> wrote:
> Anyone ever written one of to get Time zone from Caller ID area code? I
> know how it would work, but hoping maybe there is a template (especially
> for the database side somewhere)
>
>
>
> Matthew G. Loraditch – CCNP-Voice, CCNA-R&S, CCDA
> Network Engineer
> Direct Voice: 443.541.1518 <(443)%20541-1518>
> [image: Email_Sig_Template_H_shortcopy_UPDATED]
>
> Facebook <https://www.facebook.com/heliontech?ref=hl> | Twitter
> <https://twitter.com/HelionTech> | LinkedIn
> <https://www.linkedin.com/company/helion-technologies?trk=top_nav_home> |
> G+ <https://plus.google.com/+Heliontechnologies/posts>
>
>
> _______________________________________________
> cisco-voip mailing list
> cisco-voip at puck.nether.net
> https://puck.nether.net/mailman/listinfo/cisco-voip
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://puck.nether.net/pipermail/cisco-voip/attachments/20170124/395e1922/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 3985 bytes
Desc: not available
URL: <https://puck.nether.net/pipermail/cisco-voip/attachments/20170124/395e1922/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 3985 bytes
Desc: not available
URL: <https://puck.nether.net/pipermail/cisco-voip/attachments/20170124/395e1922/attachment-0001.jpg>
More information about the cisco-voip
mailing list