Amazon EC2
From FreeSWITCH Wiki
Contents |
Getting Started
There is not much difference between running on Amazon Elastic Cloud than any other Linux server, but here are a few things to keep in mind.
Opening Firewall Ports
SIP
ec2-authorize default -P udp -p 5060
RTP
ec2-authorize default -P udp -p 16384-32768
The RTP port range given should match your configuration in switch.conf.xml.
Additional EC2 NAT Notes
For SIP, setup a security group with the following ports enabled (easiest to do with Elasticfox):
udp 16384:32768 udp 4569 udp 5060 tcp 5060 udp 5080 tcp 5080 tcp 8000 udp 8000
Make sure you make the security group, and apply it before you boot the instance. After this, the quick and dirty install guide worked just fine for me. You'll just need to tweak the default dialplan to your needs.
You may also need to make some of the following changes, particularly the external sip and rtp IP's (for which you will need to create an Elastic IP and attach it to your Instance.)
conf/vars.xml
<X-PRE-PROCESS cmd="set" data="bind_server_ip=<AWS EIP>"/> <X-PRE-PROCESS cmd="set" data="external_rtp_ip=<AWS EIP>"/> <X-PRE-PROCESS cmd="set" data="external_sip_ip=<AWS EIP>"/>
conf/sip_profiles/internal.xml
<param name="aggressive-nat-detection" value="true"/>
<param name="multiple-registrations" value="true"/>
<param name="ext-rtp-ip" value="$${external_rtp_ip}"/>
<param name="ext-sip-ip" value="$${external_sip_ip}"/>
<param name="NDLB-received-in-nat-reg-contact" value="true"/>
<param name="NDLB-force-rport" value="true"/>
<param name="NDLB-broken-auth-hash" value="true"/>
<param name="enable-timer" value="false"/>
conf/sip_profiles/external.xml
<param name="aggressive-nat-detection" value="true"/>
<param name="ext-rtp-ip" value="$${external_rtp_ip}"/>
<param name="ext-sip-ip" value="$${external_sip_ip}"/>
<param name="NDLB-force-rport" value="true"/>
conf/autoload/switch.conf.xml
<param name="rtp-start-port" value="16384"/> <param name="rtp-end-port" value="32768"/>
Sofia External IP Config
You shouldn't have to make any changes to the Sofia profile. The FreeSWITCH Auto NAT feature will take care of this automatically. However, if you want to do this manually, edit the sip_profiles/internal.xml file and replace auto-nat with the external IP address in the ext-rtp-ip and ext-sip-ip parameters.
External Links
- Amazon EC2 subwiki - Getting started guide and links to documentation.
FAQ
Q: What distro should I use?
Its up to you! However, some recommend CentOS.
Q: Are there any public AMI images with FreeSWITCH pre-installed?
Ans: As of Sept. 3, 2008, running.
ec2-describe-images -x all | grep freeswitch
From the amazon cloud command line utility yields:
IMAGE ami-999672f0 freeswitch-fedora-6-svn-rev-9178/image.manifest.xml 811137716590 available public x86_64 machine IMAGE ami-1be30672 rbuilder-online/freeswitch-0.0.1-x86_11952.img.manifest.xml 099034111737 available public i386 machine IMAGE ami-dae306b3 rbuilder-online/freeswitch-0.0.1-x86_11963.img.manifest.xml 099034111737 available public i386 machine
NOTE
These are very old versions of FreeSWITCH, and your best bet will be to checkout the latest FS trunk and build a fresh copy on your EC2 instance.
Q: Can I run this as a production switch?
I wouldn't recommend it. I purchased a 1 year instance of a small server setup and used a base CentOS 5.3 image 32-bit x86. Built FreeSWITCH from the latest snapshot and it worked great for dev and testing purposes but the call quality was pretty bad at times. I spent a fair amount of time tuning / testing / watching resource utilizations running a 4 person conference and I would see an average of 0.5 to 1.0 second audio delay. I tried with direct SIP phone registrations and through a SIP trunk provider, same results. EC2 is a great dev/test platform but I would say your best to run a realtime voice application on a physical server. You can virtualize voice systems but they need to be designed and engineered by someone that knows what they are doing.
Yes, it is not recommended using small instance for running FreeSWITCH production, however you should be happy to run FreeSWITCH production in a High CPU medium instance.
A mailing list user said in Mar 2010:
"We run FreeSWITCH on AWS' EC2. A medium EC2 instance is happily supporting 100 Polycom users, conference bridges etc. Been running for over a year. We also use FlowRoute as our PSTN->SIP Interface, and also Skype Business SIP. Our users are scattered across the globe - so having the box sitting on AWS' network infrastructure is key to avoiding issues with latency, jitter, packet loss (i.e. I don't think we could afford the connectivity AWS gives us if we had to provision this in-house)."

