FollowMe with custom context


Ive been trying to use FollowMe with a custom context. Basically we have a multi-tenanted box and everythings running brilliantly, except for us now trying to enable FollowMe on some users.

The default catch-all outbound route is set to deliberately fail, so we dont have users accidentally dialing out each others routes – They all must have a custom context set using the customcontexts module.

That’s all working great, except followme doesn’t seem to use the same context.
What we’re wanting to do is setup so it’ll also try calling a users Cellphone in the even they don’t answer at their desk for X amount of time.

In order to do this, we need to assign a custom context to each individual users FollowMe.

Currently using a few elastix-based systems (Have also posted requesting help in their forums) and a couple of CentOS + asterisk + FreePBX systems too.

Any assistance would be greatly appreciated



FreePBX is not designed to be used for multi-tenant setups. Although you can fake some things with the un-supported custom context module, it has a lot of limitations and this is an example of one of them. You will also see similar issues if you start doing transfers to outside numbers and other similar activities.

There would be significant customizations necessary to achieve the desired behavior.

Really? In my experiences, Ive been able to transfer the calls just fine, and it keeps the correct trunk, provided its been defined as a custom context using the customcontexts module.

The only thing that doesnt ‘behave’ or have the option of specifying the outbound context is FollowMe & Ring Groups :-/

Without being a programmer, and without knowing more about how FreePBX / asterisk work, I wonder how difficult it’d be to get those changes added into the customcontext module… Im certain its a feature that would be welcomed by many, not to mention a decent bounty put on it :smiley:

I’d have to look closer, it could be that the transfer’s do work properly although look hard, there are two type of transfers, blind and attended and you need to look closely.

As far as changes they would not be anything in customcontext to fix the followme and ringgoup issue, they are deep in core in dialparties.agi and some of the dialpan generated by followme and ringgroup iirc…

See the document How to give a particular extension different or restricted trunk access for outgoing calls - especially the part that starts with the sub-heading “Different Routes for Different Extensions” - there’s a sentence in there that actually addresses the issue of Follow-Mes. However note that the method described is different from using Custom Contexts - one major difference is that Custom Contexts is unsupported - although the author seems to pop up ever now and then and say he’s going to fix some of the issues, it just never seems to happen. The method described in that document may be a bit more difficult to grasp at first (since you actually have to add some custom dialplan in extensions_custom.conf rather than just do it all from a web page) but it is flexible enough to handle situations such as the one you’ve encountered, and is not an add-on module that can “break” if the author doesn’t maintain it.

The other plus for that method is you don’t have to mess around with changing priorities in the Custom Context module every time you add a route - those stupid dropdowns always drove me nuts. I’m not saying there’s never a time or place to use Custom Contexts, but you’ve hit the wall on its capabilities, it seems.

However, let’s assume for a moment that you do want to keep using Custom Contexts. Well, in FreePBX there are ways around almost everything. So try this (this is another of my “untested but will probably work” workarounds):

For each cell phone number you want to call, create a CUSTOM extension. In the dial textbox, you need to put it in such a way so the call will go out over the trunk you want. Let’s say you have a SIP trunk that you have named trunk-1 and you want to use it when you call cell phone number 1-234-567-8900. So in the “dial” textbox you’d put this:


(Note that the number must be in the format the provider associated with the trunk expects, so don’t sent 11 digits if they’re expecting 10, etc.). Now in your Follow-me, just use the Custom Extension number. Note that when you set up the Custom Extension, you don’t necessarily have to follow your normal extension numbering plan (so if you don’t want people dialing it internally, give it some obscure and really long number, since you’ll only be using it in the Follow-Me).

The one thing I don’t know about doing it that way is if it will work exactly the way you expect. When you use it in the follow me you’ll almost certainly need to append the # character, since it’s not really an internal extension. But if would certainly be worth some experimentation if you are committed to using the Custom Contexts module for normal call processing. Also note that this possibly bypasses some of the normal checks in FreePBX so if, for example, you have set a limit on the number of channels a trunk can handle, I don’t know if using a Custom Extension in this manner will honor that limit or not.