IAX Bridge
IAX Bridge setup
Note: this isn’t accounting for firewall or VPN settings, purely from the PBX configuration side.
Information gathering
Before bridging instances, you’ll want to gather/create the following, best sticking to a standard.
- Trunk name - As an example, on PBX1 create PBX1-to-PBX2 and vice versa on PBX2
- Username - this will be the trunk name created on the PBX you’re connecting to
- PBX extension range to be added to dial plan
- A shared secret for authentication
Regarding the extension range, if you don’t want to use a prefix to dial the other site, the range should be unique to each instance. For example, PBX1 has extensions 1xxx to 3xxx and PBX2 has 4xxx to 6xxx.
Note that all variables are case sensitive. So PBX1 and Pbx1 are two different values, ensure that they’re entered the same in each relevant area.
Creating the Trunks
In FreePBX, head to Connectivity > Trunks
.
Select Add Trunk > Add IAX2 Trunk
General Tab
The following settings are subject to change, but work for current requirements.
Under the general tab, set the following:
Trunk Name: PBX$instance-to-PBX$instance
Hide CallerID: No
Outbout CallerID: N/A
CID Options: Allow Any CID
Maximum Channels: N/A
Asterisk Trunk Dial Options: System
Continue if Busy: No
Disable Trunk: No
Monitor Trunk Failures: No
Replace PBX$instance with the instance you’re configuring. For example, PBX1-to-PBX2 or PBX2-to-PBX1. This will be the username that the other site uses to connect with.
Dial Number Manipulation Rules
Leave blank for now.
iax2 settings Tab
Only the Outgoing section will be filled in here, incoming not required at this time, but should be reviewed in case it’s required for better security standards.
Trunk Name:
Under testing, Trunk Name
was set to match the name set in the General
tab
configuration.
Peer details:
username=PBX$instance-to-PBX$instance
type=friend
trunk=yes
transfer=no
secret=superSecureSharedSecret
qualifyfreqok=60000
qualify=yes
host=$ExternalIPAddress
forceencryption=yes
encryption=yes
context=from-internal
auth=md5
Set hostname
to the IP or hostname of the PBX you wish to connect to.
As mentioned before, the username will be the Trunk Name
created on the other
side. Using the example names, if you’re on PBX2, it would be PBX1-to-PBX2
.
Make sure that the shared secret is strong.
Select Submit
at the bottom of the page to commit the changes, then select
Apply
at the top to create the Trunk that we’ll be pointing to in the next
part of the configuration.
Outbound Routing
If configured correctly, we now have a trunk created to route traffic through
based on conditions that we’ll be setting next. As mentioned before, at this
time we won’t be using a prefix to communicate with the other side (i.e.
*775001
), so to ensure that everything goes through smoothly, unique
extension ranges should be used at each site.
For this example, PBX1 will use 1XXX and PBX2 will use 4XXX.
Head to Connectivity & Outbound Routes
from the Navigation bar.
{{ :pbx-route-1.png?direct |}}
Select Add Outbound Route
.
{ :pbx-route-2.png?direct |}}
Route Settings
Configure the Route Settings
tab to match the following:
Route Name: PBX$instance-to-PBX$instance
Route CID: N/A
Override Extension: No
Route Password: N/A
Route Type: Intra-Company
Music On Hold: default
Trunk Sequence for Matched Routes: PBX$instance-to-PBX$instance
Optional Destination on Congestion: Normal Congestion
{{ :pbx-route-3.png?direct |}}
Dial Patterns
This is where we set the conditions, that when matched, will route calls to meet our requirements.
**prepend**: N/A
**prefix**: N/A
**match pattern**: 4XXX
**caller id**: N/A
Leave the first two text boxes and the last box blank, and under match pattern
, enter the external sites range. As above 4XXX would mean that any
extension range matching 4000 to 4999 would be routed through the IAX2 trunk
that we’ve created.
{{ :pbx-route-4.png?direct |}}
Import/Export Patterns
Leave blank for now.
Additional Settings
Leave blank for now.
Select Submit
and once the page has reloaded, select Apply
to commit the changes fully.
Call Testing
You should now be able to test that calls route between the two branches, ensuring that the extensions registered match those configured in the two sections above. Extension 1001 registered to PBX1 should be able to dial extension 4001 on PBX2.