We introduced NAF’s new GVSIP implementation of Google Voice for CentOS 6 and Incredible PBX® 13-13 last week, and today we again have something to celebrate for those in the United States that enjoy free calling. We’re pleased to introduce the GVSIP-NAF add-on for Incredible PBX for the Raspberry Pi 3. You can upgrade any current platform, or you can install a fresh image from here and then perform the GVSIP upgrade. The upgrade procedure takes about 45 minutes, and you’ll need at least an 8GB microSD card to get started. When we’re finished, you can dial *48 and any 10-digit number to reach any phone in the U.S. or Canada. And those same folks can call you by dialing your Google Voice number.

Let’s briefly walk through the upgrade process for today. First, you’ll need a Google Voice OAuth 2 refresh token. If you already have an existing Incredible PBX for RasPi server with a Google Voice trunk, you’ve already been through the drill. Just dig up your refresh token again making sure that you shut down your existing platform before we begin. If you’re upgrading in place, then you’ll need to delete your existing Google Voice XMPP credentials in the FreePBX® GUI and then restart Asterisk.

If you don’t yet have a Google Voice account or a refresh token, see the tutorial below to obtain one. Next, we’ll download an installation script to handle the GVSIP upgrades from NAF. You can run this script as often as you like, and it will remember your Google Voice credentials without having to reenter them. The first time you run the installer, it will upgrade OpenSSL. Next, it upgrades Asterisk to version 13.21.1 after first applying NAF’s latest GVSIP patches. There are lots of them, but the install script will handle all of this for you. Finally, the script puts the dialplan pieces in place to activate your Google Voice trunk and set the inbound and outbound dialing rules. The first time you run the installer, you’ll be prompted for your GV credentials. After that, the prompts will be skipped unless you delete pjsip_custom.conf in /etc/asterisk. When the install finishes, you’re ready to try out some GV calls into and out of your server. By default, you place Google Voice calls by dialing the GV prefix (*48) followed by a 10-digit number, e.g. *48-NXXNXXXXXX. Inbound calls to your Google Voice number will be routed to the Demo IVR (3366). You can modify this setup as desired by following the customization instructions below once the install finishes. Your configuration will not get mangled by again running the installer to upgrade Asterisk’s GVSIP components.

WARNING: This build is solely for the Raspberry Pi 3 platform with its ARM processor. Don’t try to use it elsewhere. See last week’s article if you want to deploy GVSIP-NAF on the CentOS 6 platform.

If you already have a Google Voice refresh_token that you plan to use, then you’re ready to proceed with the GVSIP upgrade. Otherwise, skip down to the Google Voice section of this tutorial to first obtain your credentials.

Deploying GVSIP with Incredible PBX for RasPi

To upgrade your existing Incredible PBX server to support GVSIP, start by logging into your server as root using SSH or Putty. Remember, if you are currently using the Google Voice number either on your Raspberry Pi or another server, you must shut it down, uninstall it using the FreePBX GUI, and restart Asterisk before you begin the upgrade. If you have completed these steps, then simply issue the following commands to kick off the upgrade. Keep in mind that you will need your Google Voice refresh_token and your Google Voice phone number during the install procedure. We want to provide one final cautionary note. This is very new code. While it has been thoroughly tested, your particular platform might introduce new wrinkles we have not encountered. So make sure you have a good backup image of your server setup before proceeding. One final heads up. NAF isn’t the only one improving his code. We’ve made at least a dozen changes to the scripts below in just the last few days. So it’s a good idea to download the latest and greatest installer before proceeding with NAF’s GVSIP updates. To get the very latest versions of everything, it’s also a good idea to first delete /etc/asterisk/pjsip_custom.conf before running the installer again. This will assure that all of your dialplan code gets updated.

cd /root
wget http://incrediblepbx.com/gvsip-naf-raspi.tar.gz
tar zxvf gvsip-naf-raspi.tar.gz
rm -f gvsip-naf-raspi.tar.gz
cd gvsip-naf-raspi
./install-gvsip.sh

When you finish the GVSIP upgrade process, your Legacy Google Voice profile in Settings will morph into something like this:

UPDATE #1: While initially you could leave both Google Chat and the so-called OBiTALK Device enabled, that appears to have changed. You now may need to disable Google Chat in Legacy Google Voice Settings:Phones before inbound calling will work.

UPDATE #2: We recommend that you whitelist obihai.telephony.goog using /root/add-fqdn just to eliminate the remote possibility that the IPtables firewall may disrupt incoming calls. To better monitor PJsip in the Asterisk CLI, issue command: pjproject set log level 5

