Using trixbox CE as a SIP Gatewaytburtless
If you have a need to have multiple PBX systems running and you want them all to make and receive calls, you will run into a major problem with that because of NAT issues and port forwarding limitations. In this article, I will explain how to use a trixbox CE system as a front-end gateway that will manage the trunks to the SIP providers and forward calls to the different PBX systems as well as allow the PBX systems to dial out through the trixbox CE system.
Besides testing different PBX platforms like I do, why might you want to do a setup like this? There are several reasons I can think of:
- Single VoIP provider to service multiple companies at a single location each with their own PBX system
- Setting up separate PBX systems for different departments
- Having a single media gateway that serves multiple locations (over a VPN)
- Test systems for development
- Temporary setup during migration from one system to another.
While this is only showing a SIP provider to multiple PBX’s, the concept can also be applied to a SIP trunk coming into the gateway and then a PRI connection to a legacy PBX that doesn’t support SIP trunks, thus allowing a non-IP PBX system to use VoIP trunks.
We won’t go into the setup of the actual SIP trunk into the trixbox CE (FreePBX) system as that is dependant upon the provider and should be pretty straightforward. What we will need to do is create trunks from the other PBX systems into the trixbox CE box in order to route calls.
Setting up the PBX trunks in trixbox CE
All we need between the trixbox CE gateway system and the other PBX is a very simple SIP trunk. While you could get fancy and add in authentication, the only thing we will do is restrict the trunks based on the IP addresses.
Step 1: Create a new SIP trunk
In PEER Details:
Trunk Name: PBX-in
host=<ip address of PBX>
In the USER Details:
Trunk Name: PBX-Out
host=<ip address of PBX>
Step 2: Create an Outbound Route
This step is to allow you to route specific DID numbers to different PBX’s. Each DID that matches in the Dial Patterns will be sent to the trunk that is selected.
Select Intra Company Route
Enter DIDs into the Dial Patterns field
Select the trunk that points to the PBX that we created in step 1
In this example we have three DID’s that will be sent to a trunk we setup to a trixbox Pro system. At this point trixbox CE will know how to send a call to the second PBX, but we still need to tell it how to handle a call when it comes into the system.
Step 3: Create a Misc Destination
If the FreePBX code was simply able to route calls to trunks, then this step wouldn’t be needed, but since we need to actually “dial” the number for the call to get transferred we can create a Misc. Destination that will do what we want.
All we need to put into the Misc Destination is a description and the DID number we are transferring.
Step 4: Create an Inbound Route
As part of the previous step, trixbox CE has to know what to do with the call when it arrives into the system., the Misc Destination is an interim piece we need for this final step.
Go to Inbound Routes and create a new route, in the DID number put in the DID number we are going to match on, then at the bottom, set the Destination to the Misc Destination we created in the previous step.
To put this into a visual perspective, in the following graphic you can see how the call flow comes into the inbound route, is sent to the Misc Destination which then sends it through the outbound route.
Actually, the hard part is all done now and we just need to tell our PBXs to create trunks and send the calls to that trunk the same way we would with any other SIP provider. I will cover a few of the common IP PBX platforms quickly. If you are using another trixbox CE system, you just need to duplicate the trunk configuration above but change the IP addresses to point to the gateway server.
Setting up the route in trixbox Pro is dead simple, the only fields you need to enter anything into are a route name and the server IP (the gateway server IP address). In our setup, we just called our route “trixboxce” and set the Server field to the IP address of the trixbox CE gateway machine.
For the dialplan options in trixbox Pro, simply change all of the options to strip 1 digit. Depending on your SIP provider, you may have to change local calls to also prepend your local area code.
Setting up 3CX is also fairly simple. From the VOIP Provider setup tool, select Generic SIP provider, for the SIP server IP and Outbound proxy IP set those to the IP address of the trixbox CE gateway server, for the External number I used the DID number for this system, and for the Authentication I used 3CX even though it isn’t actually being used 3CX does require something in that field. You also have to have a number in the Maximum Simultaneous Calls fields so I just put a 4 in there for now.
You will also need to setup inbound and outbound dialing rules the same way you would for any other SIP trunk.
Following along the same lines as the previous examples, we just need to create a SIP trunk with the IP address pointed to the gateway server. Switchvox will insist on an account ID and password, just enter any text there to get past the screen. Setup the inbound and outbound routes the same as any other provider and you are set to go.
While needing a configuration like this may not be very common, there are certainly times that is can be quite helpful to be able to have multiple PBX systems on the same network and this solution will solve the problem with not being able to get the different systems to work properly with VoIP providers.