Table of Contents | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Can I connect two FreePBX/Asterisk Systems Together Over the Internet?
Yes. You can connect as many systems as you want together over the internet, even if all of them are behind a NAT Firewall. For the purpose of this Configuration Guide, we're going to assume that you have two systems, configured as listed below:
...
Configure an IAX2 Trunk on System1, The Trunk will establish a connection with System2.
Configure an Outbound Route on System1. The Route will tell System1 which calls to send out to System2.
Configure an IAX2 Trunk on System2. The Trunk will establish a connection with System1.
Configure an Outbound Route on System2. The Route will tell System2 which calls to send out to System1.
1. Configure an IAX2 Trunk on System1
Access the Trunks Module on System1.
...
Replace System1, System2, CallerID and password with whatever you want. However, be consistent! If you change System1, System2, or password in one spot, you must change it to the same thing in all of the other spots (on both systems).
Capitalization Matters: System1 is not the same as system1 or SYSTEM1.
If you have trouble making calls, your version of Asterisk may not have the encryption routines installed. Try deleting the last three lines in the PEER details on both systems.
If you only want to be able to place calls to the remote system, but do not want the remote system to be able to call you directly, change "context=from-internal" to "context=from-trunk".
If one of your systems has a dynamic IP address, you should register that system with a dynamic DNS service like DYNDNS and use domain names (i.e., xxxxxx.dyndns.com) instead of IP addresses in the host= field.
2. Configure an Outbound Route on System1
Access the Outbound Routes Module on System1.
...
() + *81 | 5X () + *81 | *805X | If a user dials *81 and then extension 50 to 59, the *81 will be removed and the rest will be sent to System1 If a user dials *81 and then *80 and then extension 50 to 59, the *81 will be removed and the rest will be sent to System1 This is used for intercom calls. |
---|
3. Configure an IAX2 Trunk on System2
Access the Trunks Module on System2.
...
Notes: See the notes above, with respect to "Configure an IAX2 Trunk on System 1."
4. Configure an Outbound Route on System2
Access the Outbound Routes Module on System2.
...
() + *81 | 4X () + *81 | *804X | If a user dials *81 and then extension 40 to 49, the *81 will be removed and the rest will be sent to System1 If a user dials *81 and then *80 and then extension 40 to 49, the *81 will be removed and the rest will be sent to System1. This is used for intercom calls. |
---|
What Ports do I need to Forward?
None.
If you use IAX2 Trunks and configure them as indicated above, the IAX2 protocol will keep the ports open for the other system.
What If I Want to Connect More Than Two Systems?
There are two ways to do this.
You can connect each system to the other independently following the instructions above, i.e.
System 1 to System 2
System 1 to System 3
System 2 to System 1
System 2 to System 3
System 3 to System 1
System 3 to System 2
You can:
Connect System 1 to System 2
Connect System 2 to System 3
Configure the Outbound Route on System 1 to send calls intended for System 3 to System 2, which will then forward those calls to System 3.
Configure the Outbound Route on System 3 to send calls intended for System 1 to System 2, which will then forward those calls to System 1.
The first option is far more reliable, as it permits each system to connect directly to each other system.
What if I want to use SIP Trunks?
If you want to use SIP Trunks, then at least one of your two systems must have external ports forwarded or be exposed directly to the internet. Setup is much more complicated, and you should also carefully set-up your firewall to keep out unauthorized users.