UPDATE #3: In troubleshooting the failed incoming calls issue, I tried a call from a different phone number. And, presto, the call went through. Apparently, making multiple calls of short duration from the same number gets you placed in Google’s spam bucket. By going into your Legacy Google Voice profile, you can turn Global Spam Filtering OFF in the Settings:Calls tab.

UPDATE #4: In our testing this past week, we’ve discovered that Google Voice usernames used for registration MUST be unique, or your connection will be disconnected when someone else attempts to register with the same username. For this reason, our latest installers generate a unique username based upon your Google Voice 10-digit phone number coupled with a random number. For this reason, inputting your Google Voice phone number now is mandatory.

UPDATE #5: A new installer is now available that supports two Google Voice trunks and (soon) many more. With the new configuration, 10-digit calls with the *GV prefix will be routed to the primary (first) trunk while 11-digit calls with the *GV prefix will be routed to the second trunk. Inbound calls from both trunks are still handled by the existing [from-external-custom] context.

Placing Test Calls with GVSIP

Once the install finishes, you must reboot your server. Then load the Asterisk CLI so you can watch what happens when you place and receive calls using your Google Voice number. To place outbound calls, you’ll need to set up a softphone and connect it to the default extension (701) on your PBX. Your extension 701 password was configured when you first installed Incredible PBX 13-13.

To place an outbound call, dial the GV prefix (*48) followed by a 10-digit phone number. To call into your Google Voice trunk, simply dial the 10-digit Google Voice number from a smartphone or some other phone outside your PBX.

Configuring a Softphone for Incredible PBX

We’re in the home stretch now. You can connect virtually any kind of telephone to your new PBX. SIP phones can be connected directly so long as they have an IP address. These could be hardware devices or software devices such as the YateClient softphone. We’ll start with a free one today so you can begin making calls. You can find dozens of recommendations for hardware-based SIP phones both on Nerd Vittles and the PIAF Forum when you’re ready to get serious about VoIP telephony.

We recommend YateClient which is free. Download it from here. Run YateClient once you’ve installed it and enter the credentials for the 701 extension on Incredible PBX. You’ll need the IP address of your server plus your extension 701 password. In the web GUI, choose Applications _> Extensions -> 701 and write down your SIP Password if you can’t remember it. Fill in the blanks on the YateClient using the IP address of your Server, 701 for your Username, and whatever Password you assigned to the extension when you installed Incredible PBX. Click OK to save your entries.

Once you are registered to extension 701, close the Account window. Then click on YATE’s Telephony Tab and place some test calls using the GV prefix.

If you are a Mac user, another great no-frills softphone is Telephone. Just download and install it from the Mac App Store.

Customizing GVSIP with Incredible PBX 13-13

For future reference, your refresh_token is stored in pjsip_custom.conf in /etc/asterisk. You can modify it to assign a new Google Voice number to your account. Then restart Asterisk. If you wish to reinstall the dialplan code on a subsequent running of the installer, you must first delete pjsip_custom.conf. Otherwise, the GVSIP dialplan code and your refresh_token are preserved.

You also can modify the Google Voice behavior for incoming and outgoing calls by editing extensions_custom.conf. At the top of the file, you’ll find the [from-internal-custom] context which controls outbound calling with your Google Voice trunk. If you would prefer to use a different dialing prefix for outgoing Google Voice calls, simply change *48 to the prefix desired in every line of the context. Or you can remove the dialing prefix and just dial 10-digit calls if you prefer. The instructions are in the comments at the top of the file. Don’t forget to reload your Asterisk dialplan by issuing the following command after making changes: asterisk -rx "dialplan reload"

To modify the Google Voice behavior for incoming calls, jump to the bottom of extensions_custom.conf. There you’ll find the [from-external-custom] context which controls the routing and processing of incoming calls to your Google Voice trunk. Several examples are provided. By default, the inbound calls are routed to the Demo IVR (3366). If your PBX has a Ring Group 777 and you’d prefer to send the calls there, simply change 3366 to 777. If you would prefer to send the calls to an extension, then comment out the Demo IVR line with a semicolon and uncomment the SIP/701 line while also replacing 701 with the extension desired. If you’d prefer to send incoming calls to a specific Asterisk application, an example is provided to route the calls to the NV Weather ZIP application. Then reload your Asterisk dialplan by issuing the following command: asterisk -rx "dialplan reload"

Configuring Google Voice with Incredible PBX

