; do_not_disturb.conf: ; Handle the "do not disturb" feature ; If DND is on, the stdextension macro plays a recording like: ; "I am busy, but press # if this is an emergency" ; (assuming DND_OVERRIDE_EXTENSION is set to # in extensions.conf) ; Because of the way this works, the dnd-override context must be ; included in the context where the stdextension macro is called. ;[globals] ;DND_OVERRIDE_EXTENSION= [macro-dnd-on] exten = s,1,DBput(DND/${ARG1}=YES) exten = s,2,Playback(beep) exten = s,3,Macro(return_to_top) [macro-dnd-off] exten = s,1,DBdel(DND/${ARG1}) exten = s,2,Playback(beep) exten = s,3,Macro(return_to_top) [dnd-override] ; ----- Do Not Disturb Override ------ ; Make all forwards non-immediate when overriding DND. exten = ${DND_OVERRIDE_EXTENSION},1,GotoIf($["${dnd_exten}foo" = "foo"]?2:3) exten = ${DND_OVERRIDE_EXTENSION},2,Macro(return_to_top) exten = ${DND_OVERRIDE_EXTENSION},3,Goto(dnd-override-bans,1) ; Ban hypothetical abusers from DND system exten = dnd-override-bans,1,GotoIf($["${CALLERIDNUM}" = "12223334444"]?20:2) exten = dnd-override-bans,2,Goto(dnd-override-main,1) ; Dump straight to voicemail exten = dnd-override-bans,20,Voicemail(${dnd_exten}) ; Now re-run the original extension context, but this time ; dnd_override is set to YES, which will bypass the dnd ; prompt in stdextension macro and go straight through. exten = dnd-override-main,1,SetVar(dnd_override=YES) exten = dnd-override-main,2,Goto(${dnd_context},${dnd_exten},1)