Saturday, January 23, 2016

Running Asterisk with Google Voice on your Synology Diskstation

I run a Synology Diskstation network-attached storage (NAS) at home (specifically a model DS114). I use it primarily for backups but it is really a little server so you can do almost anything on it. This is especially true if you run packages written by the community (though Synology publishes very good ones, too). I run CrashPlan on it so things I store on it are backed up to "the cloud" automatically (see here and here for instructions). I've plugged in a cheap-o USB audio adapter, connected it to my stereo, and can run Shairport on it (originally I ran this but now run the SynoCommunity package). This lets me easily stream audio from my computer to my stereo (using TuneBlade). I also connect my USB printer to it so I can print wirelessly.

One thing I've often wanted to run on it was Asterisk. Asterisk is a program that manages telephone lines and services (especially VoIP lines). Synology officially provides an Asterisk package that even includes a web GUI (though Digium no longer recommends using it). The problem with this package, however, is that they don't include the chan_motif module, which is necessary for running Google Voice lines with it.

While ambitious me usually doesn't stick around too long when he shows up, he was around long enough to try to take the Asterisk source and Synology toolchains from the Synology Open Source Project and rebuild their package from source, this time including chan_motif. I remember getting stuck on building some dependencies for my platform and ended up stopping there.

Months later I decide to revisit this problem. Looking through SynoCommunity's repository for their spksrc tool, I was thinking that maybe this would allow me to more easily create my own Asterisk package. Further looking led me to find their basic instructions for using Debian Chroot (I liked these extended instructions, too). Oh, my. What is this?! It's running a second, parallel OS on your Diskstation. (I've run Optware on a PogoPlug v2 and on my Asus Router that had DD-WRT at the time (now Tomato) and I hated it. I can't remember why but I remember thinking it was such a pain in the neck. I have had zero desire to run it on my Diskstation from day one. That PogoPlug, by the way, lasted less than 18 months before I chucked it in the garbage. I don't miss it. Arch Linux. U-Boot. It all made me want to poke my eyeballs out. That was a long parenthetical.)


Well Debian offers their own package of Asterisk that does include the chan_motif module! No rebuilding from source necessary. (Just a simple 'sudo apt-get install asterisk' is all you neeed.) Now we're cooking with induction.

Now I've seen how things like this go and I am telling you right now that I will not become the go-to guy for support when you want to get Google Voice on Asterisk going on your Diskstation. This is what worked for me in early 2016. May this page go into the rubbish bin of irrelevance and be deemed out-dated not far into the future. I don't care! I have a life to live here, people. (Okay. Okay. I think they get it. Lay off on the attitude a little. (Phrases like "lay off on" make me love English.))

If you want instructions for getting Google Voice going on your Asterisk installation, you can start with Digium's wiki but I would recommend the excellent book Asterisk: The Definitive Guide, 4th Edition which covers it in Chapter 18 (beg your library to get it or if you have a Safari subscription, it's there, too). It's a good book for all things Asterisk.