I am trying to set up a schedule for holidays. I would like to have agroup of National holidays that I can enable or disable on individual basis. I would like to have the schedule use a formula for figuring the day that the holiday falls ie. Thanksgiving November Forth Thursday.
This code that has many holidays including holidays that change dates every year.
Maybe a text file that works with a tenant(context) with no changes to Wazo-Ui.
This document will help you if you wanna use the AGI and apply it to DID but still you need to know how to write a proper AGI code. There is not easy solution to do it via wazo-ui.
Thanks for your input.The only output of the Holiday schedule is the office(pbx) is (not open) closed.
The schedule already has a function when it is not open(closed).A file containing the dates that are holidays ie.
Independence Day: ,,4,jul
Christmas: ,,25,dec
NewYear: ,,1,jan
MartinLutherKing: *,mon,15-21,jan
Valentines: ,,14,feb
StPatDay ,,17,mar
Halloween ,,31,oct
Thanksgiving *,thu,22-28,nov
MemorialDay *,mon,25-31,may
LaborDay *,mon,1-7,sep
Pres/WashBday *,mon,15-21,feb
MothersDay *,sun,8-14,may
FathersDay *,sun,15-21,jun
The schedule already knows the date to make decisions about weekday or weekend it just needs to read the information from the holiday file first. If it is a match then go to closed. If it is not a match the continue thru the schedule code.
Of course the most elegant and classy thing would be to create a new tab on schedule called holidays and the admin could input the holiday information.
Another solution based on global subroutine or another kind of subroutine if you want, is to use nodered with this dialplan.
[xivo-subrgbl-did]
exten = s,1,NoOp(Check if holidays in node-red)
same = n,Set(CURLOPT(ssl_verifypeer)=0)
same = n,Set(CURLOPT(header)=1)
same = n,Set(CURLOPT(httptimeout)=10)
same = n,Set(CURLOPT(httpheader)=X_CHANNEL_ID:${CHANNEL(uniqueid)})
same = n,Set(CURLOPT(httpheader)=X_EXTEN:${XIVO_BASE_EXTEN})
same = n,Set(CURLOPT(httpheader)=X_CALLERID:${CALLERID(num)})
same = n,Set(CURLOPT(useragent)=wazo)
same = n,Set(CURL_RESULT=${CURL(http://<your_nodered>/holidays)})
same = n,Set(RESPONSE=${CUT(CURL_RESULT, ,2)})
same = n,GotoIf($["${RESPONSE}" = "401"]?holidays)
same = n,Return()
same = n(holidays),Playback(bye)
same = n,Hangup()