In this post I’ll share the few notes I have on installing Asterisk 1.8 on a Rackspace CloudServer. First, note that I am not promoting this specific cloud provider. (There are several others, such as Amazon EC2 and Linode.) But I am all about VoIP on the cheap, and the baseline RS CloudServer seems to be as inexpensive as you can get. Moreover, I started using RS CloudServers a little while ago just for some quick Linux testing, and liked them. So when I thought about testing Asterisk 1.8, I set up a new instance there.
I’m not a software engineer and can’t effectively analyze Asterisk’s code to say whether it should or should not perform well in a cloud environment, but testing in this environment shows that it works fine, with one caveat: you can’t use the DAHDI kernel module. On other providers where the kernel headers and sources are available, you can compile DAHDI, but RS Cloud does not provide their Xen-optimized kernel source. The good news is that with Asterisk 1.8 (actually, starting in 1.6.2), you don’t need DAHDI unless you have directly-attached telephony hardware, which you don’t, because your server is in the cloud.
To further explain that: previously, you’d need a DAHDI hardware module or the DAHDI dummy driver to provide the timer for the IAX2 protocol and MeetMe. IAX2 no longer needs it, and while MeetMe does still need at least the dummy timer, there’s a new conference bridge application available that doesn’t need it–app_confbridge. (And if you don’t care about having a conference bridge anyway, this whole matter is moot.)
After all that introduction, I’m glad to say that actually building Asterisk and FreePBX on the cloud server is straightforward and only requires a few adjustments from building on physical hardware. I’m going on the assumption that you have built Asterisk and FreePBX before on a physical server. Here are the extra steps I had to take to build on RS Cloud.
- Create an instance of CentOS 5.5 on the 256 MB RAM/10 GB storage server. For test, this is enough. If you end up running a lot of calls through it, you’ll need a bigger VM. But the 256 MB server is a bargain at 1.5 cents per hour and 22 cents per gigabyte download and 8 cents per gigabyte upload. (Can you even get old hardware, electricity and bandwidth for testing for this price?)
yum updateand add build tools to the environment (
yum install gcc make gcc-c++ ncurses-devel libtool subversion). This is also a good time to add the packages that FreePBX needs. (My list included
mysql-server mysql-devel libxml2-devel libtiff-devel php-pear php-pear-DB php-gd php-mysql php-pdo perl-DateManip mod_ssl)
useradd -c "Asterisk PBX" -d /var/lib/asterisk asterisk; mkdir /var/run/asterisk; mkdir /var/log/asterisk
- Get asterisk-1.8.x.tar.gz and expand. There is no more asterisk-addons package; it’s now part of the asterisk tar file.
- For Google Talk/XMPP/Google Voice:
yum install openssl-devel
svn co http://iksemel.googlecode.com/svn/trunk/ iksemel-read-only
- Build iksemel with
./autogen.sh; ./configure; make; make install
- Iksemel puts its libraries in /usr/local/lib, so add this location to your library path:
echo /usr/local/lib > /etc/ld.so.conf.d/local.conf; ldconfig
- Build: cd to the asterisk-1.8 directory, then
./configure; make menuselect
- Review the modules being built. app_meetme won’t be available because DAHDI isn’t built. Add app_confbridge instead. Make sure res_jabber and chan_gtalk are selected if you want to set up Google Talk/Voice. Review the other modules including the ones listed in Add-ons (formerly a separate tar file) especially if you are adding FreePBX–you’ll want cdr_mysql.
- Keep building:
make; make install; make samples
- Important for the RS Cloud environment: there is no TTY9, which
safe_asteriskputs the Asterisk console on. Edit /usr/sbin/safe_asterisk and comment out line 5 (
TTY=9) and set
CONSOLE=noon line 6. Everything else should be fine.
- Asterisk should be ready to go!
- When I installed FreePBX 2.8.0, it complained that Asterisk 1.8 was not supported. The repository has an updated installer (see http://www.freepbx.org/v2/changeset/10494) but if you’re going from the 2.8.0 (or earlier?) tarball, you’ll have to make the change highlighted here. Edit line 899 in
install_ampand change 1.7 to 1.9.
- Now install FreePBX according to your own documentation or that available on FreePBX.org
/usr/local/sbin/amportal startto the end of /etc/rc.d/rc.local, or make an init script for /etc/init.d. I’m lazy and chose the former.
- Start everything up with
More to do
Get familiar with iptables, if you’re not already. This is the way to control access on your RS CloudServer node. By default it permits SSH, so you’ll want to add lines to permit web, SIP, IAX2, and so on.
Since you’re running in 256 MB RAM, you might want to pare down the /etc/httpd/conf/httpd.conf and reduce the number of web servers spawned, to save a little memory. The RS CloudServer is already pretty thin, otherwise.
I did some additional configuration of FreePBX, not essential to this posting, and then configured a softphone extension and a Google Voice trunk (to be discussed in a later posting). Then I made some calls. Even with both legs of the call going over the Internet, from a shared hosting facility, using G.711 uLaw (PCMU), the sound was great.
More on the Google Voice setup and FreePBX, and considerations for having your PBX out on the Internet. This would be a good time to start thinking about secure RTP!