Meta

Category: Asterisk

Asterisk can work pretty well on Microsoft Windows Azure even with Google Voice, you don’t even need to be a Linux genius; so here are the simple steps to get it working!

Create the virtual machine

If you don’t have Virtual Machine (IaaS) you will need to sign up for the preview. It’s pretty quick, so go do it already. For just connecting one SIP phone to one Google Voice account an Extra Small ($10/month or free with an MSDN subscription) will be plenty big enough, so choose Ubuntu Server 12 as the image and Extra Small as the size. Key in your password and pick a location close to you. The DNS name is important, because you will use it to connect via SSH and from your SIP device.

Now Azure will build a virtual machine for you, so let’s learn how to connect to it. I assume you are awesome, and hence are using Google Chrome so we can jump straight to the Chrome Web Store and pick up a free copy of Secure Shell which will let you access the command line of your virtual machine form any operating system that supports Chrome. Got it? Good. Click it.

Setup a new connection with the user name as azureuser@<your DNS here>.cloudapp.net similar to this:

If you can’t connect then it’s likely because you haven’t started your virtual machine (I’m not sure why Microsoft doesn’t do this for you but whatever,) just click into your virtual machine on Azure and click the start button.

Upon successful connection you will be prompted for your password, which is the same password you entered when creating the virtual machine. Simple!

Now let’s check for updates by entering the following command line:

sudo apt-get update

What does this do? Sudo is a command that temporarily give super user permissions to the current user. The best way to understand it is with the xkcd comic:

Sudo give you super-powers! But use it responsibly. Think of apt-get as a way of getting things your computer doesn’t have. Linux distributions are famous for coming with not enough stuff or conversely too much stuff, since this is a server we start with not enough stuff and just add what we need. As for update, well I’d let you use your imagination but it just updates the packages from the internet so we always get the latest and greatest stuff.

Okay, so let’s install Asterisk 11 which if you build it correctly has built in support for google voice! Huzzah! So unfortunately we will need to build from source since Ubuntu hasn’t seen fit to put Asterisk 11 prebuilt binaries into the apt-get (Aptitude) repository for easy getting. No Problem! “Building from sources,” sounds scary but is down-right brain-dead easy, I mean a monkey could get this right and you are way smarter than a monkey, right? RIght?!? Okay, let’s do it. First we need a “build environment,” which is fancy-talk for the programs that we need to build Asterisk from its sources. It’s easy to get so copy from below (windows: control + c // mac: command + c) and paste into your Secure Shell window (windows: shift + control + v // mac: command + shift + v).

This part will take a little time as Ubuntu goes out and gets all the software it needs to make Asterisk. So get yourself a lovely beverage or something. When it’s done we are going to need to have super-powers for real, so we are going to go into superuser mode by running this command:

This will flash some scrolling text and then display a menu which you can just for F12 or press TAB until you get to Save and Exit. Asterisk will continue building and installing and whatnot and you should get a prompt at the end of it all. Congratulations, you are almost done! There’s just a couple configuration files and settings we will need to make before the whole thing is working.

Note: You will need to edit some of these files I’m giving you to fill in your real Google Voice credentials, and then paste them into the console.

First we will create the sip.conf file:

cat > /etc/asterisk/sip.conf

Now you will see a new blank line and a blinking cursor, paste the following text into here:

Now you will be in an Asterisk shell and it will show you everything that’s going on under the hood. Probably a lot of errors and Google will be sending you a freaked out email that some application is trying to access your account! Yes, that’s your new Asterisk box, and let it do its thing. One you have let Google know not to freak out you’ll be close to done, you just need to go to your Azure dashboard and click on Endpoints and add the following endpoints:

I’m sorry but as of the time of this writing there’s no easier way to add these endpoints without using PowerShell and that’s a whole other conversation. This way is tiresome but easy.

Yay! Time to use the system!

If you call your Google Voice number at this point you should see Asterisk spitting out all kinds of things are generally freaking out because there’s nowhere to send the call to. In order to fix this, all you have to do is download a SIP client like Telephone for Mac OS X or X-Lite for Windows or use a little device that hooks up to your internet and a telephone. Just configure it to point at your DNS name (xxx.cloudapp.net) and the extension name (in my scripts it’s sipphone) and the password (which is something you should have put in my script). Once it’s connected you should be able to make and receive calls on your Google Voice account!