Hi all. I have a system I'm going to build that I have a pretty good idea how I'm going to accomplish this feature, but I was wondering if anyone had a better idea/method since mine seems somewhat "hackish" for some reason I can't explain :) 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. What we're looking for is a way for someone on the system to pick up an extension and dial some code that changes the incoming call context, i.e. manually switching incoming call handling. We want incoming calls to ring extension X->Y->Z in one mode, ring only Z in a second mode, and only take voicemail in a 3rd mode. Th idea I came up with to solve this was to code a special extension for each mode that used Authenticate() and then System() to copy a different extensions.conf into place and restart Asterisk for each mode. Restarting seems a bit harsh since it will drop any calls in progress. There would also be a cron job that would swap modes if they hadn't been swapped by some time of day. Does this sound like a reasonable solution, or do any of the experts (ahem, not me) have a more elegant solution idea? -- Tom
On November 7, 2004 03:30 pm, Tom Lahti wrote:> 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. > > What we're looking for is a way for someone on the system to pick up an > extension and dial some code that changes the incoming call context, i.e. > manually switching incoming call handling. We want incoming calls to ring > extension X->Y->Z in one mode, ring only Z in a second mode, and only take > voicemail in a 3rd mode. Th idea I came up with to solve this was to code > a special extension for each mode that used Authenticate() and then > System() to copy a different extensions.conf into place and restart > Asterisk for each mode. Restarting seems a bit harsh since it will drop > any calls in progress.Use GotoIfTime as the default behaviour, but then allow internal sets to set a DB variable which gets checked in the night mode... and perhaps a cron job that clears that override DB value every night at 11pm or something? -A.
On Sun, 2004-11-07 at 12:30 -0800, Tom Lahti wrote:> Hi all. I have a system I'm going to build that I have a pretty good idea > how I'm going to accomplish this feature, but I was wondering if anyone had > a better idea/method since mine seems somewhat "hackish" for some reason I > can't explain :) > > 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. > > What we're looking for is a way for someone on the system to pick up an > extension and dial some code that changes the incoming call context, i.e. > manually switching incoming call handling. We want incoming calls to ring > extension X->Y->Z in one mode, ring only Z in a second mode, and only take > voicemail in a 3rd mode. Th idea I came up with to solve this was to code > a special extension for each mode that used Authenticate() and then > System() to copy a different extensions.conf into place and restart > Asterisk for each mode. Restarting seems a bit harsh since it will drop > any calls in progress. > > There would also be a cron job that would swap modes if they hadn't been > swapped by some time of day. > > Does this sound like a reasonable solution, or do any of the experts (ahem, > not me) have a more elegant solution idea?You can use a include based on time to get your failsafe instead of a cron. Then you just need to use a global var that your extension logic could manipulate and a gotoif based on that variable to either short circuit the dialplan to the desired plan or just do a gotoif to get into a new context that contains the proper logic. -- Steven Critchfield <critch@basesys.com>
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@local) ;exten => h,2,Hangup ;exten => i,2,Hangup ;exten => t,2,Hangup [voicepulse-outgoing] ;exten => _1NXXNXXXXXX,1,Dial,IAX2/VfQ62JvV74@voicepulse/${EXTEN} exten => _1NXXNXXXXXX,1,Dial,IAX2/VfQ62JvV74:jmF63yJh74@gwiaxt02.voicepulse.com/${EXTEN} exten => _011.,1,Dial,IAX2VfQ62JvV74@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@local) exten => 3999,1,VoicemailMain(2001@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
[features] exten => 001,1,DBPut(FEATURE/STATUS=1) exten => 001,2,Hangup exten => 002,1,DBPut(FEATURE/STATUS=2) exten => 002,2,Hangup exten => 003,1,DBPut(FEATURE/STATUS=3) exten => 003,2,Hangup [inbound] exten => s,1,DBGet(STATUS=FEATURE/STATUS) exten => s,2,GotoIf($[${STATUS} = 1]?ringall,s,1) exten => s,3,GotoIf($[${STATUS} = 2]?ringone,s,1) exten => s,4,GotoIf($[${STATUS} = 3]?ringvoicemail,s,1) exten => s,5,NoOp(STATUS is UNSET, please set STATUS immediately by dialing 001,002, or 003) exten => s,6,Hangup where ringall is the context that handles ringing X, Y, and Z ringone is the context hangling ringing Z only ringvoicemail is the context sending the caller to Voicemail immediately You can have a cron command like such * 21 * * 1,2,3,4,5 asterisk -rx "database put FEATURE STATUS 3" * 8 * * 1,2,3,4,5 asterisk -rx "database put FEATURE STATUS 1" This should do what you described below -Chris On 12:30 PM 11/7/2004, Tom Lahti wrote: >Hi all. I have a system I'm going to build that I have a pretty good idea >how I'm going to accomplish this feature, but I was wondering if anyone had >a better idea/method since mine seems somewhat "hackish" for some reason I >can't explain :) > >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. > >What we're looking for is a way for someone on the system to pick up an >extension and dial some code that changes the incoming call context, i.e. >manually switching incoming call handling. We want incoming calls to ring >extension X->Y->Z in one mode, ring only Z in a second mode, and only take >voicemail in a 3rd mode. Th idea I came up with to solve this was to code >a special extension for each mode that used Authenticate() and then >System() to copy a different extensions.conf into place and restart >Asterisk for each mode. Restarting seems a bit harsh since it will drop >any calls in progress. > >There would also be a cron job that would swap modes if they hadn't been >swapped by some time of day. > >Does this sound like a reasonable solution, or do any of the experts (ahem, >not me) have a more elegant solution idea? > >-- >Tom > >_______________________________________________ >Asterisk-Users mailing list >Asterisk-Users@lists.digium.com >http://lists.digium.com/mailman/listinfo/asterisk-users >To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20041107/791d69eb/attachment.htm