GV Call Notifier: Send Jabber and SMS Alerts for Incoming Asterisk Calls

For those using PBX in a Flash or The Incredible PBX with at least one Google Voice trunk configured, there’s a simple way to send Jabber alerts to your Gmail desktop and SMS alerts to your cellphone to notify you of incoming calls to your Asterisk® server. Meet GV Call Notifier. The setup only takes a couple of minutes, and it provides instantaneous Asterisk call notification when new calls arrive on your system.

Prerequisites. You’ll need a PIAF2 server with or without Incredible PBX to use today’s GV Call Notifier. Set up at least one dedicated Google Voice account in PIAF2 using FreePBX. Remember that Google Voice requires that one outbound call be made with your new account using a browser before it will work interactively with PBX in a Flash.

Because we will be using Google’s Chat facility to send alerts, you also will need to interactively enable chat communications between your Google Voice account (used in PIAF2) and whatever Gmail destination(s) you plan to use as the recipient of the Jabber alerts. The easy way to do this is to open two different browsers. Sign in to Gmail on one with your primary Gmail account, and sign into Gmail on the other one with your PIAF2 Google Voice account credentials. Now use the Chat option in Gmail to send a message in both directions between the two accounts. Don’t forget to sign out of the Google Voice account, or it will no longer work to receive incoming calls in PIAF2.

Configuration Steps. To make this work, we need to adjust the context configuration for the trunks you wish to monitor. You may recall that, when you set up a new trunk, one of the entries looked like this: context=from-trunk. That’s the default incoming trunk context for FreePBX® trunks. What we need to do is replace the existing context entry with a custom context. Let’s call it incoming-alert. Here’s what a typical setup looks like. Click here to download a copy to your Desktop for editing because you need to add your own credentials.

[incoming-alert]
exten => 8431234567,1,Goto(s,1)
exten => s,1,Set(GVACCT=acctname) ; your Google Voice account name without @gmail.com
exten => s,2,Set(GVPASS=password) ; your Google Voice account password
exten => s,3,Set(EMAIL_NOTIFY=yourname@gmail.com) ; Gmail address to receive Jabber alerts
exten => s,4,Set(SMS_NOTIFY=6782223344) ; your cellphone number to receive SMS alters
exten => s,n,Playtones(ring)
exten => s,n,JABBERSend(${GVACCT},${EMAIL_NOTIFY},"Incoming call: ${CALLERID(all)}")
exten => s,n,System(gvoice -e ${GVACCT}@gmail.com -p ${GVPASS} send_sms ${SMS_NOTIFY} "Incoming call: ${CALLERID(all)}")
exten => s,n,Goto(from-trunk,${CALLERID(dnid)},1)
exten => s,n,Hangup

You only have to worry about the first five lines in the context. The first one designates the Trunk DID you want to manage. Just enter the 10-digit or 11-digit DID of the trunk you want to monitor. Whether to use a 10-digit or 11-digit DID depends upon how your trunk provider delivers the incoming calls to your PBX. If you want to manage more than one DID, just clone the first line changing the entry for each DID and then insert the new line below [incoming-alert].

Remember we said you must set up at least one Google Voice account in FreePBX for this to work. The reason is we’re going to use Google Voice to deliver the Jabber and SMS messages. Be sure you’ve interactively completed the Google Chat setup steps above before you continue. Otherwise, your alerts will never be delivered.

In [incoming-alert], modify line s,1 by replacing acctname with your actual Google Voice account name minus @gmail.com. In line s,2 replace password with your Google Voice account password. In line s,3 replace yourname with the Gmail address where you want the Jabber alerts delivered. This typically would be your primary Gmail account, not the account you set up for Google Voice in Asterisk. In line s,4 replace 6782223344 with the 10-digit cellphone number to which you want incoming call SMS alerts delivered. As we said, nothing else needs to be changed. Now cut-and-paste the custom [incoming-alert] context to the end of /etc/asterisk/extensions_custom.conf. Then reload your Asterisk dialplan: asterisk -rx "dialplan reload"