The advantage of Google Voice trunks for those of you in the United States is that all of your calls within the U.S. and Canada are free. You can’t beat the price, and it has worked reliably for many, many years but the XMPP version may disappear any day now. Here’s how to obtain a Google Voice number and a refresh_token for your Google Voice account.

Here are the steps to obtain a free Google Voice number:

1. Set up a dedicated Gmail and Google Voice account to use exclusively for this Google Voice setup on your PBX. Head over to the Google Voice site and register. You’ll need to provide a U.S. phone number to verify your account by either text message or phone call.



2. Once you have verified your account by entering your verification code, you’ll get a welcome message from Mr. Google. Click Continue to Google Voice.



3. Provide an existing U.S. phone number for verification. It can be the same one you used to set up your Google account in step #1.



4. Once your phone number has been verified, choose a DID in the area code of your choice.



Special Note: Google continues to tighten up on obtaining more than one Google Voice number from the same computer or the same IP address. If this is a problem for you, here’s a workaround. From your smartphone, install the Google Voice app from iPhone App Store or Google’s Play Store. Then open the app and login to your new Google account. Choose your new Google Voice number when prompted and provide a cell number with SMS as your callback number for verification. Once the number is verified, log out of Google Voice. Do NOT make any calls. Now head back to your PC’s browser and login to https://voice.google.com. You will be presented with the new Google Voice interface which does not include the Google Chat option. But fear not. At least for now there’s still a way to get there. After you have set up your new phone number and opened the Google Voice interface, click on the 3 vertical dots in the left sidebar (it’s labeled More). When it opens, click Legacy Google Voice in the sidebar. That will return you to the old UI. Now click on the Gear icon (upper right) and choose Settings. Make sure the Google Chat option is selected and disable forwarding calls to whatever default phone number you set up.

5. When your DID has been assigned, click the More icon at the bottom of the left column of the Google Voice desktop. Click Legacy Google Voice. Now click the Settings icon on your legacy Google Voice desktop. Make certain that Forward Calls to Google chat is checked and disable calls to your forwarding number. Click on the Calls tab and select Call Screening:OFF, CallerID (Incoming):Display Caller’s Number, and Global Spam Filtering:checked. The remaining entries should be blank.

6. Google Voice configuration is now complete. Sign out of your Google Voice account.


To use GVSIP, you also need to obtain an OAuth 2 refresh_token:

1. Be sure you are still logged into your Google Voice account. If not, log back in at https://voice.google.com.

2. In a separate browser tab, go to the Google OAUTH Playground using your browser while still logged into your Google Voice account.

3. Once logged in to Google OAUTH Playground, click on the Gear icon in upper right corner (as shown below).

  3a. Check the box: Use your own OAuth credentials
  3b. Enter Incredible PBX OAuth Client ID:

466295438629-prpknsovs0b8gjfcrs0sn04s9hgn8j3d.apps.googleusercontent.com

  3c. Enter Incredible PBX OAuth Client secret: 4ewzJaCx275clcT4i4Hfxqo2
  3d. Click Close

4. Click Step 1: Select and Authorize APIs (as shown below)

  4a. In OAUTH Scope field, enter: https://www.googleapis.com/auth/googletalk
  4b. Click Authorize APIs (blue) button.

5. Click Step 2: Exchange authorization code for tokens

  5a. Click Exchange authorization code for tokens (blue) button

  5b. When the tokens have been generated, Step 2 will close.

6. Reopen Step 2 and copy your Refresh_Token. This is the "password" you will need to enter when you run the GVsip installer below. Store this refresh_token in a safe place. Google doesn’t permanently store it!

7. Authorization tokens NEVER expire! If you ever need to remove your authorization tokens, go here and delete Incredible PBX Google Voice OAUTH entry by clicking on it and choosing DELETE option.

Switch back to your Gmail account and click on the Phone icon at the bottom of the window to place one test call. Once you successfully place a call, you can log out of Google Voice and Gmail.

Yes, this is a convoluted process. Setting up a secure computing environment often is. Just follow the steps and don’t skip any. It’s easy once you get the hang of it. And you’ll sleep better.

Originally published: Wednesday, July 4, 2018


Support Issues. With any application as sophisticated as this one, you’re bound to have questions. Blog comments are a difficult place to address support issues although we welcome general comments about our articles and software. If you have particular support issues, we encourage you to get actively involved in the PBX in a Flash Forum. It’s the best Asterisk tech support site in the business, and it’s all free! Please have a look and post your support questions there. Unlike some forums, the PIAF Forum is extremely friendly and is supported by literally hundreds of Asterisk gurus and thousands of users just like you. You won’t have to wait long for an answer to your question.



