Cannot change Freeswitch ext-rtp-ip or sip-ext-ip

1,706 views
Skip to first unread message

Paul Kramer

unread,
Mar 17, 2013, 9:11:54 PM3/17/13
to 2600h...@googlegroups.com
Hi All,

I have a two server cluster running on EC2 where all components are installed on the two servers (courtesy of a chef-solo all-in-one installation). My Couch servers are replicating DBs nicely and I'm using DNS srv records for load balancing and resiliency for SIP requests. Currently there is no speech path between endpoints which I'm presuming is the result of the EC2 servers using 1-to-1 NAT via elastic public IPs. According to Freeswitch documentation, it should be as easy as setting ext-rtp-ip and ext-sip-ip to the elastic IP address for NAT to function correctly (http://wiki.freeswitch.org/wiki/Amazon_EC2). I have made this change in the /etc/freeswitch/sip_profiles/internal.xml file but running "sofia status profile sipinterface_1" continually echos the private IP address of the EC2 instance instead of the public IP that's in the internal.xml file. I've tried executing reloadxml and reload mod_sofia in addition to system reboots in vain. Has anyone else had experience with changing EC2 Freeswitch IPs?

Thanks,


Paul

James Aimonetti

unread,
Mar 17, 2013, 10:29:25 PM3/17/13
to 2600h...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Paul,

In general, we're moving to a Kazoo-based configuration for the
connected FreeSWITCH servers. One of the first configs to move is
sofia config for sipinterface_1. As such, our default FreeSWITCH
configs do not load mod_sofia as part of FreeSWITCH's startup (this
task is delegated to ecallmgr). When mod_kazoo/mod_erlang_event loads,
it will send configuration requests to ecallmgr, and expects XML in
response. When ecallmgr issues the "load mod_sofia" command, ecallmgr
receives a request for the sofia config XML, sends a response, and
therefore any config on the FreeSWITCH disk is ignored.

If you are going to edit the sofia configs manually, you'll need to
change the order in which mod_erlang_event (or mod_kazoo) and
mod_sofia load, such that mod_sofia is listed first, and FreeSWITCH
should ignore sofia config XML from ecallmgr.

Edit your modules.conf.xml, ensure the order is correct (and that
mod_sofia is specified), and you should start to see your changes
reflected when you issue reloadxml/reload mod_sofia.

Do note, that as we make changes to sofia's config for Kazoo, those
changes will likely be housed in the DBs and fed via ecallmgr, and
that your system may not have access to certain features or
capabilities because of it. We'll definitely work to keep everyone
apprised of those changes, but thought I should mention it before you
go too far down the manual changes path.
- --
James Aimonetti
Distributed Systems Engineer / DJ MC_

2600hz | http://2600hz.com
sip:ja...@2600hz.com
tel: 415.886.7905
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRRnwFAAoJENc77s1OYoGgcyIH/0F3bHXfqWzhKJJ7DVuWHqj9
JiLbiHprAFgX/4fx7A5PBiYhiqgHE4vwYgf2u6+K//TbN8rLxAlJflmt3kD3Aj+h
xz2wg5xWhW2twYgxeETHfHkm2j/iocrXDkJAZ6++ajq7/zC80PoPiCnr+9TzdXAC
i5Yf/iartGlEjLdFlPASM72HU9FsHGjZUQM18cEXe1ZT2QQbsC5ZJzzgvzC6co0T
sZlQ2ZWX1dkI9A2odAqiJYMo00yOkJKY60wsRcGChNHuG1qLn9Nd6EdD814LDEr2
SY21TTyg7RYDLkomAC4t2RLR4VFXGLjLSKKnGGCrfyQUBJFRG7cSmZUk9MNrzdg=
=B1lv
-----END PGP SIGNATURE-----

Paul Kramer

unread,
Mar 18, 2013, 12:58:15 AM3/18/13
to 2600h...@googlegroups.com, ja...@2600hz.com
As a quick fix I'll attempt to change the order of the modules in modules.conf.xml. Would it be possible to add a field in the ecallmgr configuration document to specify the public IP address of FS servers?

Paul

Paul Kramer

unread,
Mar 18, 2013, 1:13:36 AM3/18/13
to 2600h...@googlegroups.com, ja...@2600hz.com
After making the changes i'm now getting this error in fs_cli:

2013-03-18 05:11:23.405950 [ERR] mod_kazoo.c:865 Erlang connection acceptor socket error, could not listen on 0.0.0.0:8031

