Custom context to add prefix on internal calls

I would like to use custom context to add a prefix to all 3 digit internal calls. For example, if a customers actual extension is 001100, I would like to use custom context to add 001 in front of the 100. So if a extension dials 100 it will rewrite it to 001100. I have the custom context setup, just looking for the dial plan.


I have a company that has several locations. They want those locations to be the same. Instead of having 3 freepbx servers, what I would like to do is have one. I would like to setup custom context to work like this. The first location would have extensions that start with 001100. The second location would have 002100 and so on. So when someone at the first location (lets say extension 001101) wants to get to extension 100, they dial 100. The dial rule in custom context sees that it is an internal 3 digit number and adds the prefix 001 to the three digit extension dialed and the call is routed to that extension. I would do three different custom context rules, one for each location. so at location 3 a person can dial 100 and it prefixes 003100 and everything works the same. I have everything in place, I just need a working dial rule that would look at the call, see it is 3 digits, prefix it with 001 and complete the call. Any suggestions would be greatly appreciated.

Yes you can use just one instance of FreePBX, FreePBX currently does not truly support “multi-tenancy” in other words any attempts to have two extensions with the same number will be a problem for you, just renumber each tenant’s extensions.

It is possible to achieve it the way you had originally planned, we use a similiar setup for some of our customers. The way we do it is through call routes rather than mangling of actual extension numbers. The basic theory is this:

  1. You have two or more sites. At each site users have local extension numbers (i.e. 301, 302, 303, etc). They can be the same at both sites, doesn’t matter.
  2. Setup a trunk between the two (or more) sites to allow the inter-dial. Trunk is set to direct all calls to a custom context. That context prefixes the inbound callerID with a set value (i.e. 5 at one location, 4 at the other).
  3. Setup an outbound route that directs calls with the opposite prefix back across the trunk. Make sure it’s an intercompany route so it doesn’t try to hide the internal caller ID.

Voila that’s all there is to it. Caller at location A dials say 4302. The outbound route strips off the 4, and sends the call over the trunk to location B. Location B adds the prefix for location A to the inbound call’s caller ID, and rings local extension 302. The person at 302 sees an inbound call from 5302. If they dial back 5302 the same process happens in reverse, with B stripping the 5 prefix and A adding the inbound 4.


Why not just use 4 digit extensions?