Need help with Asterisk? Join our new MeWe Support Site.


 

Special Thanks to Our Generous Sponsors

FULL DISCLOSURE: RentPBX, Amazon, Vitelity, DigitalOcean, Vultr, Digium, Sangoma, 3CX, TelecomsXchange and others have provided financial support to Nerd Vittles and our open source projects through advertising, referral revenue, and/or merchandise. 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 their 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.

Awesome Vitelity Special. Vitelity has generously offered a terrific discount for Nerd Vittles readers. 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. When you use our special link to sign up, Nerd Vittles gets a few shekels down the road to support our open source development efforts 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 our 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 and four simultaneous channels for just $3.99 a month. To check availability of local numbers and tiers of service from Vitelity, click here. NOTE: You can only use the Nerd Vittles sign-up 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. Any balance is refundable if you decide to discontinue service with Vitelity.


RentPBX, a long-time partner and supporter of PIAF project, is offering generous discounts for Nerd Vittles readers. For all of your Incredible PBX hosting needs, sign up at www.RentPBX.com and use code NOGOTCHAS to get the special pricing. The code will lower the price to $14.99/month, originally $24.99/month. It’s less than 50¢/day.


Be Sociable, Share!

This article has 11 comments

  1. "To get the very latest versions of everything, it’s also a good idea to first delete /etc/asterisk/gvsip_custom.conf before running the installer again. This will assure that all of your dialplan code gets updated."

    I think you meant pjsip_custom.conf.

    [WM: Thank you. Fixed.]

  2. Will this be made available also for Ubuntu 14?

    [WM: Glad you asked. We actually don’t support Ubuntu 14.04 any longer because it’s more than 4 years old. However, the new Incredible PBX for Ubuntu 18.04 works perfectly already.]

    Here are the steps:

    1. Install Incredible PBX for Ubuntu 18.04 following our tutorial.

    2. Be sure to reboot and log back in as root. Let the Automatic Update Utility run.

    3. Install the Enchilada upgrade: /root/Enchilada-upgrade.sh

    4. Download and run the GVSIP-NAF upgrade for the Raspberry Pi.

    5. Enjoy!

  3. Thank you, worked like a charm!

  4. this looks promising for those of us who have used the GV/Motif Asterisk connection. I do have a question though

    I’m running the standard off-the-shelf RasPBX download with FreePBX 14 and Asterisk 13. My Motif connection has apparently stopped working (it dials but the I can’t hear the person on the other end)

    Anyway, what do I need to do in order to install this on my Pi? Let’s assume that I start with a fresh install of Raspbx-04-04-2018.

    Thanks!

    [WM: Unfortunately, this installer has been designed for Incredible PBX for the Raspberry Pi. It won’t work with other Raspberry Pi PBX implementations. You’d need to start with a base install of Incredible PBX for the RasPi before using this upgrade script.]

  5. How many numbers can we install with this, just one ? Or run multiple times to install multiple numbers?

    [WM: Multiple numbers is still a work in progress. Say tuned.]

  6. Thanks so much for documenting and providing this information. I used this to upgrade an existing incrediblePBX Asterisk 13.18.0 GV/Motif Rpi2 system connected to a single OBi100 ATA. Incoming calls work fine. Outgoing works if the party answers quickly, but after about 20 seconds I get a call rejected reason 503 error. Only other issues I notice in the logs is the pjsip service-route changes every hour, it complains about ‘Error sending STUN request’ and ‘Header with no vptr encountered!!’ These don’t seem to be a big deal.

  7. How to setup the inbound route , I have the number there but its going to nerdvittles IVR , Thanks !!

    [WM: Reread the Customizing GVSIP section of the article. 🙂 ]

  8. Will this upgrade work on the VirtualBox RasPi OVA version?

    [WM: Should be fine. Just make a backup first.]

  9. Additional Info on my system: Incredible PBX 12.0.74

    So not sure if it’s possible to go from 12.x -> 13.x inline without re-imaging the PI… let me know please.

    [WM: You’ll need a fresh install to move to Incredible PBX 13. Just save your settings and then cut-and-paste.]

  10. Update 2: I got this error "/root/add-fqdn obihai.telephony.goog"

    Syntax: add-fqdn name fqdn (NO spaces in name or fully-qualified domain name)

    [WM: You forgot to include a NAME.]

  11. I failed to install gvsip to Incredible PBX for Ubuntu 18.04. Is this really support Ubuntu?

    [WM: Version 18.04 should be fine with GVSIP-NAF installer. Make a backup first.]

Leave a comment

Your email address will not be published. Required fields are marked *

*