User changeable call flow destination

I’ve got a use case that I am having a hard time figuring out how to program and I am hoping that somebody here would be able to point me in the correct direction.

I’ve got a system implemented that’s handling multiple physical locations. I’ve got an incoming number set to go through a call flow that allows users to redirect incoming calls from one location to another. 80% of the time they want the calls to redirect to that same location so a simple call flow toggle works great for this. However sometimes that backup location can’t take calls (sometimes it’s too busy to handle additional calls or sometimes it’s just not staffed) and the calls need to be redirected to a different site.

All the sites are setup using ring groups so all I have to do is change the destination in the call flow toggle to the other office that they’d like to be able to send calls to.

All of the above works great except I’d like to be able to take myself out of the equation and have them be able to change the destination of the incoming calls to whatever ring group they need to hit on their own.

Is there a way to do this in FreePBX? I am open to any suggestions (queues that contain ring groups that can be logged in or out by them, some module in UCP, changing the unanswered destination for the main ring group to whatever ring group they want the calls to go to, I am open to implementing it in any way that will accomplish this goal). The only requirement on my part really is that it can be done outside of the management interface by the end users themselves, preferably through a feature code or the UCP.

Any assitance with this would be greatly appreciated.

You could make the call flow control toggle to a variable instead of a static number.

You could make a IVR that the user calls, based on the option they select (which ring group), you have a custom context that changes the variable to the value you require (the correct ring group).

This sounds exactly like what I need. Where do I create and set the variables? Is this something that can be done within the web interface or will I need to get into the custom configuration files?

You could do work in both, if you wanted to keep as much in the GUI as possible.

In the GUI:

  • Make a misc destination. for the destination enter something like ${RG}

  • Under Admin>Custom Destination, make as many entries as you have ring groups
    entry one could be “ring group x” in the description with the custom context of changerg,a,1
    entry two could be “ring group y” in the description with the custom context of changerg,b,1
    These will become your IVR options.

  • In your IVR set your options to the custom contexts you just made.

In the config files

In the extensions custom conf, make a context that matches what you entered in the custom context above (in my case [changerg])

something like (not real code below, you cannot use it):

exten => a,1 set ${RG} to ring group x
goto end
exten => b,1 set ${RG} to ring group y
goto end
exten => c,1 set ${RG} to ring group z
(end) send call to call the misc destination.

The misc destination will send the call to the ring group it is set as.

People will be able to see what you have done in the GUI, but to add more ring groups you’d have to edit the conf file.

Reading material in case you need it.

If you were willing to go more custom and put the IVR in the custom conf file, you could ask them to key in the ring group number directly, read that into the ${RG} variable. Then you’d never need to update the code, because it will change the destination to whatever number they key in. The dangerous side to that (is avoided with my original suggestion) is that they could miss key and send callers to a wrong number or reorder.

1 Like

This is great. Thank you so much for this.

1 Like

Hmm, I am definitely missing something here.

When I try to add a Misc. Destination and set it to a variable (${RG} in this case) it errors out and doesn’t want to save it as such. The error message states that it needs to be something that can be dialed (meaning I can’t set it as a variable but rather it needs to be a number, I am assuming).

I also don’t have access to a Custom Context option under the Admin menu. There are Custom Destination and Custom Extensions. Is this just part of some module that I don’t have enabled or am I just blind and not seeing it?

I’ll definitely keep trying to do more research in this direction but just thought I would post what I am running into so far.

What errors, the GUI? That’s strange, because have several miscellaneous destinations as variables, like


The Web GUI is Custom Destination. As a reminder you will not be able to write your custom dialplan here, only link what you write in the extensions custom conf to the GUI. Custom Destinations will create the options to use in your IVR, but the target will need to match what you’ve written in extensions custom conf in order for it to work.


What version of FreePBX are you on?

Either way, this will still work. You just can’t use the Misc destination. You’ll need to add a dial command to the end of your custom dial plan using ${Ring_Groups}. After that, the Misc destination will not be necessary.

The system is on FreePBX

I’m on a newer version, perhaps that’s why. But regardless, You can still do this adding the dial command to the end of your dial plan.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.