[asterisk-users] day night service toggle

A J Stiles asterisk_list at earthshod.co.uk
Fri Nov 28 06:40:10 CST 2014


On Thursday 27 Nov 2014, Control Oye wrote:
> Hi,
> 
> I need dialplan to set INCOMING call forwarding during lunch break to my
> secretary.
> 
> I want that I can set call forwarding by dialing an extension number to
> turn it ON or OFF.
> 
> I am using asterisk 11.

What you need to do is, set a global variable from within your dialplan, to 
indicate whether you are at your desk  (meaning calls to your number should go 
to your phone)  or on lunch  (meaning calls to your number should go somewhere 
else).

And note that this really should be done by dialling separate numbers for "in" 
and "out", because toggle actions are annoying as hell in practice -- it's 
easier to remember two different numbers, than to remember what state you are 
currently in.


If 101 is you and 102 is the person who fields your calls while you are on 
lunch, you need something like this;

;  extension 101
exten => 101,1,GotoIf($[${ON_LUNCH}] ? on_lunch : at_desk)
exten => 101,n(at_desk),Dial(SIP/101)
exten => 101,n,Hangup()
exten => 101,n(on_lunch),Dial(SIP/102)
exten => 101,n,Hangup()



; These extensions should be in some context which is only callable from 101

; extension 771 sets "on lunch"
exten => 771,1,Set(GLOBAL(ON_LUNCH)=1)
exten => 771,n,Playback(ajs-set_on_lunch)
exten => 771,n,Hangup()

; extension 770 sets "at desk"
exten => 770,1,Set(GLOBAL(ON_LUNCH)=)
exten => 770,n,Playback(ajs-set_at_desk)
exten => 770,n,Hangup()

-- 
AJS

Note:  Originating address only accepts e-mail from list!  If replying off-
list, change address to asterisk1list at earthshod dot co dot uk .



More information about the asterisk-users mailing list