This has been on my ToDo list far too long. I have a small call-center setup, with basic time of day/day of week validation before putting callers in the queues. With the holidays upon us, I need to add check to see if 'today' is a holiday so I do not put callers in unmanned queues. Due to how the agents work, I have to allow joinwhenempty. Does anyone have a snippet of dialplan code, perhaps using Astdb, to check it 'today' is a listed holiday? Thanks, Dan
Tilghman Lesher
2008-Dec-23 19:35 UTC
[asterisk-users] Dailplan code for holiday detection?
On Tuesday 23 December 2008 12:11:41 Dan Austin wrote:> This has been on my ToDo list far too long. > > I have a small call-center setup, with basic > time of day/day of week validation before putting > callers in the queues. > > With the holidays upon us, I need to add check to > see if 'today' is a holiday so I do not put callers > in unmanned queues. Due to how the agents work, I have > to allow joinwhenempty. > > Does anyone have a snippet of dialplan code, perhaps using > Astdb, to check it 'today' is a listed holiday?Astdb is a nice idea. Something along the lines of: GotoIf(0${DB(holiday/${STRFTIME(,,%Y-%m-%d)})}?holiday,s,1) would work. Holidays are evaluated as "01", which is true. Anything not in the database would be evaluated as "0", which is false. This will work both for holidays where the date changes every year (e.g. Thanksgiving, Labor Day), as well as holidays where it doesn't (e.g. Christmas, Independence Day). -- Tilghman
Scott L. Lykens
2008-Dec-23 21:14 UTC
[asterisk-users] Dailplan code for holiday detection?
Not the most elegant but since I have a generic context for my IVRs I simple check the date there. exten => s,n,GotoIfTime(*|*|1|jan?closed-holiday|1) exten => s,n,GotoIfTime(*|*|10|apr?closed-holiday|1) exten => s,n,GotoIfTime(*|*|25|may?closed-holiday|1) exten => s,n,GotoIfTime(*|*|3|jul?closed-holiday|1) exten => s,n,GotoIfTime(*|*|7|sep?closed-holiday|1) exten => s,n,GotoIfTime(*|*|26|nov?closed-holiday|1) exten => s,n,GotoIfTime(*|*|27|nov?closed-holiday|1) exten => s,n,GotoIfTime(*|*|25|dec?closed-holiday|1) exten => s,n,GotoIfTime(*|*|26|dec?closed-holiday|1) exten => closed-holiday,1,Background(ivr-closed-holiday-${AUTOATTENDANT}||) exten => closed-holiday,n,Hangup This is next year's holidays for us but with this year's Christmas days in it. sl
On Tue, 2008-12-23 at 10:11 -0800, Dan Austin wrote:> This has been on my ToDo list far too long. > > I have a small call-center setup, with basic > time of day/day of week validation before putting > callers in the queues. > > With the holidays upon us, I need to add check to > see if 'today' is a holiday so I do not put callers > in unmanned queues. Due to how the agents work, I have > to allow joinwhenempty. > > Does anyone have a snippet of dialplan code, perhaps using > Astdb, to check it 'today' is a listed holiday? > > Thanks, > Dan >Here is a little script I use on my home system; There are others on http://voip-info.org/wiki/view/AEL+Example+Snippets ifTime(*|*|20-25|dec) { Playback(greetings/christmas); } else ifTime(*|*|31|dec) { Playback(greetings/newyear); } else ifTime(*|*|1|jan) { Playback(greetings/newyear); } else ifTime(*|*|14|feb) { Playback(greetings/valentines); } else ifTime(*|*|17|mar) { Playback(greetings/stPat); } else ifTime(*|*|31|oct) { Playback(greetings/halloween); } else ifTime(*|mon|15-21|jan) { Playback(greetings/mlkDay); } else ifTime(*|thu|22-28|nov) { Playback(greetings/thanksgiving); } else ifTime(*|mon|25-31|may) { Playback(greetings/memorial); } else ifTime(*|mon|1-7|sep) { Playback(greetings/labor); } else ifTime(*|mon|15-21|feb) { Playback(greetings/president); } else ifTime(*|sun|8-14|may) { Playback(greetings/mothers); } else ifTime(*|sun|15-21|jun) { Playback(greetings/fathers); } else { Playback(greetings/hello); // None of the above? Just a plain hello will do } murf -- Steve Murphy Digium, Inc. | Software Developer 57 Lane 17, Cody, WY 82414 USA direct: +1 256-428-6002 mobile: +1 307-899-5535 fax/home: +1 307-754-5675 irc: codefreeze | jabber: murf at digium.com Check us out at: www.digium.com & www.asterisk.org -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3227 bytes Desc: not available Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20081229/82d80770/attachment.bin
Tilghman Lesher
2008-Dec-29 22:02 UTC
[asterisk-users] Dailplan code for holiday detection?
On Monday 29 December 2008 02:06:09 pm Adam Moffett wrote:> > This dialplan is illustrative of the particular problem of the MYSQL > > command in that no cleanup is performed if the dialplan terminates > > abnormally. If a device hangup occurs between the Connect and > > Disconnect, or worse, between the Query and the Clear, then extra > > resources will be consumed until a restart is performed. To avoid this > > problem, you should ensure that you always clear your query resources and > > disconnect your handles in the "h" extension. > > > > Or use func_odbc, which performs this sort of cleanup for you. > > Next question: When you say "extra resources will be consumed until a > restart is performed." Do you mean I have to restart asterisk to free > up said resources? Will a reload do it also?Yes. No. -- Tilghman
I have a small script that I use to control queue access, it's an AGI script that lets you define on-off periods on a weekly basis plus holidays. I never get around to publishing it, though I find it quite useful - if anybody is interested, I'll clean it up and share it :-) l. 2008/12/23 Dan Austin <Dan_Austin at phoenix.com>> This has been on my ToDo list far too long. > > I have a small call-center setup, with basic > time of day/day of week validation before putting > callers in the queues. > > With the holidays upon us, I need to add check to > see if 'today' is a holiday so I do not put callers > in unmanned queues. Due to how the agents work, I have > to allow joinwhenempty. > > Does anyone have a snippet of dialplan code, perhaps using > Astdb, to check it 'today' is a listed holiday? > > Thanks, > Dan > > _______________________________________________ > -- 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 >-- Loway - home of QueueMetrics - http://queuemetrics.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20081230/a25f742b/attachment.htm
> This has been on my ToDo list far too long. > > I have a small call-center setup, with basic > time of day/day of week validation before putting > callers in the queues.Just thought I'd post here that this is one of the reasons I developed Calendaring for Asterisk. Basically, you can use iCalendar, CalDAV, or MS Exchange calendars and set up a calendar for business hours, holidays, meetings, etc. and have Asterisk subscribe to it. Then from the dialplan you can jump based on whether or not the calendar is busy. For things like holidays, it becomes very easy to use some of the best calendaring GUIs out there to easily set up recurring events, etc. and then just do a GotoIf(${CALENDAR_BUSY(mycalendar)}? busy,notbusy) or something in the dialplan. It is still under development and things might change around a little bit, but if anyone wants to test it out, it is located at http://svn.digium.com/svn/asterisk/team/twilson/calendaring