[asterisk-users] day night service toggle
JB
jb_soft at trink.co.uk
Fri Nov 28 05:51:15 CST 2014
Hello Control,
On Thursday, November 27, 2014, 9:48:30 PM, you wrote:
> 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.
There are probably lots of ways to do this, and it would be worth
checking to see whether your handset can be programmed to do the
forwarding, which is simpler than setting up a dialplan to handle it.
I pass incoming calls to a mobile phone based on a toggle. There are
three parts to this:
[1] I have a Global Variable (MDIVERT) that holds the current Divert status.
[2] I have an extension (*70) that toggles the value of the Global variable
[3] I have a GotoIf in my incoming call handler that selects different
dial strings depending on whether the is set or not.
I added a two voice prompts to announce the status of MDIVERT.
Dialling *70 the first time sets the variable and dialling *70 again
unsets it.
[1] Create the Global Variable
[globals]
MDIVERT=0
[2] Toggle the variable.
exten => *70,1,Set(GLOBAL(MDIVERT)=${IF($[ ${MDIVERT} = 1]?0:1)})
exten => *70,n,GotoIf($[ $[ "${MDIVERT}" = "0" ] ]?notset)
exten => *70,n,playback(divertactive)
exten => *70,n,Hangup()
exten => *70,n(notset),playback(divertinactive)
exten => *70,n,Hangup()
[3] GotoIf in call handler
exten => 100,1,GotoIf($["${MDIVERT}" = "1"]?divert) ; check variable
exten => 100,n,Dial(SIP/ManagerPhone,30,ctkx) ;Call your phone
exten => 100,n,Hangup()
exten => 100,n(divert),Dial(SecretaryPhone,30,ctkx) ; call Secretary
exten => 100,n,Hangup()
I have cut out a lot from the dialplan to give you an idea, but I am
sure that others will chip in with their ideas and point out the
failings in my approach :-)
J
--
Best regards,
Julian mailto:jb_soft at trink.co.uk
More information about the asterisk-users
mailing list