[Asterisk-Users] after hours logic

Lance Arbuckle asterisk at arbuckle.org
Mon Dec 29 13:57:41 MST 2003


Andrew Thompson wrote:

> 
> Go to your console, and type show application GotoIfTime


> If "billing", "support", and "sales" are your users/extensions, go back to
> the asterisk pdf, or the wiki and look up macro's. Actually, you'll probably
> be interested in them to clean up that section anyway...
> 


So by using GotoIfTime I would end up with something like this which
would ring the phone at that the extension and then goto voicemail
during the gotoIfTime and otherwise execute the next priority and do a
Goto to the extension's unavailable message.

exten => 1,1,GotoIfTime(8:00-21:30|mon-fri|*|*?Sales,s,1)
exten => 1,2,Goto(Sales,s,2)
exten => 2,1,GotoIfTime(8:00-21:30|mon-fri|*|*?Support,s,1)
exten => 2,2,Goto(Support,s,2)
exten => 3,1,GotoIfTime(8:00-21:30|mon-fri|*|*?Billing,s,1)
exten => 3,2,Goto(billing,s,2)
exten => 9,1,Directory(exten-local)

So that works fine for the extensions listed here but how do I
accomplish the same thing (phone doesn't ring after hours) if the caller
picks an extension from the directory ?  Would I have to use GotoIfTime
in the [macro-stdexten] to route around the dial command ?  This seems
like it would work but I'd like some feedback on 'best practices' so I
don't create a monster.  :)

I'm planing on setting up my extensions something like this:

exten => 8000,1,Macro(stdexten,8000,Zap/2)
exten => 8001,1,Macro(stdexten,8001,Zap/3)
exten => 8002,1,Macro(stdexten,8002,Zap/4)
exten => 8003,1,Macro(stdexten,8003,Zap/5)
exten => 8004,1,Macro(stdexten,8004,Zap/6)
exten => 8005,1,Macro(stdexten,8005,Zap/7)
exten => 8006,1,Macro(stdexten,8006,Zap/8)
exten => 8007,1,Macro(stdexten,8007,Zap/9)
..... etc

[macro-stdexten]
;
; Standard extension macro:
;   ${ARG1} - Extension  (we could have used ${MACRO_EXTEN} here as well
;   ${ARG2} - Device(s) to ring
;
; Ring the interface, 20 seconds maximum
exten => s,1,Dial(${ARG2},20)
exten => s,2,Voicemail(u${ARG1})
exten => s,102,Voicemail(b${ARG1})

-- 
  .~.    
  /V\    Lance C. Arbuckle
 // \\   
/(   )\  
 ^'~'^



More information about the asterisk-users mailing list