Hi everyone,
I am currently stuck at a problem. I have time conditions configured in my FreePBX with time groups from 7 am to 5pm. If this time condition matches, the calls go to a ring group, if not then the calls go to an IVR, saying we are currently closed. Currently, all the workers are using softphones to make calls. What I want to achieve is: if an extension is still online after 5 pm, the call should go to the extension, instead going to the IVR.
Thanks !
There are a couple ways to accomplish that but not sure if any will meet your needs. Perhaps someone else can offer another solution I havenât presented here.
- set up a call flow control in front of the time conditions that the users âworking lateâ can activate and deactivate. Example:
normal call flow between 7 & 5 > ring group
normal call flow between 5pm & 7AM > IVR
suggested change:
Normal call flow > call flow control = DAY > time group > etcâŚ
Normal call flow > call flow control = NIGHT > ring group
This way, if the call flow control is left in itâs default âDAYâ setting, the Time condition controls the call routing. If the call flow control is set to âNIGHTâ (using a *xxx dial code) it overrides the Time Condition and routes calls directly to the ring group until it is set back to âDAYâ again.
The only caveat to this is youâll need to trust your employees to turn the Call flow control off after they finish working late so that normal Time Conditions will take over again.
- The other possibility is just to route all calls directly to the ring group and have the ring groupâs failover be the IVR. Arguably not a great solution.
If you want to branch a call based on the device status of a single extension, you can do so using dynroutes and this method: Using Dynamic Routes to branch call flow based on extension state
Using dynroutes you can check the extension hint for the value of UNAVAILABLE
and branch the call that way. You can probably string multiple conditions as part of the expression using and/or, but I donât recall ever doing that so youâll have to google it.
Alternatively, if there is an API you can call somewhere that will tell you if the office is occupied, you could use that with dynroutes as well.
Interesting idea but wouldnât that get a bit cumbersome if there were more than one or two extensions involved? youâd have to create a dynamic route to check each extension and daisy chain them on a negative result no?
Unless I donât understand the method properly.
Yes, this is only practical if you can do it with 1 or 2 dynroutes. if monitoring multiple extensions, then it gets more complex than my last answer. You would want to use an Asterisk expression like the following:
$["${EXTENSION_STATE(7002@from-internal)}"="UNAVAILABLE" & "${EXTENSION_STATE(7005@from-internal)}"="UNAVAILABLE"]
I just tested. The above expressions will evaluate to â1â if ALL of the conditions are met, i.e. both extensions 7002 and 7005 are UNAVAILABLE (no devices registered) otherwise it will evaluate to â0â. You could add checks against other extensions by stringing them together with the & char. Then one could use this expression in a dynroute using the method outlined in this post: Using Dynamic Routes as an extended blocklist
For completeness I also tested this expression:
$["${EXTENSION_STATE(7002@from-internal)}"="UNAVAILABLE" || "${EXTENSION_STATE(7005@from-internal)}"="UNAVAILABLE"]
which evaluates to â1â if EITHER condition is met which otherwise evaluates to â0â.
If monitoring more than a small number of extensions, it would probably be best to create a single custom hint that tracks all the extensions in question and then use that custom hint in the dynroute.
I was thinking of the same thing. Like would it be possible to write a dialplan that created a hint for a dialgroup and set it to either OCCUPIED or EMPTY based on the status of all the member extensions.
So if all the extensions were set as UNAVAILABLE then the status of the dialgroup would be âEMPTYâ but if any of the member extensions were any other value then the status would be âOCCUPIEDâ
Not sure how youâd make it dynamic though so as members of the dialgroup are added/subtracted it would know.
Hi,
I just configured the call flow control with these changes, but to set this night the person who is online has to toggle it to night by dialing the *280 number given by freepbx. Is there anyway i can automate this so that the user doesnât has to do it every time? Any possibility that looks at the status of the user and toggle it to night automatically after 5pm if online and when the user goes offline again, it sets to it normal DAY call flow control.
Thanks
Yep, you can make your own cron job that has a query and action based on the result. I believe the callflow control is just an AstDB entry that you can update from the asterisk CLI.
This is correct.
Is there any way or any tutorial or post where i can a guide to to this? I am actually new to this place.
Thanks
Yes-ish, seems like @ashcortech actually has some experience here and might be willing share what they ultimately did. You will like need to modify triggers and conditions to match your unique needs.
The post give you some idea on changing the callflow control, you will likely need to do some googling to get everything else lined up.
Alternatively, if you want to try to do it in the web GUI, you could try stringing multiple dynamic routes together.
Here is a post about how to change a CFC from a dynamic route. You would need another dynamic route in front of this to run your determination query and route to this dynamic route if the conditions are met.
Using Dynamic Routes for Call Flow Control - FreePBX / Tips and Tricks - FreePBX Community Forums
I had the exact asterisk command line needed somewhere in my notes and canât find it. Iâll do some more digging
Ok, found the commandâŚ
You need to use the asterisk database command in a script.
so very simply you could put /usr/sbin/asterisk -x âdatabase put DAYNIGHT C0 DAYâ
Or
/usr/sbin/asterisk -x âdatabase put DAYNIGHT C0 NIGHTâ
into a cronjob to change the Call Flow Toggle Feature Code Index id of 0.
The Call Flow Toggle Feature Code Index is the number in the first field of the callflow module in the FreePBX GUI. If you wanted to do the same with a callflow that had an index ID of 6 it would be:
/usr/sbin/asterisk -x âdatabase put DAYNIGHT C6 NIGHTâ
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.