Some quick updates on interesting topics featured on this blog.
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!
This past weekend, I had a chance to test out all of the named technologies, all together–including the cloud.
The news last week was that Asterisk 1.8 connects directly to Google Voice via the Google Talk protocol. No more scripts or free DIDs to act as intermediary. And if you’ve set up GTalk with Asterisk on previous versions, it’s simple to go the extra couple steps and enable Google Voice.
Tested, and it works. Thanks to Michigan Telephone who drew my attention to the Asterisk wiki where the Google Voice setup is documented. If you’re already in a place where you can install Asterisk 1.8 and want to try it out, that wiki document will take you the whole way through it. (One note, however: I have
allowguest=yes, which is how this option is documented in the sample gtalk.conf, rather than
allowguests=yes, which is how it is documented in the wiki, and
allowguest [no s] works for me.)
While I am a huge fan of Google Voice, what was more interesting than getting that working this weekend was getting it running in the cloud–namely, Rackspace CloudServers. This was my venture into cloud VoIP, starting with dev/test, and partially out of necessity–I don’t have any more hardware at home to use for testing. I’ll give the end of the story first: it works nearly as well as my physical hardware setup at home in terms of audio quality and general calling functions, and an order of magnitude better for rapid deployment of a testing environment in which to set up the new versions of Asterisk and FreePBX. Naturally, I began to think: could I move my home PBX to the cloud? Not yet, and I have a number of technical reasons (not FUD) why, but I plan to try tackling them.
This is an introduction, and I know a number of folks stop by this blog looking for technical how-tos, so this week and next I will be digging into these topics: setting up Asterisk 1.8 and FreePBX 2.8, configuring Google Voice and nicely integrating into FreePBX (
not just hacking it into the extensions_custom.conf by hand some config file editing required…), setting up a RS CloudServer for Asterisk, and some of the technical considerations I mentioned in the previous paragraph.
That’s a lot to write about, and I’ll get to it piece by piece. Meanwhile, if you want to just try it out (minus the cloud part), go get the latest Incredible PBX/PBX In A Flash from NerdVittles, install the ISO and have at it. They’ve gotten it working and bundled it together so that you can have a cutting-edge PBX… in a flash! But as for me and this blog, let’s just call it Asterisk PBX in a slow-cooker.