It may not look like much, but this little gizmo is actually now powering my entire home phone system, courtesy of Freeswitch and VoiP.ms.

The device in question is a Raspberry Pi — a small, $35 ARM-based GNU/Linux box, essentially a credit-card sized computer. I ordered one last week, partly with the interest in turning it into a phone server, but mostly just to play around with. The unit itself is about as basic as it comes — 512MB of RAM, an SD card slot, two USB ports, composite video + HDMI output, and a single Ethernet jack — but it's actually more capable than one would expect for $35. No internal storage is provided — you basically supply your own SD card — and it's powered over a micro-USB connection using a 5V adapter. By the time the dust settled, the whole package ran me about $75, including shipping, for which I received the unit itself, a case, power adapter, and small micro-USB cable (I probably could have supplied my own power adapter, but the voltage requirements are very precise, so for the extra $10 I opted to go for the one sold with the unit, just to be safe).

My interest in setting up a telephony server stemmed from having switched over to VoIP.ms about a month ago, having previously been on Vonage for several years. Since my wife and I both have cell phones, we don’t really use our home number for much other than as a common “household” point-of-contact, and $1/month is pretty hard to beat for a basic number. VoIP.ms also provides a number of call routing and phone management features well beyond what I could do with Vonage, such as routing based on caller ID, DISA, ring groups,  and time of day routing, just to name a few. This of course whet my appetite for doing other, even cooler stuff that was a bit beyond what VoIP.ms could easily provide, and since the service is quite capable of routing any (or all) of your DIDs to a telephony server, it can also work as a great and inexpensive way for providing PSTN access without having to mess with additional analog line hardware. One of the initial incentives to set up my own server was support for ZRTP encryption, which is something that VoIP.ms sadly does not provide any support for. I also liked the idea of being able to craft more sophisticated call routing plans for various special use cases — situations I’d never expect a third-party service to actually handle.

So, after a weekend of Geeking Out™, I managed to successfully get Freeswitch up and running on the Raspberry Pi with a surprisingly minimal amount of effort. The procedure for compiling Freeswitch was surprisingly straightforward, and the standard Raspbian Linux distribution has all of the necessarily tools readily available. The only downside is that since the Raspberry Pi doesn’t have the fastest CPU on the block by a long shot, the build process will take several hours — a problem I was sadly reminded of when I discovered that I had forgotten to compile in ZRTP support the first time around, and therefore had to basically start over. When the dust settled, however, I was pleasantly surprised how capable of a little device the Raspberry Pi is for this purpose, while also being the kind of unobtrusive little thing you could hide away anywhere that has a power source and an Ethernet connection available (in stark contrast to something like this). While I don’t need it to handle more than two or three simultaneous calls, I actually tested it with up to about a dozen connections — both separate calls and conference calls — which it handled without skipping a beat. My home phones are connected through the same Linksys SPA2012 ATA that I was using for VoIP.ms directly — I simply logged into the box and changed the credentials to point to my Freeswitch server instead and they just happily carried on from there, and each of the two ports can also now act as a separate “extension” allowing me to basically have a separate “line” for each phone.  I use Groundwire on my iOS and Android devices, which works quite well and optionally supports ZRTP encryption, albeit with an additional in-app purchase. 

To give you an idea, here are just a couple of the cool things I’ve been able to do courtesy of running my own Freeswitch server:

My building lobby intercom works by dialling my home phone number, and therefore travels over the standard PSTN. The door is activated simplyby pressing “9” on my phone keypad when I receive a call. These callscarry a unique Caller ID, however, and I can therefore treat incominglobby calls differently from any other calls to my home phone number.Firstly, I don’t let them go to voicemail — there’s really no point. Ican also forward these calls to additional numbers, such as my cellphone, allowing me to let myself in if I forget my keys, or let somebodyelse in for things like deliveries when I’m out.

The really cool trick here, however, is setting up my system to allow meto use a secret passcode to let myself in. I basically programmedFreeswitch to pre-answer calls from the lobby with a “fake” first ring.To the person on the other end, it simply sounds like the line hasstarted ringing, however it’s actually reading in DTMF touchtones. Ifthe correct sequence is entered, Freeswitch sends out a DTMF “9” tone,opening the door. Otherwise, the call simply transfers to the normalhome phones to be dealt with normally.

I’ve used the same trick to setup a “stealth” DISA feature. DISA, orDirect Inward System Access, is a feature whereby you can dial in fromany external line and get an “internal” dialtone to do with as youplease, allowing you to place calls as if you’re on one of your ownphones. This can be useful in situations where you only have a payphoneor somebody else’s phone available and want to make calls from your ownnumber for either caller ID or billing purposes. Most DISA solutionssimply answer the phone and prompt the user for a password in much thesame way as a voicemail system would. The “fake first ring” trick,however, can be used on my normal inbound line to allow me to get DISAaccess by calling my own number and simply knowing to enter theappropriate PIN code during the first ring. If the incorrect code isentered — or nothing at all — the call simply proceeds as it normallywould.

One of the other cool tricks that running your own telephony system allows for is fun and games with Caller ID, however I’ll save that onefor a future post…