I tried running epmd -daemon and then restarting freeswitch (bluepill freeswitch restart) to no avail. The freeswitch server already existed when running the "/opt/kazoo/utils/sup/sup -n ecallmgr ecallmgr_maintenance add_fs_node" command. Any ideas?


Paul

Karl Anderson

unread,
Mar 18, 2013, 1:36:29 PM3/18/13
to 2600h...@googlegroups.com
Hi Paul,

This error indicates that something is already bound to port 8031 on your machine, or as you correctly attempted, epmd is not running.  You can determine what process is on that port via the linux command "netstat -nap | grep 8031".  You should see Freeswitch using it, if not you will need to stop the offending process.  Another thing to check is that you are not running both mod_erlang_event and mod_kazoo.  They will fight with eachother to acquire this port.  To check that, in the Freeswitch CLI issue "module_exists mod_erlang_event" and "module_exists mod_kazoo".  If both commands return true modify your "/etc/freeswitch/autoload_configs/modules.conf.xml" so only one of those modules is present (either).

For the sake of completeness the following is details on the relationship between mod_sofia and Kazoo:
The Freeswitch configuration files that we provide from our repo does not load mod_sofia (the Freeswitch SIP stack) when Freeswitch starts.  This is delegated to Kazoo, such that until Kazoo has connected to Freeswitch it will not accept any SIP traffic (which it would be unable to process anyway).  This is accomplished via Kazoo configuration in the database "system_config" on the document "ecallmgr" with the "fs_cmds" property.  This property is a list of Freeswitch commands to issue upon connection, and we usually configure this to load mod_sofia and reload the acls.  It would look something like this:

       "fs_cmds": [
           {
               "load": "mod_sofia"
           },
           {
               "reloadacl": ""
           }
       ]

Suppression of mod_sofia on startup is achieved by simply removing it from "/etc/freeswitch/autoload_configs/modules.conf.xml".

Recently, and controversially, Kazoo started providing the sip profile to Freeswitch overriding the flat file on disk.  The intent of this feature was/is to keep all of your Freeswitch servers configuration consistent.  However, at this stage the sip profile is simply hard-coded in https://github.com/2600hz/kazoo/blob/master/ecallmgr/src/ecallmgr_fs_config.erl making it, well lets say difficult, to change.  On recent versions you can disable this via the "system_config" database on the document "ecallmgr" with the " process_gateways" property.  It would look something like this:
 
    "process_gateways": false

The other way to address this is to load mod_sofia before Kazoo is connected so that there is no way for Kazoo to respond with the sofia profile.  This can be done by adding mod_sofia to the start up modules in "/etc/freeswitch/autoload_configs/modules.conf.xml".  However, if you do it this was and issue a sofia restart or rescan then it will load configs from the any connected Kazoo nodes.  This is normally not an issue as it would be done manually and generally only used by knowledgeable operators (aware of this caveat).

The gotcha that makes this even more complicated, mod_erlang_event does NOT support per-processor vars when fetching configuration.  Freeswitch has a concept of pre-processor vars ( http://wiki.freeswitch.org/wiki/Config_vars.xml) which hold information such as the local IPs.  When providing the sofia configuration these play a critical role allowing a static configuration to be customized to the server (in your case specifically " $${local_ip_v4}").  This means if you use mod_erlang_event you CAN NOT LOAD the sofia profiles from Kazoo as it will attempt to bind to a interface with the literal ip of " $${local_ip_v4}", and you would have to either load mod_sofia prior to Kazoo or disable process_gateways.

This is all complicated right now because this is a "work-in-progress" feature and we apologize.  However, when we are done this will mean you can configure your Freeswitch settings from the UI!  Spinning up a new Freeswitch node will be consistently configured and you will (hopefully) never have to touch an XML file again, so please bare with our dust as we continue to work on this functionality. 
--
You received this message because you are subscribed to the Google Groups "2600hz-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to 2600hz-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Paul Kramer

unread,
Mar 19, 2013, 8:44:06 AM3/19/13
to 2600h...@googlegroups.com
Thanks very much for clarifying that Karl - I've read your post a few times over now and its beginning to make sense. I thought as a test I'd try adding mod_sofia and leaving mod_kazoo in modules.xml.conf, booting up the server with no services started (ecallmgr, bigcouch, FS and whapps) and then ONLY starting FS to see if the flat file profile would load. No profiles are outputted in fs_cli from "sofia status". Would I be correct in saying that the profile found in /etc/freeswitch/sip_profiles/internal.xml should be loading? 

Also to stop Kazoo from loading mod_sofia, should I be changing the process_gateways property to true?

Thanks again for your input.


Paul
Reply all
Reply to author
Forward
0 new messages