Place Google Voice calls directly from Contacts on iPhone

Aug 06, '09 07:30:02AM

Contributed by: redfood

There has been a lot of controversy concerning Google Voice and the iPhone. Here is an AppleScript that allows you to place Google Voice calls directly from your iPhone's Contacts/Phone app.

The script works by adding numbers to contacts in Address Book that dial your contact via Google Voice. The new number is prefixed with your Google Voice number, your pin, and the number two. It dials into your Google Voice number and places the call to your contact.

The advantage of this method over apps like GV Mobile or the web is that you don't need a data connection to place a call, and you don't need to answer the ring-back. The downside is that waiting for the pauses and all the dialing is a bit slow. Also, your address book gets cluttered up with all the duplicate numbers.

Here is the code. Replace YOUR_PIN_HERE and YOUR_GV_NUMBER_HERE with your Google Voice pin and voice number, respectivel (leave the quotes). Enter this in Script Editor then run it:

set pin to "YOUR_PIN_HERE"
set gvnum to "YOUR_GV_NUMBER HERE"

tell application "Address Book"
  repeat with thePerson in people
    set nums to the phones of thePerson
    repeat with num in nums
      if the (label of num) contains "GV" then
        tell thePerson
          delete num
        end tell
      else
        set gvPhone to {label:"", value:""}
        set label of gvPhone to "GV" & the (label of num)
        set value of gvPhone to gvnum & "," & pin & ",2," & the (value of num)
        tell thePerson
          make new phone at end of phones with properties gvPhone
        end tell
      end if
    end repeat
  end repeat
end tell
I haven't had any problems, but you might want to back up your Address Book before running this script. (This script will also delete any phone label with the text GV in it. So if you are using labels with that sequence, you should change the prefix used in the code).

[robg adds: Lacking Google Voice access, I haven't tested this one. I added the link to the story about Google Voice and iPhone apps, to provide context for those who may not be aware of the issues.]

Comments (9)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20090805155644746