[cisco-voip] UCCX Script to get Time Zone by Area Code
Ben Amick
bamick at HumanArc.com
Tue Jan 24 09:21:48 EST 2017
Let us not forget about the issues about this that would follow along with DST, as some areas do follow DST, others don’t, others stay permanently on DST, and so on. It’s a very intricate list of alterations every 6 months.
Ben Amick
Telecom Analyst
From: cisco-voip [mailto:cisco-voip-bounces at puck.nether.net] On Behalf Of Tanner Ezell
Sent: Tuesday, January 24, 2017 9:12 AM
To: Anthony Holloway <avholloway+cisco-voip at gmail.com>
Cc: cisco-voip at puck.nether.net
Subject: Re: [cisco-voip] UCCX Script to get Time Zone by Area Code
To add to that fun, some states have multiple timezones!
I completely agree with Anthony regarding his first point, I myself have a cell phone with a phone number thats about 15 years old and I don't live anywhere near it. If you go this route, consider this as a helper, rather than an absolute and confirm with the user at some point.
On Mon, Jan 23, 2017 at 10:05 PM, Anthony Holloway <avholloway+cisco-voip at gmail.com<mailto:avholloway+cisco-voip at gmail.com>> wrote:
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<http://cp.mcafee.com/d/FZsSd6Qm7DQT1O8V4TsSyyO-OCe78CzASyyO-OCeuvpdEEILLfzDDT3qabxEVd7dXThKr8qHaNk54SRtxIrsKr9JGX3oSVsSPZT1PPP_nV4ttUsqejhOzRXBQSnTepKMZtxNPG8FHnjlKqenKl3PWApmU6CQjoUTvHEEzD61RTPhOrKr9PCJhbc-7695pbuxbu00UoAlBwlBioHlQl1BoP9yEwHYpmS0G36Ri7NB0yaxo_o2KN_hmRkfE1wjxavE2ENfp_gTqlblbCqOmbAaJMJZ0kIToHMd9_7wqrjKMO-r1vF6y0QJSBiRiVCIBziWq80C92g36y0oJ6iQPh1eFEw8_cQg0CiLCy02qMYQg42NEw48_FEw4GEurvudFIyIBaOc>
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<mailto: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<tel:(443)%20541-1518>
Facebook<http://cp.mcafee.com/d/2DRPoO86Qm7DQT1O8V4TsSyyO-OCe78CzASyyO-OCeuvpdEEILLfzDDT3qabxEVd7dXThKr8qHaNk54SRtxIrsKr9JGX3oSVsSPZT1PPP_nV4ttUsqejhOzRXBQSnTepKMZtxNPG8FHnjlKqenKl3PWApmU6CQPoUTvHEEzD61RTPhOrKr9PCJhbcasXJL8lGlVv2vDOH2vS9AE-WsjfdSBiRiVCIByV2Hsbvg5bdSaY3ivNU6CQXIcLCMnWhEwdbtFkJkKpH9oQKCy09ygA0NEw6bhAJcQgjGq82fPd409AHVEw0CIfd410Iq812fWq81aG7CTTzpXxCnasI> | Twitter<http://cp.mcafee.com/d/1jWVIe3x0SyMY-CUeh78CXCQkmnSkNMV4QsCQkmnSkNPPX9J55BZVYsY-Urhhsd79EVLuWdPp3lpmawECSHIdzrBPpdJnor6TbCSvKUeuuvW_8zHL3zhOqekuLsKCO-VPdS7HIeeth5dqWqJPhOZOEuvkzaT0QSOr76XZt54sUMeK-qejtPpesRG9pAP4FP-fbU5_fBm09-NcTqlblbCqOmbAaJMJZ0kIToHMd9_7wqrjKMO-r1vF6y0QJSBiRiVCIBziWq80C92g36y0oJ6iQPh1eFEw8_cQg0CiLCy02qMYQg42NEw48_FEw4GEurvudWLT8EaVe> | LinkedIn<http://cp.mcafee.com/d/avndy0Orhouvjs78zAjtPqabbXaoUsyqejqabbXaoVVZASyyO-Y-euvsdEEK6zAQsTLt6VIxGIH5gkjrlS6NJOVICSHIdzrBPrfTs7fffZvAhRTxNEVd7afnKnjpvsVCX3RS77eEyCJtdmVEVuVkffGhBrwqrodzzt-Kyyeso7nvd79KVIDeqR4IMFNYE5vgB3BYnmS1r2vDOH0LfX4UlfGhBZ2kUBjFRm5oqp5itlvdSBiRiVCIByV2Hsbvg5bdSaY3ivNU6CQXIcLCMnWhEwdbtFkJkKpH9oQKCy09ygA0NEw6bhAJcQgjGq82fPd409AHVEw0CIfd410Iq812fWq81aG7CTTzsDx8N0OJ> | G+<http://cp.mcafee.com/d/FZsS92gOd21J5xVZdMsyehdTdEEILIFzxO9EVdEEILIFzDDSjqabbXPUVVZMSyyUqejhPuZQrCO6GOIl1hdJnor6TbCOrqKMSdKndI_tMsYY_R-h7nu76zAQsEZuVtdBZPCrIfnossWyaqRQRrCzBXBgY-F6lK1FJYSedTWWa8VNwttYQsCXCOsVHkiP5zSWshHkyv_bU04b-vaI9_oD2FZicLFyRqjErJaBGBPdpb5O5mUm-wamrIlU6A_zMddFTopvdwLQzh0qmXiFqFsPmiNFtd40j4x81zh0cmz9qpEwDkQg4vCq80j9nPh01douq821oQg24vQQg2lkfdLL6NjI5eiyBKfGg>
_______________________________________________
cisco-voip mailing list
cisco-voip at puck.nether.net<mailto:cisco-voip at puck.nether.net>
https://puck.nether.net/mailman/listinfo/cisco-voip<http://cp.mcafee.com/d/1jWVIg41ESyMY-CUeh78CXCQkmnSkNMV4QsCQkmnSkNPPX9J55BZVYsY-Urhhsd79EVLuWdPp3lpmawECSHIdzrBPpdJnor6TbCSvKUeuuvW_8zHL3zhOqekuLsKCO-VPdS7HIeeth5dqWqJPhOZOEuvkzaT0QSUr76XZt54sUMeK-qejtPpesRG9pyPtyL0QDYu1K2qKMM-l9OwXnbiFqFsPmiNKQGmGncRAIn8lrxrW0FpKNnwqj-f0QSDtxBYS2_id41FrJaBGBPdpb6BQQg1ci4w6d40NqcBFCy2tjh0h-pEw1cBvd404RxVEw85zh08h_jh09lgYS-Yrvce_>
_______________________________________________
cisco-voip mailing list
cisco-voip at puck.nether.net<mailto:cisco-voip at puck.nether.net>
https://puck.nether.net/mailman/listinfo/cisco-voip<http://cp.mcafee.com/d/5fHCNASyMY-CUeh78CXCQkmnSkNMV4QsCQkmnSkNPPX9J55BZVYsY-Urhhsd79EVLuWdPp3lpmawECSHIdzrBPpdJnor6TbCSvKUeuuvW_8zHL3zhOqekuLsKCO-VPdS7HIeeth5dqWqJPhOZOEuvkzaT0QSedzzt-Kyyeso7nvd79KVIDeqR4INpKNnwqj-f0T1dnoovaAVgtHBFkJkKpH9oTqlblbCqOmbAaJMJZ0kIToHMd9_7wqrjKMO-r1vF6y0QJSBiRiVCIBziWq80C92g36y0oJ6iQPh1eFEw8_cQg0CiLCy02qMYQg42NEw48_FEw4GEurvudW_VmBBP8>
Confidentiality Note: This message is intended for use only by the individual or entity to which it is addressed and may contain information that is privileged, confidential, and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://puck.nether.net/pipermail/cisco-voip/attachments/20170124/ec7ef0c6/attachment.html>
More information about the cisco-voip
mailing list