Controlling Vonage from Your Desktop


This morning, while I was listening to Ajay Madhok on IT Conversations, I was thinking it would be cool if I could manage what number my Vonage number forwarded to using an API. Then I could use the presence information in my IM application to drive where that one number sent my calls. Sometimes I want them to ring through to the handset, sometimes I want them to go to my cell and often I want them to go straight to voicemail (I hate telephones).

Well, Vonage doesn't have an API, but they do have a very cool RESTful service that allows you to initiate calls from your Vonage number to some other party. This means you can integrate the address book on your computer with your Vonage phone in some nice ways.

For example, I use the OSX Address Book application and this script allows me to simply click on the phone number in the Address Book to initiate a call. My phone rings and when I pick it up, it initiates the call to the number I want. Works great.

I made one change to the script. I added an else clause to the error checking code to pause iTunes if there are no errors:


--If there was an error, return a message.
if (characters 1 thru 3 of errorCode) as string != "000" then
    display dialog "Error: " & errorCode buttons {"OK"}
else
    tell application "iTunes"
        if player state is playing then
            pause
        end if
    end tell
end if

After all, as long as we're automating things, we might as well be complete. Unfortunately there's no way to know when the call ends, so you can't unpause iTunes when it's over. I can probably manage.

As an aside, I was a little put off by the URL for the service (click2callu.com) since I had to send it my Vonage account name and password. I wondered whether it was really Vonage or not. A quick check of the certificate shows that it's owned by Vonage Holdings and issued by Verisign, so I'm willing to trust it.

As a second aside, this is a great illustration of the power of RESTful interfaces. If this service had been created with a SOAP service, no one would have written an AppleScript to tie it to Address Book.