[Freeswitch-users] High Availability and hostname used by Sofia
Leon de Rooij
leon at scarlet-internet.nl
Mon Oct 4 04:57:53 PDT 2010
Hello List,
This is going to be a long mail, please bear with me :-)
I'd like to configure High Availability for a FreeSWITCH installation
by using a failover server. I already discussed it a bit with Sekil on
IRC, but I thought it'd be useful to discuss it here as well.
The idea is as follows:
- I have 2 servers both with an identical FreeSWITCH installation, FS1
and FS2.
- Both servers have different static IP's but also one floating IP by
means of heartbeat / haresources.
- Both FS instances have one Sofia SIP profile that use the floating IP.
- Both FS instances are always started (so the backup server will fail
to load its SIP profile because the IP is not configured - which is
expected behaviour)
- There'll be a /etc/ha.d/resource.d "resource script" that starts the
SIP profile (through fs_cli -x) the moment it becomes primary
- The resource script will also send a "sofia recover" after the SIP
profile has been brought up
This way:
- There'll be one logical switch.
- The moment FS2 becomes primary, users will be reachable through the
entry in 'sip_registrations' table in the ODBC db, even though they
may have registered on FS1
- FS2 will start to send SIP options to NAT'ed useragents (keepalive /
udp hole punching) the moment the SIP profile is started.
- No client useragent involvement is necessary when failing over (like
re-register)
- Running calls will be continued because of the "sofia recover"
Only problem here is that when a useragent registers to us, then FS
also stores its own hostname in "sip_registrations" table in the
columns "hostname" and "orig_hostname" (from
mod_sofia_globals.hostname). This column is also used in the SELECT
query when bridging to a user - so that means if the user registered
to FS1, then a failover happens, then if a call is bridged towards
that user on FS2, it won't find it because it will search with FS2's
hostname in the SELECT query, right ?
If everything I'm writing so far is correct, then would it be alright
to override the hostname in sofia.conf ? I think that would solve my
problem. I already looked it up - it is first set in mod_sofia.c at
line 4565 through gethostname(). It can be overriden in sofia.c
(function config_sofia) around line 2845. It would probably also work
to give both hosts an identical hostname in the OS, but I don't like
that (because of rsyslog and more).
I'm not convinced yet on how to proceed, please let me know if I'm
going the wrong direction. If I'm successful on getting this running,
I'll document everything on the wiki - also the haresources script I
already wrote I'll put in my contrib dir (or elsewhere in main tree if
preferred).
Thanks for your time,
Leon
More information about the FreeSWITCH-users
mailing list