Freeswitch Fail Over/CARP



  • I'm running a dual pfSense CARP fail over configuration. I'm also using freeswitch in pfSense to route SIP calls to multiple internal hosts. I have the same version of freeswitch on both routers. I tried backing up the freeswitch system, using the button in the freeswitch status screen, in the master and restoring it in the backup but the public dialplan does not restore. If I copy over the /usr/local/freeswitch/conf/dialplan/public contents from the master to the backup, they don't show up in the gui on the backup. I don't know if this is a gui issue or if the public dialplan would really be ignored in a fail over situation.

    While I need to find out what I'm doing wrong so I can try a fail over to see if SIP at least resumes on the backup firewall, what I'd really like would be CARP support. There was a reference to some work being done on CARP and freeswitch in an earlier post and I was wondering what the status of this development was. If there is progress on CARP and freeswitch, will the call states be shadowed so that the calls will be maintained or will we disconnect them all in a fail over situation.

    Thanks for the excellant effort on pfSense and freewitch! It was there and worked when I needed it.



  • The public dialplan and other configuration setting for the freeswitch package is stored in pfSense's xml configuration.
    /cf/conf/config.xml

    The settings are stored in the pfsense config but are used to write the freeswitch xml config that is located in /usr/local/freeswitch/conf

    The backup in the pfsense freeswitch package on the status page backs up:
    /usr/local/freeswitch

    At this point I think Failover is possible but you would loose active calls.

    /usr/local/freeswitch files and settings could be kept in sync using rsync. You can add this to your pfsense firewall using.
    pkg_add -r rsync



  • Thanks for the reply Mark. I'll be setting up rsync tomorrow when I'm on site and will be trying to test fail-over. It should be possible to test the initial configuration before it starts growing.

    If the GUI is maintaining the pfSence configuration which is later written to the freeswitch conf directory, am I correct in assuming that freeswitch is running off the pfSense configuration and not the freeswitch/conf, at least for the dialplan? If so, then when I rsync the master freeswitch conf data to the backup, is there a process to write the freeswitch/conf dialplan back to the pfSense configuration?

    I saw an earlier post that said you were starting to work on CARP and failover in freeswitch. In your opinion, will it be possible, eventually, to failover freeswitch without call loss? This would be perfect in our case.



  • @bmcandrews:

    freeswitch is running off the pfSense configuration and not the freeswitch/conf, at least for the dialplan? If so, then when I rsync the master freeswitch conf data to the backup, is there a process to write the freeswitch/conf dialplan back to the pfSense configuration?

    Most of the configuration is stored in the pfsense config other than the text areas such as the dialplan and the sip profiles.
    pfSense stores the settings but they are used to write the config freeswitch/conf files which is what freeswitch uses.

    @bmcandrews:

    I saw an earlier post that said you were starting to work on CARP and failover in freeswitch. In your opinion, will it be possible, eventually, to failover freeswitch without call loss? This would be perfect in our case.

    I don't believe failover without call loss is possible yet. See this thread for more information
    http://lists.freeswitch.org/pipermail/freeswitch-users/2008-September/005874.html
    http://www.nabble.com/Freeswitch-Failover-td25663037.html



  • Thanks again!

    Just to confirm, all GUI maintenance happens on the master router; the freeswitch/conf directory is rSynced to the backup; if on the backup freeswitch will be running on the dialplan from the master router but the GUI will be wrong as far as dialplan is concerned.

    In my configuration I have the external profile and a renamed copy of the external profile bound to 2 external ports for carrier access. I'm bridging calls via an internal subnet carrying only SIP traffic that the lan profile is bound to. Before I ran the failover test Wednesday, I changed the lan ip address to the CARP address for the interface. The test worked in that the backup router answered and bridged the call but there was about a 10-11 second delay before the audio came through. When I brought up the master router again I had the same delay. I have since returned the ip address to the router's address and the delay is gone. I'm considering using an external style profile on the lan since it's an internal trunk to another switch. Is this a good idea or a mistake?



  • By default the Internal and External SIP profile get their ip using:
    $${local_ip_v4}

    The local_ip_v4 is usually auto discovered but you can force it to be the ip address that you want by doing the following. On the vars tab set the local_ip_v4 to the CARP ip address then restart FreeSWITCH.
    <x-pre-process cmd="set" data="local_ip_v4=0.0.0.0">If you have a static external ip address you could also save time by changing external_sip_ip and external_rtp_ip from the 'vars' tab.
    external_sip_ip: stun:stun.freeswitch.org
    external_rtp_ip: stun:stun.freeswitch.org

    Instead of stun set these to the ip address or the domain name.</x-pre-process>


Log in to reply