I have a working dialplan for our phone system with Mon-Fri, business hours identification, etc. But what I'm lacking right now is support for company holiday dates. What I'd like to do is to create a database of these dates and just update them as new years rollover. I suspect others have done this sort of thing with Asterisk before, but I've not found any resources so far. Does anyone have a suggestion as to how to approach this? I'm running Asterisk 1.4.2. Thanks Myles -- ======================Myles Wakeham Director of Engineering Tech Solutions USA, Inc. Scottsdale, Arizona USA http://www.techsolusa.com Phone +1-480-451-7440
Perhaps make the dates a database entry? The fixed dates would stay the same each year and you would adjust only the floating dates. Or, there are really few holidays in the year. (Unless you are a government or a bank) Simple intercept code in the dialplan would handle most businesses. "Just" write 5-10 cloned lines of date traps in the code to pass the calls or send them to a "closed" handler. That is less disk/system intensive that doing a disk access, except they would likely be in cache anyway. Cary Fitch -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Myles Wakeham Sent: Thursday, December 31, 2009 9:46 AM To: asterisk-users at lists.digium.com Subject: [asterisk-users] Dialplans & Holiday Dates I have a working dialplan for our phone system with Mon-Fri, business hours identification, etc. But what I'm lacking right now is support for company holiday dates. What I'd like to do is to create a database of these dates and just update them as new years rollover. I suspect others have done this sort of thing with Asterisk before, but I've not found any resources so far. Does anyone have a suggestion as to how to approach this? I'm running Asterisk 1.4.2. Thanks Myles -- ======================Myles Wakeham Director of Engineering Tech Solutions USA, Inc. Scottsdale, Arizona USA http://www.techsolusa.com Phone +1-480-451-7440 _______________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> Myles Wakeham wrote: <blockquote cite="mid:4B3CC750.5050301@techsol.org" type="cite"> <pre wrap=""> I suspect others have done this sort of thing with Asterisk before, but I've not found any resources so far. </pre> </blockquote> <br> <font face="Courier New, Courier, monospace">exten => 317xxxxxxx,1,Gosub(holiday_check,s,1)<br> <br> <br> [holiday_check]<br> <br> ;********************************<br> ;* Break out current 2 digit month<br> ;********************************<br> <br> exten => s,1,Gosub(todays_date,s,1)<br> <br> ;*****************************************<br> ;* Look for database entry for match against<br> ;* month and day. Store sound file name<br> ;* to GREETING variable<br> ;*****************************************<br> <br> exten => s,n,MYSQL(Connect connid localhost anonymous '' holidays)<br> exten => s,n,GosubIf($["${MYSQL_STATUS}" = "-1"]?mysql_failed,s,6)<br> exten => s,n,MYSQL(Query resultid ${connid} SELECT greeting FROM schedule WHERE month = ${MONTH} AND day = ${DAY})<br> exten => s,n,MYSQL(Fetch fetchid ${resultid} GREETING)<br> exten => s,n,MYSQL(Disconnect ${connid})<br> exten => s,n,MYSQL(Clear ${resultid})<br> <br> ;*******************************************<br> ;* If GREETING <> *BLANK, must be a holiday<br> ;* jump to s,10. Else return from subroutine<br> ;*******************************************<br> <br> exten => s,n,GotoIf($["${GREETING}" != ""]?9:13)<br> <br> ;********************************<br> ;* Play Holiday message and return<br> ;* from subroutine<br> ;********************************<br> <br> exten => s,n,Wait(2)<br> exten => s,n,Playback(local/holidays/greet_begin)<br> exten => s,n,Playback(local/holidays/${GREETING})<br> exten => s,n,Set(_Holiday=YES)<br> exten => s,n,Return<br> <br> <br> [todays_date]<br> <br> ;********************************<br> ;* Break out current 2 digit hour<br> ;********************************<br> <br> exten => s,1,Set(HOUR=${STRFTIME(${EPOCH},,%H)})<br> <br> ;********************************<br> ;* Break out current 2 digit day<br> ;********************************<br> <br> exten => s,n,Set(DAY=${STRFTIME(${EPOCH},,%d)})<br> <br> ;********************************<br> ;* Break out current 2 digit month<br> ;********************************<br> <br> exten => s,n,Set(MONTH=${STRFTIME(${EPOCH},,%m)})<br> <br> ;********************************<br> ;* Break out current 4 digit year<br> ;********************************<br> <br> exten => s,n,Set(YEAR=${STRFTIME(${EPOCH},,%Y)})<br> <br> ;********************************<br> ;* Set TODAY to DAY/MONTH/YEAR<br> ;********************************<br> <br> exten => s,n,Set(TODAY=${MONTH}/${DAY}/${YEAR})<br> <br> exten => s,n,Return()<br> <br> </font><br> </body> </html>
When it is running, nerdvittles.com is an excellent resource for this kind of question. Voip-info.org is almost always up and has more technically oriented answers to this type of query. -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Myles Wakeham Sent: Thursday, December 31, 2009 9:46 AM To: asterisk-users at lists.digium.com Subject: [asterisk-users] Dialplans & Holiday Dates I have a working dialplan for our phone system with Mon-Fri, business hours identification, etc. But what I'm lacking right now is support for company holiday dates. What I'd like to do is to create a database of these dates and just update them as new years rollover. I suspect others have done this sort of thing with Asterisk before, but I've not found any resources so far. Does anyone have a suggestion as to how to approach this? I'm running Asterisk 1.4.2. Thanks Myles -- ======================Myles Wakeham Director of Engineering Tech Solutions USA, Inc. Scottsdale, Arizona USA http://www.techsolusa.com Phone +1-480-451-7440 _______________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users