Quantcast
Channel: VOIP Tech Chat forum - dslreports.com
Viewing all articles
Browse latest Browse all 6358

Asterisk/FreePBX and Google Voice postmortem XMPP

$
0
0
The brain power hanging around this forum is understated by far. Thanks to the patient and extremely talented uid://885535, I got my PBX back on the Google Voice gravy train. If it weren't for people like him, we would all likely not understand how a DID works, myself included. Okay. Now with the accolades out of the way, the purpose of this thread is to educate. With the help of uid://885535, my Raspberry Pi can now make phone calls from/to Google Voice without XMPP. Please understand I setup my Pi to my particular needs. My implementation and settings may not match your needs, but it does for me. But feel free to supplement this material for your use case. PRE-REQUISITES This implementation works with FreePBX/Asterisk 14 running Debian/Wheezy on a Raspberry Pi, but may work with other Asterisk-based platforms. I run a Raspberry Pi and can only speak for what it can do. You will need the following to proceed: 1. Direct Inward Dialing number, aka DID. CallCentric provides up to two free DID's per user account. If you are uncomfortable using a New York Stated-based DID, get your own from a different carrier. 2. Google Voice number (Duh!) 3. Python Google Voice. uid://885535 provided this on his thread here: https://www.dslreports.com/forum/r31939325- Or try direct download link here: https://www.dslreports.com/r0/download/2354351~587bc8e1b0f7c34f1e3536cb3a55473a/pygooglevoice.tar.gz 4. Familiarity navigating your PBX using ssh secure console and Putty. STEPS SUMMARY 1. Install pygooglevoice 2. Begin modification of extensions_custom.conf 3. Add Custom Destinations 4. Register your Direct Inward Dialing numbers 5. Implement pygooglevoice trunks 6. Implement Outbound Routes 7. Implement Inbound Routes STEPS 1. Install pygooglevoice. Straight from uid://885535,s thread here: https://www.dslreports.com/forum/r31939325- cd /rootapt-get -y install mercurialapt-get -y install python-pippip install distribute --upgradeeasy_install -U setuptoolseasy_install simplejsontar xfz /root/pygooglevoice.tar.gzcd /root/pygooglevoicepython setup.py installcp /root/pygooglevoice/bin/gvoice /usr/bin/cd /root 2. Begin modification of extensions_custom.conf Using Putty, navigate to /etc/asterisk Then, open text editor to modify extensions_custom.conf. Debian/Wheezy comes with nano. cd /etc/asterisksudo nano extensions_custom.conf. Just for reference, follow along this legend. Please keep in mind I have two Google Voice numbers. If you are only using one, then omit line items for Google Voice number #2. 19175551212 = Google Voice number #1 17185551212 = Google Voice number #2 19145551212 = CallCentric DID #1 19145551213 = CallCentric DID #2 username@gmail.com/password = Account for Google Voice number #1 username2@gmail.com/password2 = Account for Google Voice number #2 [gvp-in-9175551212]exten => s,1,NoOp(CALLERID(number) is ${CALLERID(number)})exten => s,n,GotoIf($["${CALLERID(number)}" = "19175551212"]?cb1)exten => s,n,Goto(from-trunk,19145551212*,1)exten => s,n(cb1),ParkedCall(default,78) [gvp-out-9175551212]exten => _X.,1,Set(ACCTUSER=username@gmail.com)exten => _X.,n,Set(ACCTPASS=password)exten => _X.,n,Set(RINGBACK=19145551212)exten => _X.,n,Set(CALLPARK=78)exten => _X.,n,Goto(gvp-out-common,${EXTEN},1) [gvp-in-7185551212]exten => s,1,NoOp(CALLERID(number) is ${CALLERID(number)})exten => s,n,GotoIf($["${CALLERID(number)}" = "17185551212"]?cb1)exten => s,n,Goto(from-trunk,19145551213*,1)exten => s,n(cb1),ParkedCall(default,79) [gvp-out-7185551212]exten => _X.,1,Set(ACCTUSER=username2@gmail.com)exten => _X.,n,Set(ACCTPASS=password2)exten => _X.,n,Set(RINGBACK=19145551213)exten => _X.,n,Set(CALLPARK=79)exten => _X.,n,Goto(gvp-out-common,${EXTEN},1) [gvp-out-common]exten => _X.,1,System(gvoice -b -e ${ACCTUSER} -p ${ACCTPASS} call ${EXTEN} +${RINGBACK} 1 &)exten => _X.,n,Set(PARKINGEXTEN=${CALLPARK})exten => _X.,n,Park(default,t(15)c(gvp-error,s,1)rs) [gvp-error]exten => s,1,Playback(silence/1&cannot-complete-as-dialed)exten => s,n,Wait(1)exten => s,n,Playtones(congestion)exten => s,n,Wait(10)exten => s,n,StopPlaytonesexten => s,n,Hangup() 3. Add Custom Destinations You do this in FreePBX. Navigate to Admin > Custom Destinations [att=1] Adding new custom destination should look as follows. As you'll notice, this ties in to line item in extensions_custom.conf. Repeat this step a second time if adding two Google Voice numbers to your implementation. [att=2] 4. Register your Direct Inward Dialing numbers. I use CallCentric DID's, but this applies with any carrier of choice. Go to Connectivity > Trunks. [att=3] Add a SIP Trunk. [att=4] General Tab. Give trunk name something meaningful that will help you keep track of things. You're probably not required to do so since this is only DID and not outbound trunk, but if using CallCentric avoid yourself headaches and put in the Outbound CallerID field. You get this number from the Dashboard section of your CallCentric account where you registered your DID. Same goes for Maximum Channels. Not required. [att=5] sip Settings > Outgoing tab Again. Give trunk name something meaningful to help you keep track of things. No spaces allowed here, so come up with something that makes sense to you. This is mostly cosmetic as this is not outbound trunk. [att=6] sip Settings > Incoming tab This is where you register your DID. The registration string for CallCentric is as follows: 17770000000:yourcallcentricsippassword@callcentric.com/17770000000 This information is available from Extensions section in your CallCentric dashboard. [att=7] Hit Submit to submit your changes. No need to hit red box up top to deploy changes just yet. 5. Implement pygooglevoice trunks. This is where uid://885535's secret sauce magic begins. Trunk invokes pygooglevoice script that triggers outbound call connection with Google Voice for placing a call, and the subsequent callback from Google Voice to complete the call with your PBX. Go to Connectivity > Trunks. [att=8] This time you will create Custom Trunk. Give Trunk Name something meaningful to help you keep track of things. Connectivity > Trunks > New Custom Trunk > Dialed Number Manipulation Rules tab. This is to create dialed number shortcuts. In my example, 311 reaches New York City's non-emergency hotline for things like garbage pickup schedule, make a noise complaint, etc. Also, 1917 NXXXXXX provides me with 7-digit dialing for destinations to area code 917. Connectivity > Trunks > New Custom Trunk > custom Settings. This is where Asterisk calls pygooglevoice to initiate the call to Google Voice. This string should match what you added in extensions_custom.conf. So for example: The string directly after LOCAL/$OUTNUM$@ should match same string from extensions_custom.conf from Step 1 above: [gvp-out-9175551212] So complete Custom Dial String should say: LOCAL/$OUTNUM$@gvp-out-9175551212 Hit Submit to save changes. No need to click red box up top to deploy them just yet. 6. Implement Outbound Routes Usual place in FreePBX for adding Outbound Routes. The routes shown are stuff I already implemented on my Pi. Click Add Outbound Route. Name Route Name something meaningful to help you keep track of things. Pick the Custom Trunk you created in Step 5 from drop-down menu Trunk Sequence for Matched Routes. In my example, custom trunk is called GVP_dialout_917. Dial Patterns tab is where you tell Asterisk what dialed digits to match when placing an outbound call. I have a long ass list of Continental USA destinations because that's just how I like to control things. However, most of you can go simple and replace +1201NXXXXXX with +1NXXNXXXXXX and 1NXXNXXXXXX. The important piece of this puzzle is where the number 201 is. This is the extension matching dial pattern. If you use Google Voice like I do, you tie one of your extensions to one Google Voice number. In my example, extension 201 is tied to Google Voice number 917-555-1212. I've tried using 2XX so any extension in the 200's can match dial pattern to try help keep things a little simpler, but the calls fail. Your mileage may vary, so feel free to try something different. 7. Implement Inbound Routes If you've followed along this far, congratulations. You're almost done. Connectivity > Inbound Routes These are routes I already implemented on my Pi. Click Add Inbound Route. Description: Put a description that's meaningful to help you keep track of things. DID Number: This is the 11-DIGIT number from your carrier, NOT the Google Voice number. Set Destination: Select Custom Destinations from drop-down menu. Then right below that, there's a second drop-down menu. Pick the Custom Destination you created in Step 3. In this example, Custom Destination should be CC DID 9145551212 to 9175551212 via GVP. Hit Submit to save changes. No need to click red top up top just yet. Click Add Inbound Route one more time. Description: Put a description that's meaningful to help you keep track of things. This could be the same as last one you did since both are tied to same DID. DID Number: This is the 11-DIGIT number from your carrier, NOT the Google Voice number, PLUS AN ASTERISK AT THE END OF THE NUMBER. So it should read 19145551212* Set Destination: This should be the real destination where inbound calls to your Google Voice number will terminate. In my example, I have an IVR answering all incoming calls, and a Ring Group to bypass the IVR for certain numbers that I want calling me directly. So typically, you would select Extensions from drop-down menu. From drop-down menu below Extensions, select the extension where you want your Google Voice number to ring. Have fun and good luck. THE END

Viewing all articles
Browse latest Browse all 6358

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>