User Rating: 4 / 5

Star Active Star Active Star Active Star Active Star Inactive

As many people have asked me about the load balanced cluster; I have found that one of the most common issues is handling the correct way the incoming calls. The issue comes with some carriers as some won't allow hostnames and others allow a basic round-robin balancing which may present connectivity and delaying issues if the node in the balancing cluster is down.

I have come with a solution. It is basically adding an (at least 2-nodes) high availability cluster that acts as an SBC. You can think on this cluster as an extension of the load balanced cluster. I will explain how it works.

Why not Kamailio?

The first answer is because of personal preference. However, I have found that FreeSWITCH with the LUA script is very powerful. Coding with LUA you can do complex decisions, consult multiple and complex database queries, use Memcached and many other things. I do not doubt you can do it with Kamailio, but the LUA way (using FusionPBX libraries) is way too easy to do.

A Cluster Overview

This deployment has three sub-clusters:

  1. SIP Proxy cluster in a high availability mode
  2. SIP cluster in a load balanced mode
  3. Database cluster

fusionpbx enterprise deployment

The SIP Proxy Cluster consists of a little high availability cluster (also known as floating IP) that offers a single point of contact to the carriers. The cluster nodes are FusionPBX nodes that share the same database that the SIP Cluster (in load balanced mode) connects. This node has an LUA script that consults the shared information in the database cluster to do an educated guess. I will explain the scenarios in a moment.

Incoming Call Flow with FusionPBX as a Proxy

This is the best case scenario.

fusionpbx proxy with load balanced cluster incoming call

When an incoming call arrives, it will hit the floating IP from the SIP Proxy Cluster. The proxy node will analyze some information from the database such as dial plans, call detailed records and current registrations. After that, the node will forward the SIP INVITE signal to the proper SIP node (where the user is registered).

As you see, the RTP flow is between the carrier and the SIP node. The SIP Proxy node does not touch the RTP.

Now, the worst case scenario. Sometimes, the SIP Proxy node will not be able to know where the user is registered. Therefore, the call flow is as follows.

fusionpbx proxy with load balanced cluster incoming call worst case

If the SIP Proxy node forwards to a SIP node where the user is not registered, the SIP node will forward the SIP INVITE signal to the correct peer. This is the same scenario as an inter-PBX call. The RTP will flow between the carrier and the SIP node.

Outgoing Call Flow with FusionPBX as a Proxy

Nothing to say, the SIP node interacts directly with the carrier.

fusionpbx proxy with load balanced cluster outgoing call

Pros, Cons and Side Effects of a SIP Proxy FusionPBX Cluster

The first thing a cluster holder needs to remember is that the SIP Proxy Cluster is a high availability cluster on top of a load balanced cluster. So, first let's talk about the pros:

  • You can use any kind of carrier. With that said, remember there are some odd carriers that only allow a single IP. This doesn't work with a load balanced cluster, as you really can trust the node is always up. Some other carriers let you configure more than one IP and you can configure a simple round-robin strategy, if you weren't using a SIP proxy, this will increase the load in the SIP cluster; if the given SIP cluster node was down, the caller would experience a dead air as the carrier will need to timeout the first attempt before continuing with the following node.
  • It can be deployed in the cloud. Because it only processes SIP signalling, the sizing of the server is smaller. A medium to big VPS from a data center that allows floating IP would cover this.
  • You don't need Kamailio: although it is a great programable SIP proxy, you do not need to add another technology. FreeSWITCH in combination with FusionPBX will give you a WEB interface and an easy way to manage.

Now the cons:

  • Your database cluster load will increase as each time an incoming call happens, there are several queries.

Some side effects could be:

  • None. adding a SIP Proxy cluster on top of a load balanced cluster won't add any additional side effect.

How can I get a SIP Proxy Cluster?

Easy, just send me a text. I am pretty sure we can work something out.

Good luck!


blog comments powered by Disqus


Read about IT, Migration, Business, Money, Marketing and other subjects.

Some subjects: FusionPBX, FreeSWITCH, Linux, Security, Canada, Cryptocurrency, Trading.