Home » Technology » Googlified Messaging: Asterisk’s New Best Friend

The Most Versatile VoIP Provider: FREE PORTING

Googlified Messaging: Asterisk’s New Best Friend

Lips from GoogleWithin the past few months, we've added several hundred million free phone numbers to our Asterisk® PBX by creating a Skype Gateway as well as Gizmo Backdoor Dialing and ENUM interfaces that didn't cost us a dime. And, today, we turn our attention to Google's recent transmogrification of GrandCentral into Google Voice. More specifically, what we want to do is examine some ways to integrate the Google Voice feature set into our existing Asterisk implementations. The potential benefits are enormous. There's free calling in the U.S., free distribution of inbound calls to multiple phone numbers scattered around the country, free SMS messaging and delivery by email, free transcription of voicemail messages into text-based emails, free conferencing, and free GOOG-411, a voice-activated service that let's you find nearby businesses by saying where you are and what you're looking for. For today, we've set our sights on the Google Voice feature set which is easiest to integrate into existing Asterisk systems: free voicemail message transcription, free calling in the United States, and free GOOG-411 directory assistance. For lack of a better term, we call it... Googlified Messagingโ„ข. ๐Ÿ˜‰

Update: The original SIP interface to Google Voice described in this posting no longer works. A new approach that really works is now available on Nerd Vittles at this link.

Integrating Google Voice into Asterisk. If there is a recurring theme to Google Voice, it's this. Google Voice was designed to be a user-friendly, interactive messaging system. Google didn't intend to provide a telephony toolkit for Asterisk developers, but they haven't blocked any functionality either. There's no SIP connectivity in Google Voice... at least that is obvious. Can you spell G-I-Z-M-O? Well, that was the first hint. But a simple call trace revealed a lot more. It appears the entire Google Voice platform is SIP-based which makes it a perfect fit with Asterisk.

Because of the Google Voice design, there's no simple way to use your Google Voice DID for incoming call distribution while also integrating voicemail transcription and outbound calling into your Asterisk dialplan. Why? Because you can't take advantage of the free voicemail transcription service with Asterisk if Google Voice is sending inbound calls all over the countryside. So the real key to unlocking the greatness of Googlified Messaging is having two Google Voice accounts so that each can be used for a dedicated purpose. The first account will be used for outbound functions and voicemail transcription while the second is used to manage and route incoming calls. This is important because, for security reasons, you don't want to reveal your Google Voice number that is being used for outbound calling. Why? Because it is a SIP connection, and your Google Voice phone bill is only protected by a 4-digit PIN. If Google hasn't learned about Fail2Ban, they will soon. As this is written, multiple Google Voice accounts aren't possible unless you had more than one GrandCentral account since only GrandCentral users currently are eligible for Google Voice accounts. But that, too, will change!

For today, let's put aside the incoming call routing and concentrate on the remaining Googlified Messaging functionality. We turn first to Google Voice's free transcription of voicemail messages into text-based messages for email delivery to your desktop PC or cellphone.

Voicemail Transcription Overview. We begin with a cautionary note. Google's new automated voicemail transcription service is absolutely incredible... even if it's not quite perfect. We've tried a couple of messages to evaluate the transcription accuracy, and we'll let you judge for yourself.

Actual Message: "Hi. I was just passing through the airport. I hadn't seen you in a couple years, and I thought you might wanna get together for a quickie. Give me a call."

Googlified Transcription: "hi i was just passing through the airport i hadn't seen you in a couple years and i thought you might wanna get together for a quickie give me a call"

As you can see, the accuracy was pretty good. But there are a couple of problems. First, there's no CallerID name associated with inbound calls. So, if the caller doesn't identify himself or herself (especially if the caller is using a pay phone), you're S.O.L. relying on the transcription. But the message and phone number were accurate. It probably would motivate you to quickly connect to your email account and actually listen to the voicemail to decipher the caller's identity and avoid a missed opportunity. ๐Ÿ™‚

Actual Message: "Hi. I've read over your corporate acquisitions and merger paper, and it isn't quite accurate with regard to our position."

Googlified Transcription: "hi i have a red over your corporate acquisitions in merger paper and it is a quite accurate with regard to our position"

