Day/night mode on asterisk GUI?

I have set up Asterisk on a Synology NAS (Asterisk 1.8 with 2.0-rc1 gui) and the main part works fine. I can make outgoing calls, I can receive calls, I can transfer calls and I can call extensions. However, there’s just one thing that needs to be fixed before I can switch from my current 3CX server to Asterisk.

I have 5 IP phones in my office, and when I am at the office, these telephones must ring. However, when I (or my collegues) go home, I (or they) press a button on the telephone (the one nearest to the door) so they can enable/disable call forwarding to my cell phone for the hours that noone is at the office.
I use 2 speed dial buttons on my Grandstream to enable (*31 on 3cx) or disable (*311 or something) Out-of-Office status in 3CX. this works just well.

However, I need something like this in Asterisk. I looked at the follow Me function, the call forwarding function (they can all be toggled with feature codes) but these do not work when using a ring group.

But I need ring groups; all the telephones in the office (just 5) must ring… but I also need this call forwarding thing.

I almost gave it up, but then I saw some topics about Day/Night mode, or Call Flow control. However I only see topics about this feature in FreePBX. But there’s only Asterisk-GUI on the synology NAS.

Which features are available to use this forwarding thing? This forwarding must be enabled/disabled by a speeddial button… it would be nice to also have a BLF for an activated/deactivated forwarding, but that’s just a bonus.

Most of the terms you are using a FreePBX ones, not Asterisk ones.

Time dependent routing can be achieved by using time dependent context inclusions (see extensions.conf.example, or using the GotoIfTime application (core show application gotoiftime).

Hi

Day night is easy, just control your call flow using the astdb to set flags and Gotoiftime.
something like this, (logic not 100% checked as in a hurry)

exten => queue,1,set(NOC=${DB(active/1234)})
exten => queue,n,GotoIfTime(*|*|25-26|dec?6)
exten => queue,n,GotoIfTime(*|*|1|jan?6)
exten => queue,n,GotoIf($["${NOC}"!="active"]?6)
exten => queue,n,GotoIfTime(08:30-17:59|mon-fri|*|*?110)
exten => queue,n,Queue(${1234}01|rt|||45)
exten => queue,n,Voicemail(1234)
exten => queue,n,Hangup()
exten => queue,110,Noop(daytime)
exten => queue,111,Queue(4321|rt|||45)
exten => queue,112,Voicemail(1234)
exten => queue,113,Hangup()

whoa, thanks for the replies! I understand that I might have used FreePBX terms… I’m quite new to the Asterisk ‘family’ so I looked everything up on Google :wink:

Maybe time dependent rules aren’t the solution for my problem, but I thougth it was the best solution for it.

the only thing I need is one button on my phone to toggle between inbound call rules.
When I’m at the office, I press the button, and Asterisk must set the Incoming Call Rules to ‘Ring Group 1’ (all the phones). When I go home, I press the button again, and Asterisk must set the Incoming Call rules to ‘my Cell Phone number’.

So if I can find a possinility to map a feature code to toggling Call Rules, I have found a solution and I can forget Time Dependent rules…

Then remove the time rules, or go for a freepbx based install, (asteriskGUI is limuted and v old) then in freepbx use the daynight toggle it will do what you want.

Yes, I know, I don;t have time rules yet because sometimes I’m not at the office, and if the time rules are set on 0900-1700, and I’m not there, I don’t get calls on my cell phone… therefore I have to set it manually with a button.

I use Asterisk on my NAS and the only GUI I have is Asterisk GUI unfortunately… if there’s no possibility to control incoming call rules with a button, than I need to switch to a Raspberry pi with RASPBX or something…


I have shown you how to use day night toggling with the astdb. it seems you dont want to write any dialplan yourself.

What you want to do is acheivable and as I said fairly simple. You have an example that usies time and astdb remove the times ones and you have the astdb one, then just write some dialplan to set the astdb. 

as a famous meercat once said "simples"

I have shown you how to use day night toggling with the astdb. it seems you dont want to write any dialplan yourself.

What you want to do is acheivable and as I said fairly simple. You have an example that usies time and astdb remove the times ones and you have the astdb one, then just write some dialplan to set the astdb.

as a famous meercat once said “simples”

Is that Synology?

[quote=“ianplain”]if there's no possibility to control incoming call rules with a button,

I have shown you how to use day night toggling with the astdb. it seems you dont want to write any dialplan yourself.

What you want to do is acheivable and as I said fairly simple. You have an example that usies time and astdb remove the times ones and you have the astdb one, then just write some dialplan to set the astdb.

as a famous meercat once said “simples”[/quote]
I thought it used some FreePBX-specific stuff, when I saw the ‘day/night’ sentence :wink: Excuse me.
I will definately try that… Asterisk is Asterisk so when it’s possible with FreePBX GUI then it must be achievable on my NAS with Asterisk GUI, right? Maybe some manual additions but if that’s the only thing…

Yes, it’s a Synology NAS. I wrote them already with the question to add FreePBX to the repo’s…they would investigate this…

If it is possible on FreePBX it is possible on bare Asterisk, but you can’t assume that another GUI can do it. These sorts of feature are implemented by dialplan that is supplied as part of the GUI, not as part of Asterisk.

I understand. But when I write my own dialplan like the example of Ian, and I put it manually in extensions.conf, than it has to work, right?

I have read some tutorials about dialplans and astdb, and I’m trying to make a dialplan.

Can my solution be like this?

Button 1 calls an extension which sets a value of “1” in a key (for example they key “officeisopen”)
Button 2 calls an extension which sets a value of “0” in this same key

and a dialplan like this?
GoToIf value from officeisopen = 1, ring the ring group
otherwise ring my cell phone?

Do I understand it correctly? I’m still reading the tutorials but I’m already trying some solutions in my head, haha

After following the tutorials and reading the explanations of the various commands on voip-info.org I’ve made this:

[code]exten=45,1,Answer()
exten=45,n,Set(GLOBAL(NIGHTMODE)=1)
exten=45,n,Playback(vm-youhave&vm-Urgent&vm-Work) ; just testing until I’ve found a voice prompt for Night Mode Activated
exten=45,n,Hangup()

exten=46,1,Answer()
exten=46,n,Set(GLOBAL(NIGHTMODE)=0)
exten=46,n,Playback(vm-goodbye) ; voice prompt night mode off would be better
exten=46,n,Hangup()

exten=47,1,GotoIf($[${NIGHTMODE} = 1]?on:off)
exten=47,n(on),Dial(SIP/12) ; this would be my cell phone number, now just internal testing
exten=47,n(off),Playback(vm-nobodyavail) ; this is testing for when night mode is off… normally it must call extension 6400 (ring group)
exten=47,n,Hangup()
[/code]
45 = night mode on
46 = night mode off
47 = our ‘fake’ external number, this is just for testing, customers will be arriving here

and it works!!!
Now, my final question… it works with variables. What is the advantage of using astdb?

now i just need the BLF working when night mode is on but that’s not so hard with the example on voip-info.org.

Persistence.