Now we’re ready to make the Trunk adjustments in FreePBX. Using your browser, open up FreePBX by pointing your browser to the IP address of your server with /admin as the destination. Edit the Trunk or Trunks that you configured in the [incoming-alert] context. Find the line that begins with “context” and change it to context=incoming-alert.

NOTE: If the existing entry you’re replacing wasn’t context=from-trunk, then be sure to write down what the context actually was. Then replace the from-trunk entry in the next to last line of [incoming-alert] with whatever context you wrote down.

Save your Trunk change and reload FreePBX when prompted. Then try a test call to this DID to make sure you receive the two alerts.

Install Growl. The other piece you’ll probably want is Growl, a pop-up notification system for Mac OS X or Windows. With Growl in place, you’ll see alerts like the one above whenever a new call arrives.

CallerID Superfecta Notifications. If you didn’t already know, there are seven additional call notifier options which are available as part of CallerID Superfecta. Every Data Source that begins with Send To is actually a call notifier. Take advantage of them. They’re all free! CallerID Superfecta is included in every PIAF2 installation and can be accessed through the FreePBX GUI. It is brought to you by the fine folks at POSSA. Enjoy!

Update: For an alternate approach that we actually like better, see the Comments.

Originally published: Thursday, July 26, 2012



Astricon 2012. Astricon 2012 will be in Atlanta at the Sheraton beginning October 23 through October 25. We hope to see many of you there. We called Atlanta home for over 25 years so we’d love to show you around. Be sure to tug on my sleeve and mention you’d like a free PIAF Thumb Drive. We’ll have a bunch of them to pass out to our loyal supporters. Nerd Vittles readers also can save 20% on your registration by using coupon code: AC12VIT.




Need help with Asterisk? Visit the PBX in a Flash Forum.
Or Try the New, Free PBX in a Flash Conference Bridge.


whos.amung.us If you’re wondering what your fellow man is reading on Nerd Vittles these days, wonder no more. Visit our new whos.amung.us statistical web site and check out what’s happening. It’s a terrific resource both for us and for you.


 
New Vitelity Special. Vitelity has generously offered a new discount for PBX in a Flash users. You now can get an almost half-price DID from our special Vitelity sign-up link. If you’re seeking the best flexibility in choosing an area code and phone number plus the lowest entry level pricing plus high quality calls, then Vitelity is the hands-down winner. Vitelity provides Tier A DID inbound service in over 3,000 rate centers throughout the US and Canada. And, when you use our special link to sign up, the Nerd Vittles and PBX in a Flash projects get a few shekels down the road while you get an incredible signup deal as well. The going rate for Vitelity’s DID service is $7.95 a month which includes up to 4,000 incoming minutes on two simultaneous channels with terminations priced at 1.45¢ per minute. Not any more! For PBX in a Flash users, here’s a deal you can’t (and shouldn’t) refuse! Sign up now, and you can purchase a Tier A DID with unlimited incoming calls for just $3.99. To check availability of local numbers and tiers of service from Vitelity, click here. Do not use this link to order your DIDs, or you won’t get the special pricing! Vitelity’s rate is just 1.44¢ per minute for outbound calls in the U.S. There is a $35 prepay when you sign up. This covers future usage and any balance is fully refundable if you decide to discontinue service with Vitelity.
 


Some Recent Nerd Vittles Articles of Interest…

Be Sociable, Share!

2 Responses to “GV Call Notifier: Send Jabber and SMS Alerts for Incoming Asterisk Calls”

  1. Ward Mundy says:

    After we wrote this article, we were pointed to another approach that we actually like better. Using this new method, you create a “dummy extension” that handles the notifications. And then you add that extension to a Ring Group handling your inbound calls. The advantage of the new approach is that it also works with Google Voice trunks which currently do not expose the context field for adjustment. Here’s a link to the new code and step-by-step instructions. Special thanks to Bill Simon for finding this new method. Brilliant!

  2. Jason says:

    This is cool & the gang, but what about us folks who have moved on to much more stability for GV by moving GV handling to YATE?

Ringbinder theme by Themocracy