Prefixes inside the same company for each project


I want to implement a server with phone numbers for each project in different places. this way there are the folowing places in the same company:

For each one I have the following prefixes respectively (always 5 numbers):

  • 43237;
  • 63876;
  • 46774;

This numbers represent the characters in the keypad, M=6, E=3, T=8, R=7, O=6.

In each project there are numbers per Team with no more than 5 single numbers (5 or less numbers), in the following way:

RH = 74;
HSE = 473;
COSTS = 26787.
What I want is that when I want to call RH inside the same project I only need to type 74, but if I want to call someone outside my poject, for instance, if I’m at METRO and need to call HSE of FACTORY I call 32286 473! If I call only 473 it should translate to 63876 473, because I’m at METRO.

Is it possible to do that in FreePBX?

PS: In a SIP phone there is a simple rule for prefixes very easy to set up:

Whit 5 or less numbers add the local prefix. It’s needed to be reconfigured in each terminal. If in FreePBX things turn out to be ultra complicated I think I just configure in each terminal to add the correct prefix to the respective account (local prefix).

So, is 473 less or equal to 5 numbers? Yes => 63876 473… Very simple.

If each place is going to have its own FreePBX installation, then doing so is simple. Just set up each person with the extension number matching what you want local users to dial, and set-up outbound routes that require a prefix, or re-write the call before it goes out.


Ok I get it, that means that I can’t have a single FreePBX server for all the company, I need a server for each place, Headquarters and projects, maybe working as sip trunking.

I think nevertheless that having a single FreePBX server centralized in the headquarters makes the configuration and maintenance easier. I’m new in configuring server, so I don’t know very much about this subject.

Thanks for your reply.


After some work, I conclude that you are only able to implement a MESH network of prefixes. There is no way to make your FreePBX in the headquarters to work as an hub, distributing the calls to the right branch. I wonder how is possible a given branch to share a SIP Trunking to other branch? It don’t, each PBX server has to have their own Trunkings, there is no Trunk sharing between PBX servers.

This means that each time a new branch instals its own FreePBX server, all other branches need to be aware to configure each one of their Servers, one by one locally.

With FreePBX the architecture is a MESH architecture, not a STAR one like followed.

More here:

That is correct, Asterisk is a BackToBack Sip agent so doesn’t “mesh” well in any reaonably fashion , you need a SIP PROXY to do that at your “headquarters”, a very effective open source solution that will fit all your needs (with a little RTFM’ing) is Kamailio.

It can easily by the hub that all your trunks connect to, both the PBX ones and the VSP ones.

You can do it as a mesh system if you want.

You just have to set-up each server to route all internal calls not destined for the local machine back to the HQ. The HQ machine will know where to send calls destined for each remote machine.

It’s quite easy to do with the outbound routes module and system to system trunks.

The trunks and respective outbound routes of the HQ machine only work for calls made on that machine. Calls made in other machines throughout a Trunk in the HQ machine simple don’t go throughout any outbound route of that HQ machine.

I don’t know if you understand the problem here, the problem is that Outbound Routes are exclusively applied to calls made in the respective machine, calls made locally. That is why you aren’t able to use Trunks/Outbound Routes in sequence, Branch1 - HQ - Branch2, you have to have the direct trunk Branch1 - Branch2 (Mesh Network)!

Maybe there are ways to do it, but I’m sure they aren’t easy. I frankly don’t understand why a call made from a remote branch can’t be treated as one made in the HQ!

Yes, I understand exactly what you are saying, and you are mistaken.

Outbound routes are applied to any calls that are received from a trunk that is configured using “context=from-internal”. On the other hand, if a call arrives on a trunk that is configured using “context=from-trunk,” then calls coming in from that trunk will be routed using the inbound routes.

So, as long as you send your calls from Element 2-5 to Element 1 on a trunk that is configured using “context=from-internal”, the outbound routes at Element 1 will route the call to the correct place.

You may wish to consult these instructions on how to set-up connecting trunks:

Pay close attention to the section entitled “What if I want to connect more than two systems?”