Jan 20 2008

Asterisk + Gizmo

Shortly after I got a decent internet connection into my house, we switched over to a VOIP service, and cancelled all of our legacy land line goop. (Incidentally, if you're looking for a good, cheap VOIP carrier that is Asterisk friendly, I'm so far very pleased with BroadVoice.)

I used to use Gizmo in leiu of Skype, because of their support of open standards, and a more solid cross platform client. Once we had Asterisk all configured and working at home, I decided to hook it into our new setup, so remote pals and family members could just double-click in Gizmo, and our home phone would ring. The following is a quickie step-by-step, if anyone else is interested in this sort of thing.

Incoming calls

The Gizmo client breaks its service across two protocols: SIP, and XMPP. They used to just use SIP, but found elements of it (IM, presence) not as robust as they would have hoped. The SIP side of things is what we're interested in, as it is the 'voice' part of the client. Registering an account with Gizmo is actually giving you an account with their core service, sipphone.com.

Login to SipPhone to get your account number -- you'll need this for asterisk registration. Mine is 17476266621. You can also check your current registration status here. Unless you're currently using the Gizmo client, it should say you are offline.

So, we want to receive calls from Gizmo, and make calls into the Gizmo network. To receive calls, we need to register to SipPhone from asterisk. Modify sip.conf to reflect the following:

register => 17476266621:password@proxy01.sipphone.com

This performs the actual registration. But we also need to define what context Gizmo callers will be placed into when they call in. I made one called from-gizmo.

[gizmo]
type=friend
context=from-gizmo
disallow=all
allow=ulaw
dtmfmode=rfc2833
host=proxy01.sipphone.com
insecure=port,invite
secret=password
username=mahlonsmith
canreinvite=no

Now, we just need to tell the dialplan what actions the from-gizmo context actually performs. This is done in the extensions.conf file.

[from-gizmo]
exten => s,1,Dial(${OFFICE},60,tr)

Yep, just one line. This says that anything placed into this context (which in my config, is just Gizmo callers) will be routed to my office line. You can of course add fall-through to voicemail, or whatever else you like here.

Now, get into the asterisk console, and reload. Refresh the SipPhone registration status page -- it should now say that you are online. You can also check your registration status from within asterisk, using the sip show registry command.

% rasterisk
Connected to Asterisk 1.4.10
CLI> sip show registry
Host                            Username       Refresh State     
proxy01.sipphone.com:5060       17476266621        105 Registered

Hey, neat.

Outgoing calls

Outbound dialing is even easier, now that the sip.conf is already configured. I set it up in two parts. First, a dialing macro, that sets CallerID information and does the actual calling.

[macro-gizmodial]
exten => s,1,Set(CALLERID(all)="Mahlon" <17476266621>)
exten => s,n,Dial(SIP/${ARG1}@gizmo,30,Wr)
exten => s,n,Congestion

With this macro, then the dialplan becomes one line.

exten => _8.,1,Macro(gizmodial,${EXTEN:1})

This extension accepts any number that starts with an 8, and strips the 8 before sending it to Gizmo. Dialing '8411' from my office phone gets me Gizmo's (kind of horrible) "Tell me" service, if for some reason I wanted to play blackjack with a really bad Sean Connery voice.

Gizmo IM and Presence

So, all of that is just for the voice side of things. The downside to this method is that it doesn't do squat for telling Gizmo that I'm actually online. My family -could- just doubleclick my name, but they wouldn't since I appear offline. As far as Asterisk and Gizmo are concerned, this is an always on link - but for humans, I don't actually look like I'm there and ready to receive calls.

This is where XMPP comes in. XMPP (or its better known pseudonym, Jabber) is the transport used for Gizmo instant messaging and presence information. Because it's an open standard, there is no rule that you have to actually use the Gizmo client. So use whatever XMPP compatible client that you want. I like pidgin. Use your 'normal' Gizmo username and password. The server is chat.gizmoproject.com. Alternatively, don't bother, and just tell everyone to ignore your offline status and try calling you anyway. :)

That's it. My family gets the benefit of free calls and a really easy to use client, and I get to transparently use my house telephones.