Automatically setting Freeswitch ext-rtp-ip and ext-sip-ip with Elastic Address

AllCloud Blog:
Cloud Insights and Innovation

When you run Freeswitch on EC2 you need to configureĀ “ext-rtp-ip” and “ext-sip-ip” on the sip profiles, to do this I added the following script to Freeswitch startup file

http_code=$(curl -sL -w "%{http_code}" -o /tmp/$$ "")
if [ $? -eq 0 ] && [ $http_code -eq 200 ]; then
elastic_ip=$(cat /tmp/$$)
cat /usr/local/freeswitch/conf/sip_profiles/external.xml.orig |sed "s/autonat:x.x.x.x/autonat:${elastic_ip}/" >/usr/local/freeswitch/conf/sip_profiles/external.xml
rm -rf /tmp/$$

Lahav Savir

Founder and CTO, Cloud Platforms

Read more posts by Lahav Savir