HA FreeSWITCH two nodes Amazon

Not open for further replies.


Feb 24, 2020
I have such schematic: Kamailio (dispatching) - FusionPBX1, FusionPBX2 - EFS (shared configs, cashe) - RTPEngine - RDS (PSQL) and also NGINX server for the FusionPBX web load balancing.
Each FusionPBX server has 1 internal IP address that is used for communication with Kamailio for SIP and RTPEnginge for media. FusionPBX nodes are in the master-master mode.
The call has such flow:
SIP part: IP_Phone ---> (external IP) Kamailio (internal_IP) ---> (internal_IP) FusionPBX (internal_IP) ---> back to Kamailio (external_IP) ---> IP_Phone
RTP part: IP_Phone ---> (external_IP) RTPEngine (internal_IP) ---> (internal_IP) FusionPBX (internal_IP) ---> back to RTPEngine (external_IP) ---> IP_Phone

It works fine, but now I want to set HA for the FreeSWITCH. The goal is to restore calls if one of the FS fails.
For that I turned on at the sip profiles:
<param name="track-calls" value="true"/>
And also I use the remote database for storing all the FreeSWITCH and FusionPBX settings that is shared between two nodes.

And tested:
1) Made a call, the call went to one of the FusionPBX server and due to the dialplan it went to the media playback, and I heard the Spanish guitar )
2) At the server with the call I made:
fs_cli -x 'fsctl crash'
3) And at the second FusionPBX server:
fs_cli -x 'sofia recover' and I got an error:
[ERR] switch_core_media.c:9669 AUDIO RTP REPORTS ERROR: [Bind Error!]
The call wasn't crashed, but no media. - this the IP-address of the first FusionPBX.

I understand the root of this error: FreeSWITCH can't bind the IP-address from another server.
I want to ask you about the way to solve this problem.
I want to set up such a schematic:
1) Add to the FusionPBX servers 3 network interfaces :
- one interface for the communication with Kamailio and RTPEngine,
- second is reserved for part (2)
- and the third interface for the SSH access
2) Write a script that will send requests to the FusionPBX server (using sipsack for example) and if there is no response from another FusionPBX server - move its IP address to the second network interface and then run:
fs_cli -x 'sofia recover'
Then if the server get the IP-address of the second server I could bind the RTP stream (if the port wasn't binded earlier of course)
The second step can be done by a bash-script using sipsack of using Amazon cloudwatch, I haven't used AWS Cloudwatch before, so I don't know is it possible.

Is this a normal solution or maybe it is already done by someone? Or maybe you can advise the better way?
Thanks in advance!
Not open for further replies.