Asterisk: Holiday Macro

Below is an example of a macro that checks to see if the ‘holiday’ menu is enabled.  I also added extension 2970, a ‘one touch’ utility to enable/disable the holiday macro.  Remember to create a ‘holiday_disabled.wav’ that literally says, “Holiday menu disabled”.  To rercord a message simply disable and enable the utility again.  Enjoy!




;Check if holiday message set

;Check if it is a holiday
exten => s,1,NoOp(Check for Holidays)
exten => s,n,Answer()
exten => s,n,set(HOLIDAY=${DB(closed/1)})
exten => s,n,NoOp(${HOLIDAY})
exten => s,n,gotoIf($[“${HOLIDAY}” = “1”]?main-holiday,s,1)   ; Custom Holiday

exten => s,n,gotoiftime(08:00-19:00,mon-fri,*,*?${ARG1},s,1) ; Main Operating Hours
exten => s,n,goto(${ARG2},s,3)



; usage: macro(holiday,ARG1,ARG2)
; argument one and two are that day and night menu
; Some DID

exten => 12134974061,1,macro(holiday,main-day,main-night)


; One touch Record/Set Holiday Closed Message
exten => 2970,1,NoOp(============ Set Holiday Message ==============)
;exten => 2970,1,authenticate(5678)
exten => 2970,n,Wait(1)

; check to see if holiday message is set
exten => 2970,n,set(HOLIDAY=${DB(closed/1)})
exten => 2970,n,NoOp(${HOLIDAY})
exten => 2970,n,NoOp(${HOLIDAY})
exten => 2970,n,NoOp(${DB(closed/1)})
exten => 2970,n,gotoIf($[“${HOLIDAY}”=”1”]?utilities,2970(disable),1:utilities,2970(enable),1)

; if disabled record a new greeting
exten => 2970(enable),1,Record(en/custom/holiday_message:gsm)
exten => 2970(enable),n,Wait(1)
exten => 2970(enable),n,set(DB(closed/1)=1)
exten => 2970(enable),n,Playback(en/custom/holiday_message)
exten => 2970(enable),n,wait(1)
exten => 2970(enable),n,Hangup

; disable the holiday message and alert the caller

exten => 2970(disable),1,set(DB(closed/1)=0)
exten => 2970(disable),n,Playback(en/custom/holiday_disabled)
exten => 2970(disable),n,Hangup

1 Comment »


    Can you please check:

    The ‘Servername’ field refers to the ‘/etc/freeItds.conf’ context that I also named ‘[ms-mysql]‘

    I think you meant:

    The ‘Servername’ field refers to the ‘/etc/freeItds.conf’ context that I also named ‘[ms-sql]‘

    I have not managed to find any email on the site. Sorry for this offtopic post.

    Thank you for the article!

    Comment | January 26, 2012

RSS feed for comments on this post. TrackBack URL

Leave a comment