This second example is a bit more problematic. The same issues apply from the first example. Plus there's a new wrinkle that could be a show stopper: the Googlification of "isn't quite accurate" into "it is a quite accurate." You'd better hope there was more to the message than this before running off to present your paper. It also highlights the difficulty that automated systems have when deciphering conjunctions such as "isn't" which often are used in conversational speech.

Some might suggest that this demonstrates the Google developers actually have their priorities in order. Get the kinks out of the sex jargon before focusing on exciting subject matter such as conjunctions. ๐Ÿ™„

Bottom Line: Googlified Messaging may be a boon to your sex life, but don't stake your job security on it just yet. Also make certain that your voicemail announcement includes a very emphatic request that callers actually identify themselves and leave a callback number where they can be quickly reached.

Google Voice Design. To integrate free voicemail transcription into Asterisk, what we first must do is turn your Google Voice account into a glorified answering machine and message distribution system. When calls arrive on your Google Voice number, they will immediately trigger a greeting message that says something like this:

Thank you for calling Nerd Vittles. No one is available at the moment to take your call. After the tone, please identify yourself, leave a callback number, and a brief message. Your message will be transcribed and delivered to us. We will get back to you promptly. Please begin speaking after the tone.

Once a voicemail message is received, we want Google Voice to transcribe it and email us both the voicemail message and the transcribed text.

Google Voice Setup. Log into your Google Voice account and click Settings, General. In the Voicemail Greeting section of the form, record your greeting message as outlined above. In the Notifications section, identify the email and SMS addresses for delivery of your voicemail messages. In Voicemail Transcripts, check the option to transcribe voicemails. Now click on the Do Not Disturb check box to forward all inbound calls to voicemail.

FreePBX Setup. Obviously there are numerous ways to integrate this transcription service into Asterisk. If you're using FreePBX, here are a couple of simple ways. First, create a Miscellaneous Destination for Google Voice and provide your Google Voice number in the correct format to match your dialplan. Next, if you use a Ring Group to answer incoming calls, choose your new Google Voice Miscellaneous Destination as the "Destination if no Answer." If you're using an IVR to route calls, then perhaps you'll want to add an option to leave a voicemail and have it transcribed for delivery to your email account.

HINT: For rerouting of Asterisk calls to Google Voice, be sure to use an outbound trunk that supports CallerID pass-through. And configure the trunk with a blank CallerID value in FreePBX. Then the actual CallerID of the incoming call will be passed along to Google Voice and stored as part of the voicemail message.

Connecting the Dots. For the visionaries in the audience, you're probably wondering what it would take to add language translation to transcription. So were we. It raises some interesting questions, and some of our early adopters already have tried it. Suffice it to say, it doesn't work yet. But it wouldn't take much effort to run a transcribed message through Google Translate and spit out a Spanish, French, or German message on the other end. Or vice versa: transcribe a German message and translate it into English for email delivery in an English-speaking country. Exciting times, indeed. Stay tuned!

Free U.S. Calls with Google Voice. At least for now, calls through Google Voice to phone numbers in the United States are free. And the rates are quite reasonable to other countries. It's a penny a minute to Canada and two cents a minute to many other countries whose names don't include the word "island." There are several ways to terminate calls through Google Voice with Asterisk. Here's the only way we've found to place outbound calls and also preserve the message transcription functionality.

Log into your Asterisk server as root and edit extensions_custom.conf in the /etc/asterisk folder. In the [from-internal-custom] context, add one or more entries for people you wish to call. Be sure to make the following substitutions to match your Google Voice credentials:

999 - Extension number to call
9876543210 - Your Google Voice DID
8888 - Your Google Voice PIN
1234567890 - Phone number of person to call

And here's the default entry which should be one continuous entry on one line:

