Time Condition Toggle?


#1

Hi Guys,

When I was previously using FreePBX there is a feature built into the GUI where you can toggle time conditions on/off by dialing certain feature codes. Is there a way to duplicate this in asterisk?

Thanks in Advanced.


#2

Yes. How else would FreePBX achieve it? I imagine they set a flag in a global variable, which is tested, along with the time condition.


#3

Set a variable in the ASTDB and test for it in dialplan. in my example I’m using vars/mode and setting it to OPEN,CLOSED, or TIMECHECK

same => n(MODECHECK),Goto($(DB(vars/mode))
same => n(TIMECHECK),GotoifTime(8:00-9:00,mon-fri,*,*,OPEN)
same => n(CLOSED),Goto(myclosed-context,s,1)
same => n(OPEN),Answer()