[Asterisk-Users] "night" mode ideas

rutileblue at comcast.net rutileblue at comcast.net
Sun Nov 7 14:11:50 MST 2004


I've done something similar on my home office.  I use a global variable.  A person calls a particular extension which sets the variable to an "out of the office" value.  (There is an equivalent "in office" extension.)  

Then, in the dialplan use the GotoIf command, checking the value of the variable.

This is the dialplan:

[general]
static=yes
writeprotect=yes
[globals]
THERESA_EXT=2001
ALISON_EXT=2002
KATHY_EXT=2003
CHUCK_EXT=2004
THERESA_PHONE=SIP/${THERESA_EXT}
SECOND_OFFICE_PHONE=SIP/2002
KATHY_AVAIL=true
ALISON_AVAIL=true
AVAILABLE=1
NOT_AVAILABLE=0
[voicepulse-incoming]
include => afterhours|00:00-7:59|mon-fri|*|*
include => workday|8:00-17:00|mon-fri|*|*
include => afterhours|17:01-23:59|mon-fri|*|*
include => weekend|*|sat|*|*
include => weekend|*|sun|*|*
exten => h,1,Hangup
exten => i,1,Hangup
exten => t,1,Hangup
[workday]
exten => _NXXNXXXXXX,1,Dial(${THERESA_PHONE},20,tr)
exten => _NXXNXXXXXX,2,GotoIf($[${ALISON_AVAIL} = true]?4:3)
exten => _NXXNXXXXXX,3,GotoIf($[${KATHY_AVAIL} = true]?4:5)
exten => _NXXNXXXXXX,4,Dial(${SECOND_OFFICE_PHONE},20,tr)
exten => _NXXNXXXXXX,5,Goto(ppimenu,s,1)
exten => h,1,Hangup
[afterhours]
exten => _NXXNXXXXXX,1,Dial(${THERESA_PHONE},20,tr)
exten => _NXXNXXXXXX,2,Goto(ppimenu,s,1)
exten => h,1,Hangup
[weekend]
exten => _NXXNXXXXXX,1,NoOp("GOT TO WEEKEND!")
exten => _NXXNXXXXXX,2,Goto(ppimenu,s,1)
exten => h,1,Hangup
[ppimenu]
exten => s,1,Answer
exten => s,2,Background(ppimenu)
exten => 1,1,Voicemail(u${THERESA_EXT}@local)
exten => 1,2,Hangup
exten => 2,1,Voicemail(u${ALISON_EXT}@local)
exten => 2,2,Hangup
exten => 3,1,Voicemail(u${KATHY_EXT}@local)
exten => 3,2,Hangup
exten => 4,1,Voicemail(u${CHUCK_EXT}@local)
exten => 4,2,Hangup
exten => i,1,Goto(ppimenu,s,2)
exten => h,1,Hangup
exten => t,1,Playback(vm-goodbye)
exten => t,2,Hangup
[good]
;exten => _NXXNXXXXXX,1,Playback(demo-congrats)
;exten => _NXXNXXXXXX,1,Dial(SIP/2002,20,tr)
exten => _NXXNXXXXXX,1,Dial(SIP/2001&SIP/2003,20,tr)
exten => _NXXNXXXXXX,2,Voicemail(u2002 at local)
;exten => h,2,Hangup
;exten => i,2,Hangup
;exten => t,2,Hangup
[voicepulse-outgoing]
;exten => _1NXXNXXXXXX,1,Dial,IAX2/VfQ62JvV74 at voicepulse/${EXTEN}
exten => _1NXXNXXXXXX,1,Dial,IAX2/VfQ62JvV74:jmF63yJh74 at gwiaxt02.voicepulse.com/${EXTEN}
exten => _011.,1,Dial,IAX2VfQ62JvV74 at voicepulse/${EXTEN}
exten => 2000,1,Dial(SIP/2000,20,tr)
exten => 2001,1,Dial(SIP/2001,20,tr)
exten => 2002,1,Dial(SIP/2002,20,tr)
exten => 2003,1,Dial(SIP/2003,20,tr)
exten => 2004,1,Dial(zap/1,20,tr)
exten => 2222,1,Answer
exten => 2222,2,Playback(chuck)
exten => 95${KATHY_EXT},1,Macro(call-voicemail,${KATHY_EXT})
exten => 95${ALISON_EXT},1,Macro(call-voicemail,${ALISON_EXT})
exten => 95${THERESA_EXT},1,Macro(call-voicemail,${THERESA_EXT})
exten => 95${CHUCK_EXT},1,Macro(call-voicemail,${CHUCK_EXT})
;exten => 95${KATHY_EXT},1,Answer
;exten => 95${KATHY_EXT},2,Wait(1)
;exten => 95${KATHY_EXT},3,VoicemailMain(${KATHY_EXT}@local)
;exten => 95${KATHY_EXT},4,Hangup
;exten => 95${ALISON_EXT},1,VoicemailMain(${ALISON_EXT}@local)
;exten => 95${ALISON_EXT},2,Hangup
;exten => 95${THERESA_EXT},1,VoicemailMain(${THERESA_EXT}@local)
;exten => 95${THERESA_EXT},2,Hangup
;exten => 95${CHUCK_EXT},1,VoicemailMain(${CHUCK_EXT}@local)
;exten => 95${CHUCK_EXT},2,Hangup
;exten => 2999,1,VoicemailMain(${CALLERIDNUM}@local)
exten => 2999,1,VoicemailMain(2002 at local)
exten => 3999,1,VoicemailMain(2001 at local)
exten => h,1,Hangup
exten => i,1,Hangup
exten => t,1,Hangup
;
; DO NOT DISTURB LOGIC
;
exten => 99${KATHY_EXT}${AVAILABLE},1,Macro(change-availability,KATHY_AVAIL,true,vm-goodbye)
exten => 99${ALISON_EXT}${AVAILABLE},1,Macro(change-availability,ALISON_AVAIL,true,alison_in)
exten => 99${KATHY_EXT}${NOT_AVAILABLE},1,Macro(change-availability,KATHY_AVAIL,false,vm-goodbye)
exten => 99${ALISON_EXT}${NOT_AVAILABLE},1,Macro(change-availability,ALISON_AVAIL,false,alison_out)
;exten => h,1,Hangup
[macro-change-availability]
; ARG1 - variable name. will be set to the value of ARG2
; ARG2 - 'true' or 'false'
; ARG3 - message to play back
exten => s,1,Answer
exten => s,2,SetGlobalVar(${ARG1}=${ARG2})
exten => s,3,NoOp("Kathy is available? ${KATHY_AVAIL}")
exten => s,4,Playback(${ARG3})
exten => s,5,Hangup
[macro-call-voicemail]
; ARG1 - extension
exten => s,1,Answer
exten => s,2,Wait(1)
exten => s,3,VoicemailMain(${ARG1}@local)
exten => s,4,Hangup
exten => h,1,Hangup
>The system wants to have different incoming call handling more-or-less 
>based on time of day, but we don't want it to be at some precise UNIX time, 
>but rather under human control, so if people stay late they can keep it in 
>a more appropriate mode.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20041107/27c71490/attachment.htm


More information about the asterisk-users mailing list