[asterisk-users] Dailplan code for holiday detection?

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Tue Dec 23 13:35:51 CST 2008


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



More information about the asterisk-users mailing list