Freeswitch HA

From FreeSWITCH Wiki

Jump to: navigation, search

Contents

Introduction

At ClueCon MMX (2010) the FreeSWITCH team announced the call recovery feature that's now available in FreeSWITCH.

This feature means you can restart FreeSWITCH after a failure, and keep existing calls up with only a few seconds of audio dropped.

In the case of HA Clustered FreeSWITCH instances, you can automatically fail calls from box A to box B within a few seconds of a failure being detected. (typically 3-5 seconds)

Configuration Requirements

Track Calls

In the SIP profiles you must have track-calls enabled.

So if your call has 2 legs, you must enable track-calls on both profiles that the call uses.

This is done simply by using this config snip in your SIP profiles.

<param name="track-calls" value="true"/>

Be aware there is a minor performance hit using "track-calls" as call state (all session vars, similar to the mod_xml_cdr data) is stored in the core DB every time the channel state changes.

Failover to a Second Server

If you want to recover calls a second server, then you must have some way of sharing the sip_recovery SQL table between the servers.

ODBC is a possible method, and to do so, you must specify an ODBC dsn for all involved sip profiles (like you needed track-calls on all involved profiles).

<param name="odbc-dsn" value="dsn:username:password"/>


If you want to clone everything, you will also need to add DSN information to:

switch.conf.xml
voicemail.conf.xml (also you need to rsync/drbd/NAS share the actual voicemail files)

One caveat: the hostname on both machines need to be the same, as the sql query to recover calls selects by host name. This means that call recovery won't work on an active-active setup. Wbw
No, it works fine... Avi Marcus

Instruct FreeSWITCH to recover calls

To instruct FreeSWITCH to recover from a failure all you need to do is execute:

sofia recover


To crash test the feature, you may execute:

fsctl crash

HA configuration

  • TODO: Someone please fill this in as you play with this setup.
  • TODO: Heartbeat example Check the git-contrib in ledr/ha.d/ for some possibly good stuff.
  • TODO: UCarp config examples
  • TODO: Pacemaker config example


See also: Enterprise Deployment

Interesting links / snips

It is possible to bind FreeSWITCH to a floating IP that is not yet assigned to the box. These means FreeSWITCH can be in a ready & waiting state when the IP moves over, making the switchover much faster.

Normally, the OS will refuse to allow FreeSWITCH to listen on an IP that is not assigned. Sofia will get an error and the profile will not start.

On Linux you work around this using:

sysctl to set net.ipv4.ip_nonlocal_bind = 1
or
cat 1 > /proc/sys/net/ipv4/ip_nonlocal_bind
ubuntu: sysctl net.ipv4.ip_nonlocal_bind=1

These can be set on boot, either from a rc.d script or a /etc/sysctl.d/* file.

This means the OS will allow FreeSWITCH to use that IP even though it isn't yet assigned to the machine. It won't receive traffic or respond to ARP requests until the machine takes control of that IP, but will FS to be already started so that it'll start handling calls as soon as it fails over.

Personal tools

Community
Support FreeSWITCH