exten =>999,1,Dial(SIP/9876543210@216.239.37.15:5061
,30,mD(wwwwwwwwwwww*ww8888ww2ww1234567890#))

When you finish making all the extension entries desired, save the file. Then reload your Asterisk dialplan: asterisk -rx "dialplan reload"

Google Dialer for Asterisk. Another approach for outbound calling with Google Voice would be to create a simple dialer in your Asterisk dialplan. The idea here is that anyone can pick up a phone and dial *GV (which is *48) to place a call. They then will be prompted to enter the 10-digit number to call. This code would be inserted in the same [from-internal-custom] context, and remember to insert your actual Google phone number and PIN in the dial string and keep the entire Dial command on a single line (which we can't do in this blog's template). Reload the Asterisk dialplan when you're finished.

exten => *48,1,Answer
exten => *48,n,Wait(1)
exten => *48,n,Set(TIMEOUT(digit)=15)
exten => *48,n,Set(TIMEOUT(response)=20)
exten => *48,n,Playback(pls-entr-num-uwish2-call)
exten => *48,n,Read(NUM2CALL,beep,10)
exten => *48,n,Playback(pls-wait-connect-call)
exten => *48,n,Dial(SIP/9876543210@216.239.37.15:5061
,30,mD(wwwwwwwwwwww*ww8888ww2ww${NUM2CALL}#))
exten => *48,n,Hangup

Outbound Trunk Alternative. Since the original article was published, our British colleague, Joe Roper, suggested that we also include instructions for configuring Google Voice as a dial-out trunk (instead of an extension) in Asterisk. The advantage of this approach is that outbound calls can be dialed in the traditional way without interaction with voice prompts. The solution we will outline below lets you place a call from any Asterisk phone by dialing the GV prefix plus a 10-digit number. So, to place a call to President Obama in Washington through Google Voice, you'd dial 48-202-456-1111. Good luck with that, but here's how...

First, log into your Asterisk server as root and edit extensions_custom.conf again. This time, go to the very bottom of the file and add the following code using your Google Voice phone number and PIN. Remember to expand the two-line dial string so it fits on a single line with no spaces! Save your changes and reload the dialplan.


[custom-google-voice]
exten => _X.,1,Dial(SIP/9876543210@216.239.37.15:5061
,30,rD(wwwwwwwwwwwwww*www8888www2wwww${EXTEN}#))
exten => _X.,n,Hangup

Next, open FreePBX with a web browser and choose Setup, Trunks, Add Custom Trunk. Insert the following Custom Dial String on the form and Submit Changes and reload the dialplan:

local/$OUTNUM$@custom-google-voice

Finally, choose Setup, Outbound Routes, Add Route and fill in the following entries on the form:


Route Name: GoogleVoice
Dial Pattern: 48|NXXNXXXXXX
Trunk Seq: local/$OUTNUM$@custom-google-voice

Save your changes and reload the Asterisk dial plan one more time to complete the setup. Now you're all set to call the President whenever the urge strikes: 48-202-456-1111. And, remember, it's a free call... at least for now.

Homework. Google also has introduced a slick new directory assistance service which also is free. We'll leave it to you to take the lesson above and create a GOOG-411 entry in your dialplan. HINT: You choose option 3 instead of option 2 after entering your PIN in the Google Voice menu. Enjoy!

Chapter 2. Google Voice: Is the SIP and Asterisk Honeymoon Over?

Chapter 3. The Return of Googlified Messaging With Free U.S. Calling


 

Special Thanks to Our Generous Sponsors


FULL DISCLOSURE: ClearlyIP, Skyetel, Vitelity, DigitalOcean, Vultr, VoIP.ms, 3CX, Sangoma, TelecomsXchange and VitalPBX have provided financial support to Nerd Vittles and our open source projects through advertising, referral revenue, and/or merchandise. As an Amazon Associate and Best Buy Affiliate, we also earn from qualifying purchases. Weโ€™ve chosen these providers not the other way around. Our decisions are based upon their corporate reputation and the quality of their offerings and pricing. Our recommendations regarding technology are reached without regard to financial compensation except in situations in which comparable products at comparable pricing are available from multiple sources. In this limited case, we support our sponsors because our sponsors support us.

BOGO Bonaza: Enjoy state-of-the-art VoIP service with a $10 credit and half-price SIP service on up to $500 of Skyetel trunking with free number porting when you fund your Skyetel account. No limits on number of simultaneous calls. Quadruple data center redundancy. $25 monthly minimum spend required. Tutorial and sign up details are here.

The lynchpin of Incredible PBX 2020 and beyond is ClearlyIP components which bring management of FreePBX modules and SIP phone integration to a level never before available with any other Asterisk distribution. And now you can configure and reconfigure your new Incredible PBX phones from the convenience of the Incredible PBX GUI.

VitalPBX is perhaps the fastest-growing PBX offering based upon Asterisk with an installed presence in more than 100 countries worldwide. VitalPBX has generously provided a customized White Label version of Incredible PBX tailored for use with all Incredible PBX and VitalPBX custom applications. Follow this link for a free test drive!
 

Special Thanks to Vitelity. Vitelity is now Voyant Communications and has halted new registrations for the time being. Our special thanks to Vitelity for their unwavering financial support over many years and to the many Nerd Vittles readers who continue to enjoy the benefits of their service offerings. We will keep everyone posted on further developments.
 


Some Recent Nerd Vittles Articles of Interest...


15 Comments

  1. Ok, that is a seriously cool set of hacks there! I was wondering if it was going to be possible to utilize the voicemail transcription. Excellent work on figuring all this out.
    -Kerry

    [WM: You can certainly use the voicemail transcription with your own Google Voice account and the setup we’ve described. P.S. Congrats on the new job. ๐Ÿ™‚ ]

  2. It looks like Back Door Dialing is no more. I have a balance of $10, and it says that I need to add something for dialing out.

  3. I wish they would open Google Voice to more people, I don’t have an old Grand Central account but I will be playing around with this.

    And thanks for the congrats.
    -Kerry

  4. Since the article appeared this morning, we’ve had several inquiries about how to configure Google Voice as an Asterisk trunk rather than as an extension. For instructions on how to do it as well as an explanation of the functional difference between a trunk and an extension in Asterisk, see the new paragraph at the end of the article.

  5. Just a useful tweak: You shouldn’t need al of the w’s at the beginning of the D() macro. * can be entered anytime during ringing, and this avoids ringing the phones of the GV account having to ring during that time.

    Another trick that works, stick a Set(CALLERID(num)=####) where #### is a number you’ve set up in GV as a pinless-login. Then, the dial string can just be "ww2w${EXTEN}#". Works for me, at least…

  6. Uncle Ward, this is a pretty cool application. Just one comment for using the GOOGLE 411 service. I have been using this service for the past 2 years by just creating a ringroup in FreePBX (the number of the ringroup is, of course, 411) and adding the 18006446411# to the extensions to be dialed. As we have the capabilities of making free calls to tool-free numbers in the US by using a number of different ways, then the call is always free and it has prevented me from paying the $0.75 that you get charged if you dialed to 411 directory assistance of any of the Ma. Bell company or VoIP provider. Just my two cents on this so people can start benefiting from it already.

  7. I have been using GrandCentral/GV with Gizmo5/SIPPhone and Asterisk for some time, works a charm. Great post, as a lot of people may benefit from this integration.

  8. Yeah… worked great when I tried earlier. Unfortunately, I tried the same type of thing with my home system and couldn’t get it to work. I then tried again from the original asterisk system (Trixbox 2.6.2.2) that was working earlier and it seems to connect and then it seems that google is hanging up the call. I’m curious if they’ve closed the hole ๐Ÿ™ I was hopeful and was eager to get my home system working with it, but we may just have to wait for something else.

  9. Looks like we’re all back to using the Skype gateway until the next hack. Just wondering how this qualifies as a smart business move? Isn’t the idea to get more people to use the service? It obviously wasn’t going to be free calling forever anyway.

  10. Hello, how could I setup a pinless dialplan with just a sipura SPA-2002, from what I gather the asterisk dial plans are not the same structure as what the dial plan of this ata actually are. I basically wish I could set a dialplan in the ata and not have to setup an entire asterisk box just to get this kind of functionality on ease of outbound calls to us numbers. Any response to this would be much appreciated, even if there is another ata that can handle that level of scripting that would eliminate having to setup an entire pbx system just to get pinless dialing. Just let me know what you think! Super appreciative, Nate

Comments are closed.