Running multiple FreePBX instances behind one IP


#1

One of clients is telling me calls don’t seem to reach the PBX on location. Since I have the exact same setup but with a more stable internet connection, I was thinking of cloning my client’s setup to my virtual machine host and have his phones connect to my IP address over the internet to test my theory it’s his connection. I don’t mind my FreePBX going down for a couple of days, but if this doesn’t have to, I’d rather run 2 instances on my server. Is this possible? Will calls find their way to either my or my client’s instance? I currently don’t have any ports opened on my firewall for incoming calls, to be honest I don’t know how calls find their way to my FreePBX, it must be magic, so I’m not sure how it will work with 2 FreePBX installs behind 1 connection. If not possible, I’ll simply shutdown my server and maybe forward all calls from my client’s server during its stay on my server.


#2

Two PBXes on the same IP will require that the SIP and RTP ports don’t conflict, which means that you will have to change them on one of the systems.

I recommend a cloud system instead. IMO Vultr is a good choice as you can install the ISO directly. They give you a small credit at signup so you can test without making a payment.


#3

So basically change the RTP port range from 10000-20000 to 30000-40000 for example should do the trick? Since I’m using my own PBX internally I won’t be needing to change SIP and only forward the SIP port to my client’s install on my firewall?

Is this something the Trunk provider will pick up automatically when the server reconnects with those settings? They don’t have any port settings.

Does vultr support OVA files?


#4

If you forward an external port to a different internal port, that will not work correctly with Asterisk.

If you forward e.g. port 5060 to server A, then server B’s requests from port 5060 will have the source port rewritten, which will likely also cause trouble.

Vultr doesn’t accept OVA directly, but see https://www.vultr.com/docs/import-a-server-to-vultr-vps


#5

My phones connect to the internal IP of my PBX so no forwarding necessary. My client’s phones will connect over the internet on port 5060 which will be forwarded to his server. I don’t really see issues their, I mostly “fear” the RTP ports.


#6

I changed the RTP range to 20001-30000 on my instance and shutdown and rebooted the system. Without issues the system reconnected to the trunk provider and calls were coming in. I will now propose moving my client’s instance to my server on 10000-20000 to test if problems lay in the internet connection or internal network.

Fingers crossed.


#7

Humm… server up and running, registered with the trunk, but now the phones won’t register with the PBX despite port forwarding (5060 udp) set up. This is not my PBX week.


#8

Well, are they attempting connection to the new IP address? Doing SIP over UDP on port 5060?

Does sngrep show REGISTER requests?
If so but no replies, a FreePBX firewall or fail2ban issue.
If so, with (error) replies, what does the Asterisk log show?
If nothing in sngrep, capture traffic on the WAN side of your hardware firewall and see whether the requests are getting there.


#9

I did change one of the phones to the new (my) external IP and opened 5060/udp on my firewall and forwarded it to the internal IP of client’s IP, yes. Just to make sure, I even disabled the firewall on the FreePBX.

Does FreePBX except connections from everywhere by default?


#10

I have put a script in place that checks the registry every minute:

#!/bin/bash
check=`/usr/sbin/asterisk -rx 'sip show registry'`

if [[ ${check} != *"1 SIP registrations."* ]]; then
  echo -e "CheapConnect down" | mail -s "CheapConnect down" [mail address]
fi

I also added the a script with the following contents to “Monitor Trunk Failures”:

#!/bin/bash
echo -e "CheapConnect down" | mail -s "CheapConnect down" [mail address]

I have also found out that when I run the following command (/usr/sbin/asterisk -rx ‘sip show registry’) my client’s server shows a refresh of 285 where my server shows only 105. Does this mean my client’s server will connect 3 minutes slower than my server in case of an outage? If so: how can I change this setting? I would expect it to be the setting “Registration Default Expiry” under “settings > sip settings > chan sip” but they’re the same on both servers.