Updated 25 Jan 2010: Adjusted for the new parameters required when using the sys.GoogleVoiceCall method in the sipsorcery dialplan.

The “hacked” up Google Voice App on sipsorcery appears to have attracted some new people to the site. To help them I’m writing a quick tutorial about how they can quickly get up and running to place a call with the Google Voice app.

Warning: People new to sipsorcery will probably be fine until they get to the dialplan configuration and will then start cursing in frustration: “why is this thing so *#!@ hard all I want to do is make a telephone call!”. The reason is that sipsorcery and mysipswitch before it were designed for people to be able to experiment with SIP stuff and try weird and wonderful things. The price for that power and flexibility has so far been ease of use. One day the plan is to re-create something like the dialplan wizard to make it simpler but so far it just hasn’t made it to the top of the list.

Back to the promised tutorial.

Following are the minimum steps you need to take to be able to place a call from sipsorcery to terminate with Google Voice.

  • 1. Login to the Google Voice site click Settings (in the top left) and then Phones on the main menu. On the Phones screen you must have a Gizmo number configured as shown below (note it doesn’t matter whether it’s ticked or not).

    Goog Voice - Phone

    Goog Voice - Phone

  • 2. The Gizmo number you have used in Google Voice MUST then be configured to forward calls to your sipsorcery account. You can do this by setting a forward at the Gizmo SIP Provider end or by registering the account from the sipsorcery end. The result in both cases is the same and it doesn’t matter which one you use. To register your Gizmo SIP Provider account from sipsorcery you need to create a new SIP Provider entry as shown below (use appropriate values for your account where I’ve blurred my own settings out).

    Important: As part of some updates made to sipsorcery for enhanced redundancy the contact registered or used with the callback SIP Provider MUST be username@sipsorcery.com where username is the same as the one used to login to the sipsorcery web site. If it’s not the same then there is around a 50% chance the Google Voice callback WILL NOT be matched up to the waiting SIP call that initiated it on the sipsorcery end.

    SIP Provider Details - Gizmo

    SIP Provider Details - Gizmo

  • 3. Now we’re ready to place a call. To do that you need to click on the Dial Plans menu in your sipsorcery account. I will assume that you are creating a new dialplan and will be overwriting the default one created for you.
    Google Voice - Minimal Dial Plan

    Google Voice - Minimal Dial Plan

    And so you can actually read it:

    sys.Log("starting dialplan...")
    sys.GoogleVoiceCall("emailaddress@gmail.com", "password", "1747612xxxx", "1132701859", ".*", 7)
    sys.Log("Sorry, Google Voice Call failed.")
    

    Here’s what each of the parameters mean:

    • emailaddress@gmail.com MUST be the email address you use to login to your Google Voice account.
    • password MUST be the password for the email address.
    • 1747612xxxx MUST be your Gizmo a number that has been registered on your Google Voice account and be the same as the one shown showing on your Google Voice Phones page in step 1. This is the number that Google Voice will place the callback on so calls to it must somehow be configured to arrive back to the sipsorcery servers typically this would be by registering a sipsorcery provider binding with the SIP provider that supplies the number.
    • 1132701859 this is the destination number you wish to call and can be ANY US landline number (I don’t know whether mobiles or any others will work).
    • .* this is a regular expression pattern that will be applied to any incoming calls that arrive on your sipsorcery account for 30 seconds after a sys.GoogleVoiceCall method has been used in your dialplan. The pattern is used to decide whether the incoming call is the callback from Google Voice and to bridge it with waiting SIP call. A pattern of .* means the very next incoming call will be matched, it’s the safest option for anyone unsure about regular expressions or confused about what this parameter means.
    • 7 this is the type of phone being used for the callback from Google Voice, The Google Voice web request requires that it be specified. The range of this option seems to be 1 to 7. To date it doesn’t seem to make any difference what number is used EXCEPT that if Gizmo is the callback provider 7 must be used. If it’s not Gizmo the safest bet is to use a value of 1.

Once you have taken those 4 steps you need to configure your ATA, IP Phone or soft phone to use the sipsorcery SIP account and then place a call. If all goes according to plan you will get the following:

  • A ring tone on your phone almost straight away. This is generated by the sipsorcery server to let you know it’s started working.
  • Somewhere between 1 and 10 30 seconds later the phone will get answered and you will have a brief pause of silence followed by another ring tone. This time the ring tone is being generated by the Google Voice server and indicates the destination number you specified is ringing.

That’s it, Easy :).

Caveats. Google obviously didn’t intend for people to be able to hook up their SIP devices to make free calls. I assume free calls via the Callback mechanism on the Google Voice web site pays off by driving web traffic to the site. With a SIP call there is no such pay off. As such the sipsorcery solution and other solutions around the web are hacks. That means they are susceptible to breaking or being blocked it Google get annoyed with the SIP calls. On the mysipswitch Forums there are already reports of the occassional call failing with a HTTP 500 Server Error. Watching the sipsorcery logs I have seen a few calls getting the same. That error maybe because there was something about the call request Google didn’t like, you can test that by using the same values in a Callback from the Google Voice page, or it may be that the HTTP requests that are sent from sipsorcery to Google are occassionally going to get rejected for some reason (the 500 Server Error was caused by a bug in the sipsorcery code). The point is if you want to use this sort of solution on sipsorcery or elsewhere you will probably need to accept that not every call is going to work (that being said none of my own test calls have failed yet).

Finally if you would like to get a little bit more adventurous with your dialplan and have it send the number you called in on as the destination for your Google Voice call you can use the one shown below.

Google Voice Call - Advanced Dial Plan

Google Voice Call - Advanced Dial Plan

sys.Log("starting dialplan...")
sys.GoogleVoiceCall("emailaddress@gmail.com", "password", "1747612xxxx", "#{req.URI.user}", ".*", 7)
sys.Log("Sorry, Google Voice Call failed.")
About these ads