Setup multiple FreePBX in datacenter

Hi, pretty new here and to FreePBX/Asterisk, so please bear with me for my maybe stupid questions.

I have a PfSense firewall running, I do use FreePBX 13 and they are running as virtual Hyper-V guests on a 2012R2 server.

Can I have more than 1 FreePBX behind 1 public IP, or does it need to be 1 FreePBX for every Public IP?

I did manage to get 1 phone connected remotely to FreePBX server 1, but when i tried to do the 2nd phone remotely (same location as phone 1) it failed.

Do i need VPN (would really want to avoid it)?

I have no problems getting the SIP Trunk up and running on the FreePBX.

I have several customers we want to move to their own FreePBX server and would like to host all of these customers on our datacenter servers.

What would be the best approach ?

I did read about TLS and SRTP?

thanks for your time and replies, they are really appreciated

/Kenneth

Can I have more than 1 FreePBX behind 1 public IP, or does it need to be 1 FreePBX for every Public IP?

Depends on your trunking provider - in theory yes, but in practice, it’s kind of hard - but doable - you just need a consistent and coherent plan and map for what uses what port - A carrier we used ignored the port, so we had to use separate IP’s.

I did manage to get 1 phone connected remotely to FreePBX server 1, but when i tried to do the 2nd phone remotely (same location as phone 1) it failed.

That sounds like a Far-End Firewall Problem - we have clients with 30+ phones from a single remote location connecting to a VM Server no problem - look at the Firewall on the Far End - My guess is it has a SIP ALG - TURN IT OFF!!!

Do i need VPN (would really want to avoid it)?

Sometimes, but understand you lose QOS Tagging with VPN (it’s hidden) - it’s fine on High-Bandwidth connections, but if Bandwidth is low, voice quality can suffer.

I have several customers we want to move to their own FreePBX server and would like to host all of these customers on our datacenter servers.

Yup - Us too - you REALLY need to think about redundancy - It’s all well and good to have a customer or two down, but when 50 of them are in your Datacenter and they ALL go down, you are heading for un-employment!

Hyper-V Can really help you here, but there are a couple of things to read about and practice before you actually have to use them:

  1. FIXED MAC address on all the FreePBX Machines - so they can be moved while running.

  2. CPU Compatability under Hyper-V Checked unless all your Host machines are IDENTICAL - Again - for moving while they are running.

  3. Replication - So that if a Host goes down, you can fire up a Replica and reduce Downtime!

  4. Redundant Network Connections with either a Static Block of IP’s and BGP or a Software Defined Networking Company (we love http://www.bigleaf.net) so that if a connection goes down, you keep going - also for maintenance on the connections - at LEAST two connections, each with enough Bandwidth to carry the complete load.

I did read about TLS and SRTP?

If they are a customer requirement, they are doable - fiddly, but doable.

PM me if you want any more information - we have been doing it this way for a while.

1 Like

A possibly cleaner solution might be to put a true SIP proxy (Kamailio perhaps) between your FreePBI and the Internet, it will negotiate and handoff appropriately all inbound and outbound calls between your various providers and your Asterisk B2BUAs.

You can of course apply byzantine firewall rules to seperate all Sessions by external IP/PORT and internal IP/PORT, but you don’t need to with a properly configured proxy. As a further bonus, you would only need to maintain one firewall (on the proxy)

Hi Greg

Thanks for your replies. Was not able to find a place/link where I could write you a PM?

When you say far end firewall, do you mean the firewall at the server side or the phone side?

I do not want to complicate things, so we are going to use 1 public IP for every FreePBX. Also minimize the risk for a firewall change to take down multiple customers.

Yes, I know how to assign a mac address to any guest, thanks for the info.

We have redundant 1 Gbit in the datacenter, and all hosts are connected with multiple nics with failover configured, so they should stay up even if a switch should go down.

On the phone side firewall we only need to open 5060, 5061 udp and 10,000-20,000 udp and lock it down to the FreePBX public Ip and to any ip on the inside, correct?

Would you recommend using 2 interfaces on the FreePBX, one for clients and another for Siptrunk? or it doesnt matter?

Any recommendations on firewalls?

We have a bunch of Sonicwalls running, some Asus AC router and PfSense.

Thx for your help… it broght me a few steps closer to my goal…

Hi Dicko

We rather stay away from to many different unit or appliances. I dont even know half of the different units you are suggesting :wink:

What is B2BUAs ?

So this SIP Proxy will be able to handle Sip trunk providers and clients remote phones. Will it handle multiple servers/customers and their phones signing in and making and receiving calls?

kind regards,
Kenneth

If you are using pfsense then they have siproxd to expand on their possible sip traversal , it will help simple scenarios but only to an extant, sessions initiation protocol (SIP) can negotiate ip address, port, caller number and caller destination, and settle on a resultant channel for voice pictures text messages or even movies. Kamailio can do the same but works better for voip.

Back to back user agent, inserts the software between the caller and the caller, fine for a private branch exchange (PBX) not so much for your anticipated public exchange on one ip

So to answer you question, it will do all that waht it won’t do is allow for provisioning over individual servers without tunnelling, if you don’t tunnel then your ucp/fop2/everything will be highly problematic

Hi!

See this (and follow the link):

Good luck and have a nice day!

Nick

Hi Nick

Thank you for the VERY useful information…

Ill work to get to level 1, and level 2 will not be within reach as Im a complete novice on the FreePBX…

/Kenneth

This thread got busy after I replied - I will try to answer everything I know…

First, to Dicko’s point, Kamailio is one hell of a Project - I actually talked one of the developers at the last Astricon I attended - I want very badly to implement it because it does have a lot of reliability features built in - but it also has a lot of complexity to manage and we are currently in the process of training our tech staff up to par - Kamailio right now is that extra step too far - for now. In the future, you bet!

So to answer you question, it will do all that what it won’t do is allow for provisioning over individual servers without tunneling, if you don’t tunnel then your ucp/fop2/everything will be highly problematic

This is why we went with an IP per box and why we are using a SonicWALL to hide all the Customer PBX’s behind it - FreePBX uses MANY different ports for all the services it offers. Multiply that times the number of PBX’s you are contemplating and Port Management on the same IP get’s tricky - and provisioning in the wild is a requirement - so we went with 1 IP per box. This is why we also used a Software Defined Networking company (Bigleaf) - they can give me the IPV4 space I need to have one per box.

Something else to really think about is Zero-Day exploits - no one wants to think about it, but it happens and when it does, if you have 1 box to protect, you shut off whatever service is affected until the hole is fixed and you are safe - but imagine if you have 50 boxes to individually turn off a service - then it gets to be a pain.

SonicWALL (and I assume all competent Firewalls) has the ability to “Template” the services offered to any individual IP address - so all my protected boxes have the same services on the same ports exposed to the Internet - but for instance, if someone discovers a Zero-Day exploit on the UCP interface for FreePBX, it is two clicks of the mouse to close that port for ALL my boxes - this is why we don’t use the Sangoma Firewall - I like it very much for stand alone boxes, but when you are dealing with LOTS of boxes, it’s too many individual places to go to fix the problem.

When you say far end firewall, do you mean the firewall at the server side or the phone side?

Phone Side.

I do not want to complicate things, so we are going to use 1 public IP for every FreePBX. Also minimize the risk for a firewall change to take down multiple customers.

That is the conclusion we came to also.

On the phone side firewall we only need to open 5060, 5061 udp and 10,000-20,000 udp and lock it down to the FreePBX public Ip and to any ip on the inside, correct?

If you only want to allow phones to talk, yes - but I like remote Admin, Provisioning, and UCP, so I open those ports as well - Provisioning can be done with Authenticated HTTP and it works very well - so we use that.

Would you recommend using 2 interfaces on the FreePBX, one for clients and another for Siptrunk? or it doesnt matter?

We are actually using the Link Aggregation in Hyper-V, so we only use a single interface in the VM and it works well.

Any recommendations on firewalls?

SonicWALL - it has done very well by us over the years and you will find lots of people that have knowledge on them - and since they broke away from Dell, they have a renewed sense of purpose - I like them LOTS but most Competent firewalls are fine - the only one we have consistently had trouble with is Fortinet - those things suck!

Sorry this is so long.

Hi Kenneth!

Level 2 is within your reach, it might take a little more time but it is still within reach…

Level 3 (“regular”) I doubt is, at least for now. It requires you to do a lot more things and you can actually lose it if you are unable to come here and participate…

At one point I was level 3 but I lost it since I could not come here as much…

Good luck and have a nice day!

Nick

Hi Greg

Im still not able to register phones over the internet, and I had Sonicwall support on a remote session to verify settings on the firewall to make sure the error is not on the Sonicwall side.

Sonicwall support said, that there is no response from the FreePBX server side coming in…

I have configured some rules at the PFsense firewall to allow communication:

NAT rules:

TCP/UDP 5160
udp 10000-20000
tcp/udp 5060-5061

Firewall rules:

destination internal IP
source any
and the same rules as above

(the firewall rules are autocreated when doing the nat rules)

I have disabled the firewall on the FreePBX to make sure that is not the showstopper here… I have restarted the freepbx server with amportal restart command.

I dont know what is wrong. We have other services run on the PFsense that works flawlessly… Backup services and mail services. There is no port conflicts as they all use different ports.

On the sonicwall i have enabled consistent NAT
do I need to activate SIP transformations?

kind regards,
Kenneth

5160 is not the standard port for most phones - make sure they are set to use that port on the Server Setup.

Also, make sure you check under System Admin -> Intrusion Detection and make sure your IP that the phones are coming from is White Listed - it’s embarrassing how often that one trips you up when you are setting up phones for the first time.

You can turn on sip debug (if you are using Chan-SIP) with sip set debug on and then watch the phones try and connect - although on a busy system, it’s a little hard to see the message you want.

As a Last Resort, do a TCP dump on the Asterisk and look at it in Wireshark - just to make sure you are seeing the packets.

Well we are making progress…

Now i get a register failed within 2 seconds when I try to register the phone with the FreePBX server…

You were right with the whitelist, that is a stupid mistake I should have caught …

Im sure im using the right credentials, and I changed them to something simple so I know what they are

What could the next error be?

Somewhere I can see what the error on the FreePBX side is?

kind regards,
Kenneth Knudsen

Hi Greg

I get the error message on the FreePBX:

no matching endpoint found and authentication failed

kind regards,
Kenneth

This is usually indicative of setting up an endpoint in one channel driver (Chan-SIP, for example) and then trying to register with the other channel driver (PJ-SIP, for example). Double check your port settings and make sure you set the extension up in the right channel driver.

Hi there

Well I got it going now. I deleted all the rules on the PfSense regarding FreePBX and started all from scratch.

I was able to register 2 phones from the same office to the FreePBX server in the DC. I took one phone home and connected to the internet, and it is also working here at my home office, so my first goal was achieved

Thanks for all the pointers, they helped me in the right direction.

How many sip trunks can I have on the FreePBX server?

If i was to make a general server with only the most basic configuration, and I was to have every extension to have its own sip trunk? Or should I just sell the trunk directly?

kind regards,
Kenneth

Kenneth,

Im not sure you entirely understand how sip trunking works with freepbx, I would read up on wiki to get a better understanding.

But to put you in the right direction, you only need 1 trunk to operate. The provider then sells you more “trunks”, but in reality your buying more consecutive channels.

Hi

Yes, but if I want to bill each extension based on their usage, then it would be a lot easier with a sip trunk for every single or group of extensions.

Lets say if have 20 customers each with only one extension, then it would be more efficient for me to have 1 FreePBX instead of 20 …

But my question was if you can connect a VoIP phone directly to a siptrunk? Then eliminating the need for FreePBX if there is only one 1 phone (1 customer)?

Kind Regards,
Kenneth

You have stumbled into the thing that FreePBX sucks at - multi-tenant operations. No matter how you do it, it’s not going to work as well as you hope. Asterisk will always answer with the trunk that the alphabetically first in line.

I recommend you go with a provider that can provide usage statistics based on inbound and outbound DID information. That way you have a chance of getting their usage information correct.

The other opportunity is to give them “unlimited” calling. My providers are all in the sub-cent per minute range, so if I charge a penny a minute for business hours, I can charge a flat $9.95 a month and (at worst) break even. PM me for more.