Home » Posts tagged 'freepbx' (Page 39)
Tag Archives: freepbx
A Second Look at Grandstream’s UCM6100 Asterisk PBX & Some SIP Surprises
What a difference a couple months make! For those that are keeping an eye on the UCM6100 Asterisk® PBX from Grandstream, we wanted to provide some additional insights based upon two firmware updates that Grandstream has released since the PBX was first introduced earlier this summer. The short version of this story is Grandstream has addressed most of the open source issues and they’ve resolved well over a hundred bugs. In addition, they’ve published excellent documentation on the PBX in addition to a tutorial on how to interconnect the UCM6100 with other devices including FreePBX®-based Asterisk servers such as PBX in a Flash. So we are pleasantly surprised by Grandstream’s efforts to address many of the concerns that were raised by some of us in the open source community.

UPDATE: Here’s a newer Asterisk appliance for under $30.
Let’s talk about functionality. While the system is still closed in the sense that you can’t add your own Asterisk dialplan code, there’s a lot to like about an under $300 turnkey PBX platform that offers 2 FXO and 2 FXS ports plus most of the feature set you’d find in a $5,000 to $10,000 PBX. And, yes, it even does faxing. The device is especially appealing for organizations that have numerous satellite offices with minimal technical expertise on site. Did we mention you also can backup and restore or even clone multiple units in a matter of minutes using the web-based GUI and an SD card.

We’ve saved the best for last. The silver lining may very well be the functionality boost you’ll get from the addition of a $100 OBi202 device with a Bluetooth adapter.1 This dynamic duo provides turnkey Google Voice support plus Bluetooth cellphone integration which means your cellphone becomes a transparent component in your PBX. When you’re in the office, calls to your cellphone can be managed through the PBX. When the Internet dies, outbound calls from users of the PBX can be routed out through your cellphone. And there’s support for up to three more SIP trunks from many of your favorite providers. Here’s a quick tutorial on how to integrate sip2sip.info and free SIP URIs.

If you glance up at the status screen shot, you’ll see that we have a SIP trunk registered to our primary PBX in a Flash server for transparent calling between extensions on both systems, a Google Voice trunk registered with the OBi202 for free calling in the U.S. and Canada, a second analog trunk registered to the Bluetooth port on the OBi202 to handle cellphone connectivity, a SIP extension registered to a Yealink T46G desktop SIP phone, and an analog extension registered to a collection of Panasonic analog (DECT) cordless phones. We have a Conference Room preconfigured and a Parking Lot to support 5 calls. In addition, there’s voicemail for each extension and an IVR setup (shown below) with virtually the same options you’d have with FreePBX. This is not some half-baked, crippled PBX. Mark Spencer & Co. developed the Asterisk-GUI which is what lies under the UCM6100 covers… and it shows.

Are we switching and dumping PBX in a Flash, Incredible PBX, and FreePBX? Of course not. But, having supported dozens of remote sites staffed with a handful of employees and no technical staff in a prior life, all I can say is this device would have been a godsend. It’s worth a careful look as a supplement to a full-featured central office Asterisk PBX.
Some SIP Surprises to Celebrate the End of Summer
Cloak & Dapper. If you like the clothes, then you’ll love this addition for your PBX. We’ve been exploring SIP URIs and free calling recently, and the one addition that many were clamoring for was an easy way to translate a SIP URI from sip2sip.info or voip.ms into an address using your own domain. By cloaking the address, your email and your "phone address" actually can match. So you can use joe@schmo.com for your email address and joe@schmo.com for your SIP URI as well. Unfortunately, DNS doesn’t speak SIP directly so it takes a little data manipulation to make this work. @w1ve, one of the PIAF resident gurus, actually discovered the sipcloak.org service in New Zealand. But, because of geographical limitations and the fact that it’s not open source, we preferred a home-grown solution. Thanks to the genius of Bill Simon, the magic of YATE, and the hosting generosity of RentPBX2, we now have redundant SIP cloaking servers on the east and west coasts of the United States. To use the service, just add the following records to DNS substituting your own domain and user entries. Once installed, you can receive SIP URI calls using bert@schmo.com or ernie@schmo.com. The PHP source code customized for YATE is available on GitHub. Our extra special thanks to Bill, Diana, and Iman who made this possible!
_sip._udp.schmo.com. IN SRV 10 10 5060 east.pbxinaflash.com.
_sip._udp.schmo.com. IN SRV 10 10 5060 west.pbxinaflash.com.
sip-bert.schmo.com. IN TXT "123@sip2sip.info"
sip-ernie.schmo.com. IN TXT "456@sip2sip.info"
Introducing SIP.US. We’re delighted to introduce a new SIP trunking provider and supporter for the PBX in a Flash project. While Vitelity3 remains the perfect choice for those wanting stellar reliability and pay-as-you-go convenience at rock-bottom pricing, there are organizations that actually need dedicated SIP trunks with an unlimited calling option. And, of course, in the VoIP world, redundancy is a good thing. With today’s special offer for PBX in a Flash users, SIP.US finally hits the $20 magic price point that many of us have clamored for. They also have an incredibly simple and secure module for FreePBX that makes setup a breeze. Here are some of the other advantages the SIP.US service offers:

The signup process couldn’t be easier. Sign up at our link using the PIAF promo code. Choose a free DID and obtain your security PIN for the FreePBX module from SIP.US. Finally, download the SIP.US module for FreePBX to your desktop and install it using Module Admin. Activate the module and enter your security PIN when prompted. That’s it! SIP.US handles the rest of the FreePBX setup process automagically. Give them a try. We think you’ll be delighted.
Deals of the Week. There are a couple amazing deals on the street, but you’d better hurry. ObiHai has all of their telephone adapters on sale at Amazon this week. Click on the Obi110 link in the sidebar to check out the latest pricing. A new company called Copy.com is offering 20GB of free cloud storage with no restrictions on file size uploads (which are all too common with other free offers). Copy.com has free sync apps for Windows, Macs, and Linux systems. To take advantage of the offer, just click on our referral link here. We get 5GB of extra storage which will help avoid another PIAF Forum disaster.
Originally published: Tuesday, August 27, 2013

Need help with Asterisk? Visit the PBX in a Flash Forum.

We are pleased to once again be able to offer Nerd Vittles’ readers a 20% discount on registration to attend this year’s 10th Anniversary AstriCon in Atlanta. Here’s the Nerd Vittles Discount Code: AC13NERD.
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…
- Some of our purchase links refer users to Amazon when we find their prices are competitive for the recommended products. Nerd Vittles receives a small referral fee from Amazon to help cover the costs of our blog. We never recommend particular products solely to generate Amazon commissions. However, when pricing is comparable or availability is favorable, we support Amazon because Amazon supports us. [↩]
- The $15 a month RentPBX hosting special for PBX in a Flash servers in the Cloud is still available through the link in the right sidebar of Nerd Vittles. Better hurry! [↩]
- Vitelity has been and remains a loyal financial backer of the Nerd Vittles and PBX in a Flash projects. We appreciate Vitelity’s continuing support and encourage all of our readers to try out their service with the special pricing included toward the end of this article. [↩]
Practicing Safe SIP: Adding SIP URI and Free DID Connectivity to Asterisk
Last year, we began our exploration of safe SIP options for Asterisk® by introducing a hybrid solution using VoIP.ms for a registered SIP trunk and IPkall for a free DID. Today, in addition to a free IPkall DID to accept incoming PSTN calls, we have a slightly different approach that provides a direct SIP URI address from Sip2Sip.info for your server. As with the original tutorial, today’s implementation preserves our Zero Internet Footprint™ design for total SIP insulation of your server from the Internet. And all of the components to deploy today’s solution are completely free.
PBX in a Flash™ has a long (safe) history in the VoIP community, and the major reason is that we constantly preach never directly exposing any ports on your Asterisk server to the Internet without implementing a WhiteList of safe IP addresses. This Zero Internet Footprint™ design keeps everybody out except a trusted, defined group on your WhiteList. For everyone else, they never see your server. So how do you receive calls?
You do it with phone numbers (DIDs) or SIP URIs tied to registered Google Voice, SIP, and IAX trunks from reputable providers. Because these trunks have constant registrations with safe service providers on the Internet, calls to these DIDs and SIP URIs can flow in and out of your server without exposing your server directly to the Internet. Callers still can contact you, but they do it through an intermediary with whom you have a registered SIP trunk. Thus, the SIP vulnerability (if there is any) remains with the SIP provider and never with your server directly.
For today’s tutorial, we’ll be using the latest and greatest PIAF-Green™ Virtual Machine featuring Asterisk 11 and FreePBX® 2.11. We also recommend installation of Incredible PBX™ 11 which includes Travelin’ Man™ 3 to provide secure WhiteList management for your Asterisk firewall. Here are links to the PIAF-Green VM with Incredible PBX 11 as well as the Travelin’ Man 3 tutorial to get you started. We recommend you configure this using a VirtualBox® virtual machine on your favorite desktop computer just to get comfortable with the setup. Then you can repeat the drill using a dedicated or cloud-based server once you’ve mastered the basics. All of today’s setup will work without making any adjustments to your hardware-based firewall which should be sitting between your desktop computer and the Internet.
Registering for a Sip2Sip Account. Once you have the VoIP platform in place with Asterisk 11, FreePBX 2.11, Incredible PBX 11, and Travelin’ Man 3, you’re ready to add a SIP trunk from Sip2Sip.info. Just sign up for a free account on their site leaving the Account Name field blank. They will email you your credentials. Click on the provided link in the email to access your new account at http://x.sip2sip.info. Your account name will consist of a 10-digit-number@sip2sip.info. To log in, use the default SIP address as shown and leave the password field blank. Then click Login Now. Immediately click on the settings tab, choose an 8-digit numeric password, disable your Voice Mailbox, and click the SAVE button. Your Sip2Sip account is now secure unless someone is lucky enough to guess your password from the 100 million possibilities. You’ll need your 10-digit SIP account number and password to set up your SIP trunk on your Asterisk 11 server in the next step so write them down and then log out of your Sip2Sip account!
FreePBX and Asterisk Configuration Overview. Using a web browser, log into FreePBX® on your server. We’ll need to create several items to get everything working. First, we’ll add a new SIP trunk with your Sip2Sip credentials to handle incoming calls. Second, we’ll add a Custom Trunk to handle outbound calls to Sip2Sip. Third, we’ll add an Inbound Route to process incoming calls. Fourth, we’ll add an Outbound Route so that you can make calls using your outbound Sip2Sip trunk. Calls to other Sip2Sip numbers are free. For the rest, you’ll pay a per minute fee. Whether to use the pay service is completely up to you! Finally, we’ll log into your server as root and add Sip2Sip to your IPtables WhiteList and make two manual adjustments to the Asterisk dialplan to accommodate Sip2Sip’s way of handling SIP calls. Then we’ll restart Asterisk, and you’re done.
- Connectivity -> Trunks -> Add SIP Trunk
- Connectivity -> Trunks -> Add Custom Trunk
- Connectivity -> Inbound Routes -> Add Incoming Route
- Connectivity -> Outbound Routes -> Add Route
- Enable Sip2Sip in your IPtables WhiteList
- Add srvlookup=yes in sip_general_custom.conf
- Set enable=yes in dnsmgr.conf
- Restart Asterisk: amportal restart
Adding Sip2Sip SIP Trunk. While logged into FreePBX 2.11, choose Connectivity -> Trunks -> Add SIP Trunk. Fill out the form like this using your Sip2Sip 10-digit number and password. Unlike some trunk setups, entering your actual 10-digit Sip2Sip number as the Outbound Caller ID is mandatory, or inbound calls will be rejected by your server. Replace 223XXXXXXX with your actual 10-digit Sip2Sip number in the five places shown below. Replace 12345678 with your actual Sip2Sip password in the two places shown below.
- Trunk Name: Sip2Sip
- Outbound Caller ID: 223XXXXXXX
- Dial Pattern: leave blank
- Trunk Name: sip2sip
- Trunk Details:
- type=peer
- canreinvite=no
- nat=yes
- qualify=yes
- domain=sip2sip.info
- fromdomain=sip2sip.info
- outboundproxy=proxy.sipthor.net
- fromuser=223XXXXXXX
- defaultuser=223XXXXXXX
- secret=12345678
- insecure=invite
- context=from-trunk
- host=sip2sip.info&81.23.228.129&81.23.228.150&85.17.186.7
- Register String: 223XXXXXXX:12345678@sip2sip.info/223XXXXXXX
Adding Sip2Sip Custom Trunk for Outbound Calling. While logged into FreePBX 2.11, choose Connectivity -> Trunks -> Add Custom Trunk. Fill out the form like this using the entries below:
- Trunk Name: sip2sip-out
- Dialed Number Matched Pattern: 223NXXXXXX
- Custom Dial String: SIP/$OUTNUM$@sip2sip.info
Adding Inbound Route. Next you need to tell FreePBX how to process incoming calls from your Sip2Sip number. Choose Connectivity -> Inbound Routes -> Add Incoming Route and fill out the form to look like this. Change the destination to match whatever you prefer: an extension, ring group, IVR, etc. If you followed last week’s tutorial to install Lenny Encore, then you can choose Lenny as your destination as well.

Adding Outbound Route. Next you need to tell FreePBX how to process outbound calls to your Sip2Sip account. Choose Connectivity -> Outbound Routes -> Add Route and fill out the form to look like this. After you have saved your entries, make certain that you drag the sip2sip-out route to the top of your Outbound Route List (on the right side). Otherwise, 10-digit Sip2Sip calls may inadvertently be processed by one of your other trunks that handles 10-digit numbers. The 3333 and 4444 numbers are test accounts at Sip2Sip to enable you to try out connectivity.

Adding Sip2Sip to Your IPtables WhiteList. We’re assuming you already have installed Travelin’ Man 3 and secured your server by running /root/secure-iptables. If not, start there. Now we need to enable UDP SIP connectivity for Sip2Sip in your WhiteList by running the following commands while logged in as root:
/root/add-fqdn sip2sip sip2sip.info
/root/add-ip sip2sip1 81.23.228.129
/root/add-ip sip2sip2 81.23.228.150
/root/add-ip sip2sip3 85.17.186.7
Making Asterisk Dialplan Adjustments. While still logged into your server as root, issue the following commands to finish up enabling Sip2Sip URI support in Asterisk. The last command verifies that your Sip2Sip trunk is actually registered.
echo "enable=yes" >> /etc/asterisk/dnsmgr.conf
echo "srvlookup=yes" >> /etc/asterisk/sip_general_custom.conf
amportal restart
asterisk -rx "sip show registry"

Adding an IPkall DID for Your SIP URI. We’ve now completed all the steps necessary to receive incoming SIP URI calls using your new Sip2Sip URI: 323XXXXXXX@sip2sip.info. Anyone in the world can dial that SIP URI from a SIP phone, and the calls will be answered by your server. But suppose we’d also like folks to be able to pick up a Plain Old Telephone and call using Sip2Sip.info to route the incoming call through the SIP URI. Here’s the easy way to do it. Just sign up for a free DID at www.ipkall.com. After choosing an area code for your free number, you’ll be prompted for the following information. Here’s what you’d enter using today’s example:
- Sip2Sip Phone Number: 323XXXXXXX
- SIP Proxy: sip2sip.info
- Email Address: your-email-address
- Password: some-password-to-get-back-into-your-account
Once you’ve completed the form, submit it and wait for your new phone number to be delivered in your email. You should get it within a couple minutes so check your spam folder if you don’t see it. Congratulations! You’ve done everything you need to do for anyone to call you using either your Sip2Sip URI or your new DID number from IPkall.
It’s worth noting that IPkall recycles DIDs that aren’t used for 30 days. If you use Incredible PBX, the easiest way to assure you don’t lose your number is to set up a weekly recurring Telephone Reminder that calls your IPkall number.
Adding SIP URI Dialing with Your Own Domain. Thanks to a great tip from @w1ve on the PIAF Forum, you now can create free SIP URIs using your own domain. Here’s how.
Troubleshooting. If you experience intermittent congestion issues with attempted connections to your SIP URI, try the [from-sip-external] trick outlined in our PIAF Forum posting.

Add Free Calls to 40 Million Asterisk Servers with e164.org. While we’re on a roll of free calling, here’s a simple way to add free calling to 40 million Asterisk servers around the world. Just add your name and phone numbers to the e164.org registry at no cost and configure FreePBX with ENUM support. Then outbound calls to numbers in the e164 registry will always be free as well. The whole setup takes less than 10 minutes. Here’s how.
You already have a SIP URI for your Asterisk server from the Sip2Sip setup above. Now let’s get you signed up with an account on e164.org. Go to the web site and click the Sign Up tab. Go through the sign up drill and then log into your new account. Then click the Phone Numbers tab and add your IPkall phone number to e164. If you have additional DIDs, enter the area code and number for each of them. Then click the Next button. You’ll be warned about not having the number you’ve specified redirected to an IVR. If you already have this DID redirected to an IVR, change the routing temporarily to an extension that you can answer to obtain your PIN before you press Next to proceed. You’ll then be prompted for the SIP address to contact your server. Leave the default SIP protocol and plug in the address you were assigned by Sip2Sip. As soon as you click the Next button, your phone should start to ring, but there may not be a message when you answer. Hang up and wait for the second call within 15 minutes. It will include your PIN. Now click on the Phone Numbers tab and update your phone entry by choosing Enter PIN and typing your assigned PIN. Your phone number now has been activated with the e164 service. To complete the setup, you’ll want to click on the Do Not Call option and make your selections. You also can decide whether to list yourself in the ENUM White Pages directory.
Remember that the real purpose of this drill is to avoid charges when you place outbound calls to numbers in the ENUM directory. We merely added your numbers to e164.org so that others could benefit as well. So the final step before you can start saving money is to configure FreePBX to handle ENUM lookups for outbound calls from your server. One more observation may be helpful. You’ll recall that one of the limitations of FreePBX has always been that once an outbound route was chosen for a call, if the call was completed using the first destination trunk in that route, then the call processing ended there. ENUM adds a new wrinkle because we basically want to connect to ENUM to check for a free route and, if no matching entry is found, then we want the next trunk to process the call. As luck would have it, FreePBX has been tweaked to allow this scenario. All you have to do is create an ENUM trunk and then place it first in your sequence of trunks for each of your outbound routes. If an ENUM entry is found for the number you’re calling, the call will be routed as a free call with a direct SIP connection. Otherwise, the call processing will continue and the call will be routed using the next trunk specified in your outbound route.
There are two steps in FreePBX to implement ENUM. First, create a special ENUM trunk. Second, adjust your Outbound Routes to process outbound calls using the ENUM trunk first. Then the series of trunks you already have specified in each outbound route will be triggered if there is no ENUM path for your call. NOTE: You obviously wouldn’t do this for an emergency 911 outbound route.

In FreePBX, click Connectivity -> Trunks, Add ENUM Trunk. Enter your desired CallerID for these calls. Set a maximum number of channels, if desired, and then leave the other entries blank in most cases. Save your settings and reload your dialplan. Now click Connectivity -> Outbound Routes and adjust the sequence of trunks for each of your existing routes. Be sure to put ENUM in the top position of each desired route. Also make certain that all calls are dialed with a dial string of 1NXXNXXXXXX or NXXNXXXXXX with a Prepend entry of 1 as shown below. Enjoy!

Don’t forget to List Yourself in Directory Assistance so everyone can find you by dialing 411. And add your new number to the Do Not Call Registry to block telemarketing calls. Or just call 888-382-1222 from your new number.
Deals of the Week. There’s still one amazing deal on the street, but you’d better hurry. A new company called Copy.com is offering 20GB of free cloud storage with no restrictions on file size uploads (which are all too common with other free offers). Copy.com has free sync apps for Windows, Macs, and Linux systems. To take advantage of the offer, just click on our referral link here. We get 5GB of extra storage which will help avoid another PIAF Forum disaster.
Originally published: Monday, August 19, 2013

Need help with Asterisk? Visit the PBX in a Flash Forum.

Don’t miss the first-ever FreePBX World on August 27-28 at the Mandalay Bay in Las Vegas. For complete details, see this post on the FreePBX blog.

We are pleased to once again be able to offer Nerd Vittles’ readers a 20% discount on registration to attend this year’s 10th Anniversary AstriCon in Atlanta. Here’s the Nerd Vittles Discount Code: AC13NERD.
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…
2013 Greatest Hits: Lenny Returns for an Encore Performance

Nothing in the VoIP community this year quite captured the hearts and minds of geeks around the world like Brian West’s "Lenny." For anyone that’s ever been dogged by obnoxious telemarketers or that’s had to deal with less than lucid tech support inquiries, Lenny was a godsend. Finally, we all had a place to send those poor souls while getting our daily chuckle listening to the results. If you’re late to the party and missed all the fun, then start today by listening to some of the recordings posted on ItsLenny.com and Reddit. Our personal favorite has got to be the "security expert" explaining the discovery of a vulnerability in Lenny’s network:
As if Brian needed another feather in his cap after FreeSwitch™, what made Lenny an instant hit was the ability to reroute telemarketing and blacklisted callers directly to ItsLenny.com headquarters for processing. The site provided numerous local phone numbers around the world as well as a SIP URI. For those in the PBX in a Flash™ and FreePBX® community, it was especially easy because of the Lorne Gaetz Lenny Blacklist Mod. By simply entering the SIP URI of Lenny, all of your telemarketers were immediately rerouted to Lenny. And then one day, The Music Died.
What? No more Lenny? Were we all destined to return to the screaming monkeys?
Well, not so fast. We got in touch with Brian to inquire about Lenny’s health. Brian explained that he was seeking a more robust home for our pal because of the tremendous response and worldwide usage of the ItsLenny.com site.
Brian also graciously offered permission to use the Lenny recordings for those that wanted to host their own "Lenny" during the interim. And that brings us to today. We’re not sufficiently proficient in FreeSwitch to offer an interim solution on that platform. And, for our shortcomings, we apologize. But what we can do is provide an Asterisk® alternative that you can host on your own server until Lenny returns to his former glory in his new home.
Introducing Lenny Encore! We’ve actually got a number of new creations to introduce today. First, we’ll give you a short law school lesson on the do’s and don’ts of recording phone calls. Second, today’s Lenny Encore dialplan code introduces the Asterisk BackgroundDetect function which actually waits for someone to speak and then proceeds when silence ensues. It’s not perfect, but it helps with applications like this and for applications that seek to detect the presence of answering machines when making robocalls. Third, we’ll show you how to use the Lenny Blacklist Mod in FreePBX to redirect blacklisted callers to any extension you wish rather than merely playing a congestion or Zapateller Special Information Tone (SIT). Fourth, we’ll show you how to record calls in Asterisk with one line of dialplan code. Fifth, we’ll document for the first time how to create a button on almost any SIP phone to reroute ringing (unanswered) incoming calls to another extension. Sixth, we’ll review how to safely set up your own SIP URI and Free DID to enable Lenny Encore access from anywhere. And, finally, we’ll provide you some links to take Lenny Encore for a test drive before you install anything. Please don’t use these links as a destination for your blacklist. The links will only be available for a few weeks. Now let’s get started.
Law School 101: Recording Phone Calls. For openers, this is not legal advice! Consult your own attorney for that. This is merely background information to hopefully alert you to some of the pitfalls which await should you decide to start recording phone conversations. One of the first things you learn in law school is that there’s a difference of legal opinion on almost every topic. That’s why both sides pay lawyers which is a good thing… for lawyers. So it is with the law pertaining to the recording of phone calls. Let’s start with the ABC’s of phone recording. Whether you can legally record a phone call between you and someone else depends upon several things: (A) the location of the person making the call, (B) the location of the person receiving the call, and (C) how the call makes the journey from Point A to Point B.
In some jurisdictions, you probably can’t record a phone call at all because you can’t legally operate an Asterisk server. In other jurisdictions, you can record a call if you give yourself permission to record your conversations with others. In a few jurisdictions (including at least a dozen states in the United States), both parties have to consent before you can record a phone call. In some of those, providing an announcement that you’re recording the call will suffice while in others you have to explain why you’re recording the call and allow the caller to opt out. At least in the United States, if the call crosses state lines then federal law may control; however, there may also be federal agency rules and regulations that impose additional constraints on interstate calls. In law school, there’s a full-semester course devoted to Conflict of Laws. What you need to know is that normally (but not always) the law of the jurisdiction in which the call is initiated controls. Clear as mud? You bet. Here’s the state-by-state and country-by-country breakdown of the rules for those of you that are curious. The moral of this story should be clear:
UNLESS YOUR INITIALS ARE NSA, DON’T RECORD PHONE CALLS UNLESS YOU’VE CONSULTED A LAWYER AND CAREFULLY EXPLAINED WHO THE CALLING PARTIES WILL BE, WHAT YOU INTEND TO RECORD, WHERE EACH POTENTIAL CALLER WILL BE CALLING FROM, WHEN YOU WILL BE RECORDING THE CALLS, WHY YOU ARE DOING IT, AND HOW YOU WILL BE RECORDING THE CALLS. And this isn’t going too well for the NSA either!
6 P.M. UPDATE: A couple of serious bugs were discovered in the initial release. If you’ve already installed Lenny Remake, please replace the original dialplan code using the following commands. Skip this step if you have not previously installed Lenny Remake. The first-time install instructions below have been corrected to remove the problem. Our apologies.
cd /tmp
wget http://pbxinaflash.com/lsupport.tgz
tar zxvf lsupport.tgz
rm lsupport.tgz
sed -i '\:// BEGIN Lenny Remake:,\:// END Lenny Remake:d' /etc/asterisk/extensions_custom.conf
sed -i '/\[from-internal-custom\]/r /tmp/lenny.txt' /etc/asterisk/extensions_custom.conf
rm lenny.txt
rm 3.gsm
asterisk -rx "dialplan reload"
amportal a r
Installing Lenny Encore for the First Time. Now for the fun stuff. We’ve only tested this on PBX in a Flash servers running Asterisk 1.8 and Asterisk 11. For other platforms, there may be some prerequisites that you have to address. On the PIAF platform, log into your server as root. Then create and run a shell script that looks like this:
#!/bin/bash
mkdir /var/lib/asterisk/sounds/lenny
chown asterisk:asterisk /var/lib/asterisk/sounds/lenny
cd /var/lib/asterisk/sounds/lenny
wget http://pbxinaflash.com/Lenny.tgz
tar zxvf Lenny.tgz
rm Lenny.tgz
cd /tmp
wget http://pbxinaflash.com/lsupport.tgz
tar zxvf lsupport.tgz
rm lsupport.tgz
sed -i '\:// BEGIN Lenny Remake:,\:// END Lenny Remake:d' /etc/asterisk/extensions_custom.conf
sed -i '/\[from-internal-custom\]/r /tmp/lenny.txt' /etc/asterisk/extensions_custom.conf
rm lenny.txt
mv 3.gsm /var/lib/asterisk/sounds/lenny
cd /var/lib/asterisk/sounds/lenny
chown asterisk:asterisk *
chmod 755 *
echo " " >> /etc/asterisk/extensions_custom.conf
echo "[bridgit]" >> /etc/asterisk/extensions_custom.conf
echo "exten => 4,1,Pickup(701@from-internal)" >> /etc/asterisk/extensions_custom.conf
echo "exten => 4,2,Pickup(777@from-internal)" >> /etc/asterisk/extensions_custom.conf
echo " " >> /etc/asterisk/extensions_custom.conf
asterisk -rx "dialplan reload"
amportal a r
echo "Try it out by dialing 53669 from any extension on your PBX."
In the [bridgit] section of the code (at the bottom of the script), you’ll see two extensions in bold: 701 and 777. These represent a phone extension and ring group on your server that handle incoming calls from telemarketers. We’ll explain it in more detail shortly. For now, change the numbers to match your setup before you run the script. If you want to manage telemarketing calls from additional extensions with SIP phones, just add additional lines to the [bridgit] context incrementing the line numbers as you go, e.g. 4,3 then 4,4, etc.
Installing Lenny Blacklist MOD. To automatically reroute blacklisted callers to Lenny Encore, you’ll need to modify the blacklist processing setup in FreePBX. To do this, you first have to install the Lennny Blacklist MOD. Download it to your desktop from the Download Now link. Next, add it to FreePBX in the usual way: Admin -> Module Admin -> Upload Modules. Choose the Lenny Blacklist MOD on your Desktop. Once its imported, click on the Local Module Admin link to install and enable it. Once it’s enabled, open it under Other -> Lenny Blacklist MOD. Configure it to match what’s shown below:
Recording Calls with Lenny Encore. By default, Lenny Encore will do its thing with no call recording. If you and your lawyer think recording is a good idea, here’s how to enable it. Log in as root and edit extensions_custom.conf in /etc/asterisk. Simply uncomment the three lines near the top of the file that look like what’s shown below and reload your dialplan:
;exten => 53669,n,MixMonitor(/tmp/Lenny/${RECORDING}.wav)
;exten => 53669,n,NoOp(Recording will be available: /tmp/Lenny/${RECORDING}.wav)
;exten => 53669,n,Playback(en/this-call-may-be-monitored-or-recorded)
This gets the recordings saved to the /tmp/Lenny directory on your server, but these file collections can grow large. We recommend emailing them to yourself in MP3 format once a day and then deleting them. Here’s how to set this up:
cd /root
wget http://nerdvittles.com/convert2mp3.tar.gz
tar zxvf convert2mp3.tar.gz
nano -w convert2mp3.sh
When the editor opens, plug in your email address for delivery of the files and then save the modified script. Now add an entry to /etc/crontab that looks like this:
6 1 * * * root /root/convert2mp3.sh >/dev/null 2>&1
Reroute Ringing Calls to Lenny Encore. We’ve never seen this documented for Asterisk so here’s a bonus for this week. Have you ever wanted to reroute an incoming call to another extension while it was ringing so that you didn’t have to answer, tell the caller to hold, and transfer the call? Well we have, too. That’s especially true in the case of telemarketers and politicians.
As part of the Lenny Encore dialplan code, we’ve added the necessary piece to get this working on many SIP phones with a spare button that can be pressed to dial a number. Many phones call it a Speed Dial entry. Just create a Speed Dial entry for your phone that looks like this:

Now, when the CallerID shows an annoying caller is ringing, just press the Lenny key!
But suppose you want to make this more generic. If you’d like to be able to press the Lenny key and be prompted for the extension number to which to forward the incoming call, then edit the 536691 dialplan code (as we did with call recording) and uncomment the following lines:
;exten => 536691,n,Flite("After the beep, enter extension or press pound for Lenny.")
;exten => 536691,n,Read(SENDTO,beep,7)
;exten => 536691,n,GotoIf($["foo${SENDTO}" = "foo"]?5:6)
If you hit the Lenny key while an incoming call is ringing and enter an extension number followed by #, then that’s where the call will go. If you just hit #, then Lenny Encore gets the call.
Taking Lenny Encore for a Test Drive. We’ve set up a temporary site to let you try Lenny out before installing on your own server. Just call 1-206-424-6913 or use either of the following SIP URIs: 2233435945@sip2sip.info or lenny@nerdvittles.com. Our next article shows you how to do it yourself!
Upgrading Lenny Encore. This project is still a work in progress. What that means is the code is changing almost daily. You can replace your setup with the latest code by following the 6 p.m. update procedure documented above. This will reset your system to NO RECORDINGS in addition to loading the latest dial plan code. Your feedback is, of course, always appreciated. Come join the fun!
More Lenny Encore to Come! Well, that’s enough to keep you busy this week. Next week (now available!), we’ll walk you through setting up a safe SIP URI and free DID to handle inbound calls for Lenny or any other purpose on your PBX in a Flash server.
Deals of the Week. There are a few amazing deals still on the street, but you’d better hurry. First, for new customers, Sangoma is offering a board of your choice from a very impressive list at 75% off. For details, see this thread on the PIAF Forum. Second, a new company called Copy.com is offering 20GB of free cloud storage with no restrictions on file size uploads (which are all too common with other free offers). Copy.com has free sync apps for Windows, Macs, and Linux systems. To take advantage of the offer, just click on our referral link here. We get 5GB of extra storage, too, which will help avoid another PIAF Forum disaster. Finally, O’Reilly has over 1,000 Packt Ebooks on sale for 50% off until August 15. Only 3 days left!
Originally published: Monday, August 12, 2013

Need help with Asterisk? Visit the PBX in a Flash Forum.

Don’t miss the first-ever FreePBX World on August 27-28 at the Mandalay Bay in Las Vegas. For complete details, see this post on the FreePBX blog.

We are pleased to once again be able to offer Nerd Vittles’ readers a 20% discount on registration to attend this year’s 10th Anniversary AstriCon in Atlanta. Here’s the Nerd Vittles Discount Code: AC13NERD.
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…
Taking a Page from Asterisk: How Far We Have Come
We’ve never written about paging technology before, and this is one of those areas of VoIP telephony where it certainly paid to wait. What a difference a few years makes! At least in the Asterisk® context, SIP-based paging traditionally involved issuing a Page command with a list of extensions in your dialplan. The wrinkle was that each VoIP phone manufacturer had its own SIP header to trigger autoanswer on its phones. And, without autoanswer, paging becomes next to worthless with desktop phones. Then came FreePBX®. It took all the pain out of the process by using the *80 prefix to issue a page to almost any type of SIP phone. The one wrinkle was that Grandstream and a few other phones require that autoanswer be enabled for paging in the device configuration. Aside from that, any user can pick up a phone on a PBX in a Flash system and dial *80707 to page extension 707 with duplex voice communications through the speakerphones, meaning both parties can talk and listen to each other, the perfect VoIP intercom. And, there’s more good news. Paging works with almost all of the major phone manufacturers’ phones: Aastra, Digium, Grandstream, Linksys/Sipura, Mitel, Polycom, SNOM, and Yealink. In addition, the SIP-compatible Cyberdata ceiling speaker and Cyberdata POE Doorphone/Intercom with Keypad function just like a SIP phone.

For small groups of phones, paging now works equally well using the FreePBX Paging Module which allows an administrator to preconfigure a group of phones, specify whether to skip busy extensions, barge into busy extensions and place existing callers on hold, or whisper the page to the busy extensions. You can even enable or disable duplex communications during the page. Think of it as instant conference. The module also provides the flexibility for individual phone users to block pages from one or more extensions or even all extensions. Finally, the module lets you create and save multiple configurations for different purposes, and you can designate an Announcement message that plays to every page recipient. For a historical look at the evolution of paging on the Asterisk platform, see Chapter 11 of Asterisk: The Definitive Guide (4th edition). Better yet, buy the book!
So why do we need paging? In the corporate setting, it provides a perfect emergency broadcast service for fires, earthquakes, patient escapes from the loony bin, etc. In a school setting, it could inexpensively replace costly public address systems requiring dedicated wiring, speakers, and amplifiers. The Asterisk paging solution has the added benefit of letting anyone broadcast from anywhere by simply picking up a nearby phone and dialing some (hopefully password-protected) extension number. Separate RTP streaming IP addresses also could be configured on departmental phones to allow automobile dealership zone paging for parts, sales, or service. So a receptionist could park a call and then announce it to a particular department by pressing a softkey on the sidecar. And you still could have an additional emergency channel that reaches everybody. Just set up a different number to page each zone as well as the entire organization.

So that’s where we were until a week ago when Brian Kelly of PIAF Forum fame began exploring Multicast RTP Paging with Asterisk and AirPlay. Think of Multicast RTP as a radio station that streams data on a particular IP address and port. If you happen to have Multicast-aware SIP phones, they can "tune in" to particular channels of interest. And, whenever a stream is broadcast on one of the channels the phone device is preconfigured to listen to, it will go off hook just as if it had received a page as outlined above. The major advantage to RTP streaming is that there is only a single stream of data on a single channel whereas paging to multiple extensions requires a channel of data for every extension. If you want to follow along with today’s project, just configure one of the Multicast RTP streams on your phone with the port and IP address shown below.
The wrinkle is your phone devices must support Multicast RTP streaming, and many current models do not. Our VoIP Phone of the Year, the Yealink T46G, qualifies. So do some of the Aastra, SNOM (v7), and Linksys/Cisco phones (with quirks!). And the Cyberdata speaker and doorphone (above) support Multicast RTP streaming as well. Digium Phones currently do not. If you know of other phones that support Multicast RTP streams, please post a comment. You’ll know if your particular phone supports it if it has a configuration section in the manual that looks something like this:

The good news is current versions of Asterisk including 1.8, 10, and 11 support Multicast RTP Streaming and PIAF-Purple and PIAF-Green come preconfigured for RTP Multicast Streaming. A single line of dialplan code is all you need to initiate a broadcast:
exten => 1234,1,Dial(MulticastRTP/basic/224.0.0.1:1234)
This would cause the Multicast RTP Stream broadcast to begin on port 1234 of IP address 224.0.0.1 as soon as someone on your PBX in a Flash server dialed extension 1234 and began to speak. Every phone or SIP device listening for broadcasts on port 1234 from IP address 224.0.0.1 would receive the listen-only page on their speakerphone.
Of course, Brian was not content to merely issue a page from Asterisk to his SIP phones. He wanted all of them to be able to listen to his iTunes music collection using his iPhone or iPad. This required AirPlay, but AirPlay can only stream to iOS devices. Well, not so fast. An enterprising guru on SourceForge created his own AirPlay emulator called Shairport4w. This is a Windows application that works just like an AirPort server. It "listens" for content from an iPhone or iPad that has designated Shairport4w as its AirPlay device. iTunes has the ability to stream music to any AirPlay device including the Shairport4w. So that was half of the puzzle. That got iTunes music playing great on the Windows desktop.
But we needed the other piece of the puzzle. We needed to push the music from the Windows machine to the SIP phones using Multicast RTP streaming. Brian found the missing piece of the puzzle for that as well. It’s called Multicast Streamer for Windows and it’s available at no cost from CodeProject. Simply download and unzip the bundle of goodies and run Multicast Streamer on your Windows desktop together with Shairport4w. Shairport4w captures the incoming AirPlay stream and pushes it to the sound card.
Now we simply need to configure the sound card as the input device for Multicast Streamer and make the appropriate settings to broadcast the RTP stream to port 1234 on IP address 224.0.0.1. This was the listening port and IP address we configured on our SIP phones. Be sure to also adjust the Samples per second to 8,000 and the Bits per Sample to 16.
Your mileage may vary but in our case the only output device showing on Multicast Streamer was Microphone. What we needed was Stereo Mix to capture data from the sound card rather than the microphone. If yours is missing, do the following. Right-click on the Speaker icon and switch to the Recording tab. If you don’t see Stereo Mix, then Right-click on an empty area and make sure that both "Show Disabled Devices" and "Show Disconnected Devices" are checked. When the Stereo Mix option appears, Right-click on it and check Enable. Set the level to 100. Now it will also appear as an input device when you restart Multicast Streamer. Choose it as the default input device, make sure all your other settings match what we outlined above, and then click Start to begin the stream. Now stroll over to your iPod music player app on your iPhone or iPad, choose Shairport4w as the AirPlay output device, and play away. To cancel the stream on any phone, just hangup the speakerphone. Enjoy!
Deals of the Week. There are a couple of amazing deals still on the street, but you’d better hurry. First, for new customers, Sangoma is offering a board of your choice from a very impressive list at 75% off. For details, see this thread on the PIAF Forum. Second, a new company called Copy.com is offering 20GB of free cloud storage with no restrictions on file size uploads (which are all too common with other free offers). Copy.com has free sync apps for Windows, Macs, and Linux systems. To take advantage of the offer, just click on our referral link here. We get 5GB of extra storage, too, which will help avoid another PIAF Forum disaster.
Originally published: Monday, July 22, 2013

Need help with Asterisk? Visit the PBX in a Flash Forum.

Don’t miss the first-ever FreePBX World on August 27-28 at the Mandalay Bay in Las Vegas. For complete details, see this post on the FreePBX blog.

We are pleased to once again be able to offer Nerd Vittles’ readers a 20% discount on registration to attend this year’s 10th Anniversary AstriCon in Atlanta. Here’s the Nerd Vittles Discount Code: AC13NERD.
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…
Triple Treat: Some Asterisk Utilities to Brighten Your Summer
[purehtml id=12]
If you live and breathe Asterisk® but don’t visit the PIAF Forum regularly, you’re missing one of the best VoIP resources on the Internet. To get everyone in the Independence Day mood, we thought we’d share a few of the new goodies that have appeared on the PIAF Forum since The Great Crash of 2013. Although each of these utilities was designed to support PBX in a Flash™ and Incredible PBX™ systems, with a little tweaking, they’ll work equally well on other CentOS 6-based Asterisk servers of any flavor so long as the base version of Asterisk is at least 1.8. They also run just fine with Incredible PBX for the Raspberry Pi.

Import Google Contacts into Asterisk Phonebook. For everyone still using Gmail after the NSA disclosures, this app is for you. Now you can share your Google Contacts with Asterisk as well as the NSA. The beauty of this utility is that it also makes your Google Contacts available as a CallerID Name lookup source for CallerID Superfecta. So all of those cellphone numbers in your contacts will now display real CallerID names when those folks call you. Our special tip of the hat to John Babb for producing the original script and to @raphou for finding it and sharing it with the PIAF community.
Before you can import your Google Contacts into the Asterisk Phonebook, you first need to install Google’s gdata Python client. Just log into your server as root using an SSH client and issue the following commands:
cd /root
mkdir Google
cd Google
wget https://gdata-python-client.googlecode.com/files/gdata-2.0.18.tar.gz
tar zxvf gdata*
cd gdata*
chmod +x setup.py
./setup.py install
wget http://pbxinaflash.com/googlecontacts.py
nano -w googlecontacts.py
Once the editor opens, you need make a couple changes in googlecontacts.py. NOTE: We’ve adjusted the original code for use in the United States. If you’re living elsewhere, then grab the original code on the PIAF Forum.
The code you downloaded looks like this (plus some required indentation):
#!/usr/bin/python
# googlecontacts.py v0.1
# By: John Baab
# Email: rhpot1991@ubuntu.com
# Purpose: syncs contacts from google to asterisk server
# Requirements: python, gdata python client, asterisk
#
# License:
#
# This Package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this package; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# On Debian & Ubuntu systems, a complete copy of the GPL can be found under
# /usr/share/common-licenses/GPL-3, or (at your option) any later version
import atom,re,sys,os
import gdata.contacts
import gdata.contacts.service
def main():
# Change this if you aren't in the US. If you have more than one country code in your contacts,
# then use an empty string and make sure that each number has a country code.
country_code = ""
gd_client = gdata.contacts.service.ContactsService()
gd_client.email = "yourname@gmail.com"
gd_client.password = "your_password"
gd_client.source = 'gcontact2ast'
gd_client.ProgrammaticLogin()
query = gdata.contacts.service.ContactsQuery()
query.max_results = 1000
feed = gd_client.GetContactsFeed(query.ToUri())
# delete all of our contacts before we refetch them, this will allow deletions
os.system("asterisk -rx \'database deltree cidname\'")
# for each phone number in the contacts
for i, entry in enumerate(feed.entry):
for phone in entry.phone_number:
# Strip out any non numeric characters
phone.text = re.sub('\D', '', phone.text)
# Remove leading digit if it exists, we will add this again later for all numbers
# Only if a country code is defined.
if country_code != "":
phone.text = re.sub('^\+?%s' % country_code, '', phone.text)
# Insert the number into the cidname database, reinsert the country code if defined.
os.system("asterisk -rx \'database put cidname %s%s \"%s\"\'" % (country_code,phone.text,entry.title.text))
if __name__ == "__main__":
main()
Before you save the script, you’ll need to make a few adjustments. First, insert your actual Gmail account name and password in lines 37 and 38. If you’re using 2-step authentication with your Google account, remember to generate and use an application-specific password. Your regular password won’t work! Second, if your Google Contacts include more than 1,000 phone entries, adjust the default setting on line 42. Now save the script: Ctrl-X, Y, then Enter. Then make the script executable: chmod +x googlecontacts.py.
Now you’re ready to import your Google Contacts. Just issue the following command: ./googlecontacts.py
You can check whether the import was successful by displaying a list of all the new entries in your Asterisk Phonebook. Here’s the command:
asterisk -rx "database show cidname"
Want to import entries from more than one Google account? It’s easy. Just make a duplicate of the script and repeat the setup process above with your new credentials. You’ll also need to comment out line 46 in the second script so that your previous import doesn’t get wiped out of the Asterisk Phonebook when you run the second script. Just make a mental note to run the scripts in the proper order whenever you wish to update your Asterisk Phonebook.

UPDATES: There’s now an Asterisk Phonebook app for Yealink T46G Color SIP phones. Once installed, you can look up and call numbers in your Asterisk Phonebook by pressing a button on your phone. Read all about it and download the app from the PIAF Forum.
For those using Google to host your own domain, there’s now a patch to let you import your Google Contacts into the Asterisk Phonebook as well. See this post on the PIAF Forum for the procedure.
If you’d like to keep your Asterisk Phonebook sync’d with your Google Contacts, then run the script every night by inserting the following line in /etc/crontab:
9 0 * * * root /root/Google/gdata-2.0.18/googlecontacts.py >/dev/null 2>&1
Now that you have your contacts imported, we need to adjust CallerID Superfecta so that incoming calls are scanned for a phone number match using the Asterisk Phonebook. Using a web browser, open FreePBX® and choose the CallerID Superfecta application. Modify CallerID Superfecta Lookup Sources in FreePBX to include Asterisk Phonebook. Make certain the Asterisk Phonebook entry appears near the top of the list so that it gets examined before any external lookup sources. This speeds up incoming call connections considerably.

Email Daily Call Log to Yourself. Many have requested a simple way to have a snapshot of your incoming daily calls emailed to the Asterisk administrator each day. Special thanks to @Boolah for the code. Using any PIAF system, simply create a file in /root called cdrlog.sh that looks like this:
#!/bin/bash
mysql -u root -ppassw0rd asteriskcdrdb -e 'SELECT calldate, clid FROM cdr WHERE DATE(calldate) = SUBDATE(CURDATE(), 1) AND did <> ""'
For Incredible PBX for the Raspberry Pi, the script should look like this:
#!/bin/bash
mysql -u root -praspberry asteriskcdrdb -e 'SELECT calldate, clid FROM cdr WHERE DATE(calldate) = SUBDATE(CURDATE(), 1) AND did <> ""'
Make the script executable: chmod +x /root/cdrlog.sh
Then run the script: /root/cdrlog.sh
If you’d like the listing of the previous day’s calls emailed to you each day, then add the following entry to /etc/crontab after inserting your actual email address:
8 0 * * * root /root/cdrlog.sh | mail -s "Daily Call Log" yourname@gmail.com >/dev/null 2>&1
Trunk Failure Email Alerts. One of the most frequently requested scripts on the PIAF Forum has been a utility which would alert you when one of your Asterisk trunks has failed. So here you go. This script monitors SIP, IAX2, and Google Voice trunks and sends you an email whenever one or more of the trunks fails. Just download the script, insert your email address at the top of the script, and add an entry to /etc/crontab to check the trunks as often as desired. The default setting is every 5 minutes.
cd /root
wget http://pbxinaflash.com/trunkcheck.tar.gz
tar zxvf trunkcheck.tar.gz
nano -w trunkcheck.sh
echo "5 * * * * root /root/trunkcheck.sh > /dev/null 2>&1" >> /etc/crontab
MP3 Playback of Voicemails with Optional Transcription. And we have a bonus application for you as well. By default, Asterisk voicemails that are delivered to your email address won’t play back on many computers and smartphones. This script fixes that while also providing the option to transcribe the first 15 seconds of the message into text. We’ve only tested this with PIAF-Green with Asterisk 11, but it also should work just fine with Incredible PBX 11 for the Raspberry Pi. To install it, log into your server as root and issue the following commands. If you want to activate the transcription feature, edit the downloaded script and change transcribe=0 to transcribe=1.
cd /root
wget http://pbxinaflash.com/installmp3stt.sh
chmod +x installmp3stt.sh
./installmp3stt.sh
Once you have run the installation script, you’ll need to make a couple of adjustments in the FreePBX GUI. Log into FreePBX 2.11 and choose Settings, Voicemail Admin, Settings and make the following changes:
format: wav|wav49
mailcmd: /usr/sbin/sendmailmp3
Now leave yourself a voicemail message after making certain that you’ve entered an email delivery address for the extension. Enjoy and Happy Fourth!
Deals of the Week. There are a couple of amazing deals still on the street, but you’d better hurry. First, for new customers, Sangoma is offering a board of your choice from a very impressive list at 75% off. For details, see this thread on the PIAF Forum. Second, a new company called Copy.com is offering 20GB of free cloud storage with no restrictions on file size uploads (which are all too common with other free offers). Copy.com has free sync apps for Windows, Macs, and Linux systems. To take advantage of the offer, just click on our referral link here. We get 5GB of extra storage, too, which will help avoid another PIAF Forum disaster.
Originally published: Wednesday, June 26, 2013

Need help with Asterisk? Visit the PBX in a Flash Forum.

Don’t miss the first-ever FreePBX World on August 27-28 at the Mandalay Bay in Las Vegas. For complete details, see this post on the FreePBX blog.

We are pleased to once again be able to offer Nerd Vittles’ readers a 20% discount on registration to attend this year’s 10th Anniversary AstriCon in Atlanta. And, if you hurry, you also can take advantage of the early bird registration discount. Here’s the Nerd Vittles Discount Code: AC13NERD.
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…
Here We Go Again: Getting Ready for the Next Google Voice Train Wreck
Self-inflicted wounds are nothing new in the technology business, but Google spent much of last week working hard to take top honors for what is clearly one of the most selfish and short-sighted moves ever in the telecommunications marketplace. Less than a week after extolling the values of open source technology during Google I/O 20131, Google wasted little time performing a complete 180 by deep sixing further support of the open source XMPP protocol for messaging and VoIP communications. With one brief announcement, Google basically killed off years of Google Voice development and announced the upcoming demise of Google Voice, XMPP, and Jabber messaging as we know it. Never mind that literally millions of users have come to rely upon Google Voice and XMPP messaging as their primary sources of communications. Google now has declared XMPP too confining for their view of what the telecommunications world really needs. Instead, we get yet another proprietary communications protocol. So much for the Do No Evil ethos. With classic pot calling the kettle black ire, one of Microsoft’s leading cheerleaders wasted little time condemning the move.
So why the sudden change of heart at Google? Well, it had nothing to do with the needs of Google customers obviously. In the old days, Google at least labeled projects as beta (for years) to warn you that something might happen down the road, good or bad. That era is over. Now the carnage happens almost randomly. Remember Google knols? It was perhaps the greatest collection of medical and technical literature of all time. Poof! All gone. We won’t go through the entire litany. Suffice it to say, this is nothing new for Google. Every company is entitled to its New Coke moment. Google has had more than its fair share, and it should serve as a wakeup call to organizations and individuals that reliance upon Google infrastructure is a really bad idea.
The current train wreck turns out to be yet another turf war motivated by retribution against Microsoft’s recent decision to support XMPP in its Outlook.com unified messaging product, something most companies would have greeted with jubilation. Instead, Google is miffed that Microsoft was now supporting its messaging protocol while continuing to keep its own protocol proprietary. That meant Microsoft cellphones could chat with Android phones but not the other way around. The moral of the story for consumers is pretty simple. Don’t for a minute assume that any technology company has your best interests at heart. None of them do. It’s all about money and industry domination. Google viewed this as a brazen attempt by Microsoft to create a messaging platform that could speak Android while continuing to restrict access to the Microsoft messaging installed base. And Google chose to pick up its marbles and go home rather than hand Microsoft easy access to hundreds of millions of Android cellphone users. So we’re back to handing the Bell Sisters the unified messaging monopoly with SMS and MMS as the lowest common denominator. Welcome to Big Business!
What does all of this have to do with Google Voice? Well, it rides along on the same messaging platform as Google Talk, Microsoft Lync, and XMPP/Jabber-based solutions including Asterisk, FreeSwitch, Yate, Cisco Jabber, Openfire, and Avaya in addition to all of the Google Voice-compatible softphones and OBiHai devices. So expect a train wreck!
We’re all about VoIP communications so we’ll leave the cellphone messaging for others to sort out. The important question for those of us that depend upon Google Voice for VoIP communications is what can you do to insulate yourself from the upcoming disaster. You can bury your head in the sand and pretend this isn’t going to happen, and you’d be dead wrong for the reasons we’ve outlined above. And, remember, Google has served clear notice that XMPP is over as far as they are concerned unless Microsoft, Apple, and now Facebook blink. Of course, Google could always redeploy SIP for Google Voice calling. If you think any of that is likely to happen, you also might want to buy a lottery ticket which affords you about the same chance of seeing any of your dreams come true.
To keep things simple, let’s divide VoIP communications into four categories: inbound calling, outbound calling, messaging, and faxing. We’ll leave video for another day only because it remains a niche product. With the demise of Google Voice, we recommend not putting all of your eggs in one basket (again). Inbound calling is the most critical. That’s your phone number, and it’s how folks get in touch with you. If there are numbers (DIDs) that you don’t want to lose, now is the time to move them away from Google Voice before it’s too late. If Google elects to shut down Google Voice, your ability to port your numbers elsewhere is OVER! So don’t procrastinate on this one. Luckily, Vitelity (one of the primary supporters of Nerd Vittles and the PBX in a Flash projects) has provided an incredible deal to our fan club for many, many years. For $3.95 a month you get a DID with unlimited inbound calls. It’s not free, but it’s not expensive either. And the call quality and service reliability are as good or better than anyone else in the business. You can read all about the offer at the end of this article. Google charges $3 to port your number out of Google Voice to a new provider. The step-by-step tutorial is available in the PIAF Forum. Do it while you still can!
For outbound calling (terminations), the thought process is different. Unlike traditional analog telephony, there is no reason not to have multiple providers especially if you’re using Asterisk, PBX in a Flash, or Incredible PBX as your communications server. If one outbound path fails, your server can automatically send the calls out through another call path. So continue to cling to your Google Voice dream for outbound calling if you’re a Believer. But do a little advance planning while there’s no crisis. There are numerous termination providers and generally you get what you’re willing to pay for. If cheap is your primary objective and call quality is secondary, then Anveo Direct and VoIP.ms can’t be beat. Both allow you to spoof your CallerID to match a DID that you own so they work well with a service such as Vitelity that is being used to handle your inbound calls. We’ve written about both of them, and we use both of them with excellent results. There are many, many others. Visit the PIAF Forum for lots of additional recommendations.
SMS messaging is an evolving technology in the VoIP marketplace. Expect to see some terrific new services before the summer is over. If you’re in a hurry, the easiest current solution to implement is through Anveo Direct. Our recent article will walk you through the setup process to send and receive SMS messages with Asterisk.
Faxing remains a crap shoot using VoIP technology. If you want commercial quality, then choose one of Vitelity’s dedicated fax circuits. If you want analog faxing that usually works, then Anveo Direct and VoIP.ms are about as good as you can do. All versions of Incredible PBX for PBX in a Flash include a free faxing solution using the HylaFax/ AvantFax platform. A similar solution is provided on the Raspberry Pi platform. As we said, it’s not perfect but it usually works.
Continue reading Part II: Google Puts the Final Nail in the Google Voice Coffin

Originally published: Monday, June 3, 2013

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 for all of us.
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…
- Larry Page reportedly commented as follows: "I’ve personally been quite sad at the industry’s behavior around all these things. If you take something as simple as IM, we’ve had an open offer to interoperate forever. Just this week Microsoft took advantage of that by interoperating with us but not doing the reverse. Which is really sad and not the way to make progress. You can’t have people milking off of just one company for their own benefit…" [↩]
The SIPaholic’s Dream Come True: Introducing Anveo Direct
We’re incredibly happy with the current list of providers that we recommend to PBX in a Flash™ users for VoIP trunking. At the top of our list is Vitelity, a leading VoIP provider that has been a major contributor to the Nerd Vittles and PBX in a Flash projects for many years. But, as often happens, one of our gurus on the PIAF Forum comes up with a terrific discovery that we just can’t wait to pass along. This week it was @w1ve who stumbled upon a new Anveo® Direct service for end-users with a special DID and SIP trunk offer. While the sub-account flexibility of Vitelity and some of the other providers is sorely missing, Anveo Direct does provide end-users with many of the same routing tools and SIP feature set that previously were reserved for use by major carriers. If you don’t believe some of the competition is less than thrilled, read this message thread on dslreports.com. And, until June 1, you can order DIDs in almost any U.S. region for 50¢ a month per DID with no setup fee. With Anveo Direct Value, that 50¢ buys you two trunks with 400 free incoming minutes a day. Outbound calls are pay-as-you-go and vary depending upon where you’re calling. Typical U.S. rates are $.001 to $.0055 per minute with least cost routing and automatic failover when a particular carrier’s route is having problems. As a point of reference, sending a one-page fax using Incredible Fax costs less than a penny and worked flawlessly using Anveo’s least costly routes.

DIDs also are available in more than 50 countries around the world, and all setup fees are waived until June 1. Most European DIDs are $1 or less per month. You’ll find the complete price list here. It’s worth mentioning that the 400 free incoming minutes a day applies collectively to all of your DIDs, not individually to each one. Additional incoming calls each day are billed at a penny a minute. The alternative is to purchase dedicated Anveo Direct trunks which provide unlimited inbound calling (one call at a time) for a monthly charge of $17 per trunk (worldwide), $11.25 per trunk (U.S. and Canada), or $6.50 per trunk (most of Europe). Monthly DID prices then are roughly 50% less.
Another nice surprise is that most of the DIDs include SMS messaging support. Incoming SMS messages are billed at a penny per message. Outbound SMS messages are routed through Europe and are billed at 4.4¢ per message. Unlike most providers, Anveo gives you the flexibility to configure your carriers and routes in almost any way you like. And there’s no proxy media so voice calls are passed directly from the carrier to your SIP endpoint. Anveo actually began as a wholesale provider of Voxbone services. With Anveo Direct, virtually all of the functions offered to commercial providers are now available to everybody. Along with fully redundant architecture and automatic SIP failover, Anveo offers you a choice of POPs in New York and Los Angeles as well as in Germany, Belgium, and China.

I know. I hear some of you saying, "Why would I want to pay good money for a DID when U.S. and Canadian calls plus the DIDs that Google Voice currently provides are all free?" Setting aside the ups and downs of Google Voice with Asterisk® over the years, it’s worth remembering that good things don’t last forever, and the word on the street is that Google’s generosity ship may be about to sail. In fact, it already has with worldwide iNum calls which Google originally handled for free. Now they’re 3¢ a minute even when calling across the street. Also keep in mind that, with VoIP, it costs you almost nothing to have a number of backup providers in place for that rainy day.
If you’ve used IPkall that provides free DIDs in the Seattle area with call routing to any SIP URI, then you will be generally familiar with the setup process for Anveo DIDs. There is no registration facility with Anveo Direct. Incoming calls to your DID are routed to SIP URIs of your choice. Outbound calls are sent to a SIP URI with a 6-character alphanumeric passcode of your choice. If this is all Greek to you, keep reading or stick with Vitelity.
Configuring a Destination SIP Trunk for Use with Anveo Direct
Before you can successfully configure a DID at Anveo Direct, you’ll first need to set up a SIP URI on your PIAF™ server. There are four initial steps: (1) enabling SIP URI access in your IPtables firewall, (2) mapping UDP 5060 to the IP address of your Asterisk server in your hardware-based firewall, (3) creating a SIP trunk for Anveo in FreePBX®, and (4) creating a custom context for incoming SIP URI calls from Anveo Direct.
Step #1: Just a couple of words of warning before we begin. You’ll need to open port 5060 on your hardware-based firewall and point it to your Asterisk server to use a SIP URI. Before you do that, make certain that you’ve installed Travelin’ Man 3 for PBX in a Flash which blocks inbound SIP connections except from trusted providers. Once Travelin’ Man 3 is installed, you’ll need to add Anveo Direct to your list of trusted providers for SIP connections (UDP 5060) with this command:
/root/add-ip anveo1 50.22.101.14
/root/add-ip anveo2 67.212.84.21
/root/add-ip anveo3 176.9.39.206
/root/add-ip anveo4 72.9.149.25
/root/add-ip anveo5 50.22.102.242
/root/add-ip anveo6 204.216.109.55
If you’re generally familiar with IPtables, you can add the following block of code directly:
-A INPUT -s 50.22.101.14/32 -p udp -m udp --dport 5060:5069 -j ACCEPT
-A INPUT -s 67.212.84.21/32 -p udp -m udp --dport 5060:5069 -j ACCEPT
-A INPUT -s 176.9.39.206/32 -p udp -m udp --dport 5060:5069 -j ACCEPT
-A INPUT -s 72.9.149.25/32 -p udp -m udp --dport 5060:5069 -j ACCEPT
-A INPUT -s 50.22.102.242/32 -p udp -m udp --dport 5060:5069 -j ACCEPT
-A INPUT -s 204.216.109.55/32 -p udp -m udp --dport 5060:5069 -j ACCEPT
Once you’ve completed this step, restart IPtables: service iptables restart. Then run: iptables -nL. Make certain that all of the above IP addresses are in the trusted providers list. Do NOT proceed until you’re sure your server is protected! It’s your phone bill.
Step #2: Now access your hardware-based firewall and map incoming UDP port 5060 traffic to the IP address of your PBX in a Flash server. The exact steps vary slightly depending upon the type of router you have. Look for a tab that deals with redirecting Internet traffic through your router to destination IP addresses.
Step #3: Using a web browser, open the FreePBX Administration GUI by pointing to the IP address of your server. In FreePBX 2.10 and 2.11, choose Connectivity -> Trunks -> Add SIP Trunk. Create an entry that looks like the following removing any other entries in the User Details section of the form. Then save your settings and update the dialplan. If you don’t have success with our settings, try the ones recommended by @w1ve.

Repeat this process by creating five additional SIP trunks named anveo-2, anveo-3, anveo-4, anveo-5, and anveo-6 using the other four IP addresses that Anveo uses to route SIP calls: 67.212.84.21, 176.9.39.206, 72.9.149.25, 50.22.102.242, and 204.216.109.55.
NOTE: If using a PJsip trunk, add these IP addresses in the trunk’s Match= field.
Step #4: Log into your server as root with SSH, and edit /etc/asterisk/extensions_custom.conf. Add the following code to the bottom of the file and save your changes. Then restart Asterisk: amportal restart.
[from-anveo]
exten => _.,1,Ringing
exten => _.,n,Goto(from-trunk,${SIP_HEADER(X-anveo-e164)},1)
Just a word of explanation about why we’re using a custom trunk context for Anveo rather than using the standard from-trunk entry. Because of its environment, Anveo doesn’t pass the DID of the trunk in the traditional way.1 Instead, it passes the DID in a customized SIP header as shown above. If you used from-trunk as the destination for the incoming calls, then FreePBX would process the call using the Default Inbound Route which most sane people map to Hangup or Congestion. By using the custom context above, we can grab the actual DID and use it for FreePBX routing purposes. For Anveo purposes, the actual SIP URI we’ll be using is serverDID@serverIPaddress where the 1904… number in the example is your actual DID which we’ll obtain in the next section. If you have a fully-qualified domain name for your server, you can use that after the @ symbol instead of your server’s public IP address.
Configuring a DID in Anveo Direct
Now that we have almost everything in place on your server, we’re ready to begin today’s adventure with Anveo. For openers, you’ll need to register for an account at Anveo Direct. It’s a simple process. Just click on the Get Started icon on the website and follow your nose. Once you’ve registered and confirmed your email address, login to your account and you’ll find a 60¢ credit for experimentation. Since you can purchase a DID for 50¢ and because it’s prorated to the 15th of this month, you’ll have plenty of money to test out the service without spending a dime.
There are three steps to complete on the Anveo site: (1) purchase a DID, (2) create a SIP URI which will be used to route the calls from a specific DID to your server, and (3) configure the DID to route calls using the SIP URI created in the previous step.
Step #1: If you haven’t already done so, log into your Anveo Direct account. Then purchase a DID in your favorite town. From the Inbound Service pulldown, choose Order Anveo Direct DID. Just fill in the blanks after choosing your desired DID.
Step #2: Choose Inbound Service -> Configure Destination SIP Trunks -> Add a New SIP Trunk. Fill in the blanks as shown below using the DID you created in step #1. Be sure to use the complete DID number. Either an IP address or FQDN is fine after the @ symbol. Then click SAVE.

If you read the "hint" in the form, you will note that you can replace the actual DID number (1904… in our example) with $[E164]$ to make the SIP URI generic. Then you don’t have to create separate SIP URI entries for every DID you purchase. We’re pleased to report that it works as advertised, and we’re using it in our sample trunk so you can try it for yourself.
NOTE: For those using some Incredible PBX builds in which PJsip is assigned port 5060 and chan_sip is assigned port 5061, you should make an adjustment in your incoming dial string: $[E164]$@serverIPaddress:5061.
Step 3: From the Inbound Service pulldown, choose Configure Anveo DIDs. Click on the EDIT tab beside the DID you wish to configure. You’ll get a form that looks like the following:

Choose the Call Options tab and select the SIP URI that you configured in Step #2. Click SAVE.
Choose the Geo. Pop tab and select the POP server closest to you. Click SAVE.
Choose the Codecs tab and select the codecs you wish to enable. We recommend using only G.711u until you’re sure everything is working correctly. Click SAVE.
Completing the FreePBX Setup for Anveo Direct
We’re almost finished. The last step is to create an Inbound Route in FreePBX for the DID you just purchased from Anveo Direct. So jump back over to FreePBX in your browser. Choose Connectivity -> Inbound Routes -> Add Incoming Route. Fill out the form using the complete DID Number, e.g. 1904… Choose a Destination for Incoming Calls that works on your server. It could be an extension, a ring group, an IVR, or any other resource that’s available. In our example, we’ve chosen the Weather Underground application from Incredible PBX. Save your settings and update the dialplan.

Now you’re ready to place your first call, or you can call the number shown above to try out our demo system using Anveo. Ignore the + symbol when dialing calls. It’s not necessary.
Making Outbound Calls with Anveo Direct
If you also want to use Anveo to place outbound calls, all of the rates are per minute. The rate tables can be downloaded from here. Before you can place outbound calls, you’ll need to create a Call Termination Trunk under Outbound Service. In the form, you set up a 6-character code for access to the SIP URI and also specify the IP addresses from which calls can be placed. A sample is shown below. You obviously need to create a VERY secure access code. The code must begin with a zero and may contain any number as well as A-Z and a-z for each character. Once you’re finished, SAVE your settings. This is the area where Anveo’s Least Cost Routing methodology really shines. If you’re cheap (like us), use the settings shown. If you prefer higher quality trunks, change the Carriers to All Carriers. It gets more complicated if you want it to, but these settings will get you started with incredible rates.

The final step is to define a Custom Trunk (AnveoOut) and Outbound Route (AnveoSIP) in FreePBX to send outbound calls to Anveo. Typically, you would specify a dialing prefix (555 in the example) to force certain calls to use the Anveo Direct route. Here’s a sample Custom SIP Trunk to handle the calls. The custom dial string should look like this using your own 6-character code, of course: SIP/012345$OUTNUM$@sbc.anveo.com.

Once you’ve saved your settings, create an Outbound Route for the calls that looks something like what’s shown below. Be sure to add the CallerID number you wish to use for the outbound calls and make the 555 prefix match what you used when you created the Custom Trunk in the last step. When you Save your setup, be sure to move the Outbound Route up the priority list on the right so that these calls get evaluated before your other calling routes.

Receiving SMS Messages with Anveo Direct
To receive SMS messages from Anveo, there’s an SMS tab in the DID configuration menu for each of your DIDs. You must have a web server with PHP 4 or 5 to manage the incoming messages. It’s important to use a file name for the web link that is difficult for people to guess. Otherwise, anybody can bombard you with SMS messages if they happen to guess the web link. Here’s a sample to get you started. In the Anveo SMS tab for your DID, you’d insert something like the following and check the Forward to URL box:
http://myserver.org/smsmessenger.php?from=$[from]$&to=$[to]$&message=$[message]$
On your web server using whatever filename you chose for the smsmessenger.php file, insert the following code replacing the $deliverto contents with your actual email address:
<?php
$deliverto = "youremailname@gmail.com";
$from = $_REQUEST['from'];
$to = $_REQUEST['to'];
$message = $_REQUEST['message'];
$subject="SMS Message from $from to $to";
$comment="SMS Message\n\n FROM: $from\n\nTO: $to\n\nMSG: $message\n\n";
mail("$deliverto", "$subject", "$comment", "$from");
?>
Once this is in place, people can simply send an SMS message to your 11-digit DID, and it will be delivered to the email address you inserted for $deliverto. Incoming SMS messages are a penny apiece.
Sending SMS Messages with Anveo Direct
Sending SMS messages through Anveo Direct is similar to the key procedure used for placing outbound calls. Before you can send SMS messages, however, you’ll need to activate an API account which is free. This gets you an API key. Once you have a key, SMS messages are sent using API requests to https://www.anveo.com/api/v2.asp. Sample PHP scripts to handle the details are available on the Anveo Direct web site. The procedure works well, but the messaging rates are not cheap at 4.4¢ per message. In addition, there appears to be a glitch in the "sent from" feature of the API which results in outbound SMS messages always appearing to come from an international number in the United Kingdom. But, again, the functionality is there, if you need it. For the time being, the SMS messaging functionality built into Incredible PBX is free and much easier to use. See the SMS Dictator article on Nerd Vittles for details. Enjoy!

Originally published: Monday, May 6, 2013

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.
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…
It’s Baaaaack: Skype Returns to PBX in a Flash with Asterisk 11 and FreeSwitch

It’s been a long road, but we finally have a reliable Skype™ implementation for Asterisk® 11. Ironically, it uses components from ArchLinux™ as well as FreeSwitch™. But, hey, it works! It sounds great. And it lets you talk (for free) to over a half billion of your closest friends around the world. So today we present a Skype solution that works with a full-featured PBX. It can run on any Windows®, Mac®, or Linux® Desktop using the PIAF-Green™ Virtual Machine with Oracle’s free VirtualBox®. There’s more good news. It’s a 5-minute install once you’ve downloaded the PIAF-Green appliance. And the appliance includes a one-click installer for a Skype gateway. All you’ll need is a dedicated Skype account with your username and password. Before you can finish your cup of coffee, you’ll be up and running. For those that prefer to do it yourself, there’s a complete tutorial on the PBX in a Flash™ Forum. Our special thanks to @sukasem for solving the riddle.

PIAF-Green Virtual Machine: How It Works
We’ve written extensively about Oracle® VM VirtualBox and the PIAF-Green Virtual Machine. If all of this is new to you, start here for some background. For today, we’ve built a custom PIAF-Green appliance that’s designed to handle inbound and outbound calling using a dedicated Skype account. You can interconnect this appliance with other Asterisk servers, or you can use it as a standalone Asterisk server by adding extensions, trunks, and features just as you would with any other PIAF-Green server. By default, inbound calls to the Skype account on your server are routed to extension 701. That can be adjusted to meet your requirements. 11-digit outbound calls (e.g. 1-843-284-6844) are routed out through your Skype trunk which means you’ll need Skype Credit or a Skype Subscription to complete the calls. You can modify the outbound route SkypeOut to accommodate international calling, 10-digit calling, and free Skype-to-Skype calling worldwide if desired. We’ll cover the setup below. But, first, let’s get your PIAF-Green Virtual Machine up and running with FreeSwitch and Skype.
Installing the PIAF-Green Virtual Machine
Step #1 is to download the PIAF-Ast11-FS-Skype Open Virtualization Appliance (.ova) from SourceForge. This appliance includes a customized version of PIAF-Green with Asterisk 11 and FreePBX 2.11 as well as FreeSwitch and a Skype installer. Because Skype is proprietary, we cannot include it in the turnkey appliance, but the one-click installer will do all of the heavy lifting for you.
Step #2: Verify the checksums for the PIAF-Green 64-bit .ova appliance to be sure everything got downloaded properly. To check the MD5/SHA1 checksums in Windows, download and run Microsoft’s File Checksum Integrity Verifier.
For Mac or Linux desktops, open a Terminal window, change to the directory in which you downloaded the .ova file, and type the following commands:
md5 PIAF-Ast11-FS-Skype.ova (use md5sum for Linux)
openssl sha1 PIAF-Ast11-FS-Skype.ova
The correct MD5 checksum for the latest appliance release is 93b016298c18455184cfd596774c05ba. The correct SHA1 checksum for the latest release is 09b24ad03a99ecc4eeef58a5d123c3c03096a2e0.
The correct MD5 checksum for the original appliance was bfa436f4f4a1cf2dd5ac92c3fbb7c65f. The correct SHA1 checksum for the original appliance was 95228d4c2ed533092899da88721dbde8d20d8b73.
Step #3: Double-click on the downloaded .ova file which will begin the import process into VirtualBox. It only takes a couple minutes, and you only do it once. IMPORTANT: Be sure to check the Reinitialize the Mac address of all network cards box before clicking the Import button.
Once the import is finished, you’ll see the new PIAF virtual machine in the VM List of your VirtualBox Manager Window. You’ll need to make a single, one-time adjustment to the PIAF-Green Virtual Machine configuration to account for differences in network cards on different host machines.
Click on the PIAF-Ast11-FS-Skype Virtual Machine in the VM List. Then click Settings -> Network. For Adapter 1, check the Enable Network Adapter option. From the Attached to pull-down menu, choose Bridged Adapter. Then select your network card from the Name list. Then click OK. That’s all the configuration that is ever necessary for your appliance. The rest is automagic.
Running the PIAF-Green Virtual Machine in VirtualBox
Once you’ve imported and configured the appliance, you’re ready to go. Highlight the Virtual Machine in the VM List on the VirtualBox Manager Window and click the Start button. The PIAF boot procedure with CentOS 6.4 will begin just as if you had installed PBX in a Flash on a standalone machine. You’ll see a couple of dialogue boxes pop up that explain the keystrokes to move back and forth between your host operating system desktop and your PIAF VM.

Here’s what you need to know. To work in the PIAF Virtual Machine, just left-click your mouse while it is positioned inside the VM window. To return to your host operating system desktop, press the right Option key on Windows machines or the left Command key on any Mac. For other operating systems, read the dialogue boxes for instructions on moving around. Always shut down PIAF gracefully! Click in the VM window with your mouse, log in as root, and type: shutdown -h now.
Run PIAF-Green Virtual Machine behind a hardware-based firewall with no Internet port exposure!
To begin, position your mouse over the VM window and left-click. Once the PIAF VM has booted, log in as root with password as the password. Change your root password immediately by typing passwd at the command prompt. Now set up a secure maint password for FreePBX as well. Type passwd-master. If you’re not in the Eastern U.S. time zone, then you’ll want to adjust your timezone setting so that reminders and other time-sensitive events happen at the correct time. While logged into your server as root, issue the following command: /root/timezone-setup.
To access the FreePBX GUI, use a browser to log into your PIAF server by pointing to the IP address of the PIAF VM that’s displayed in the status window of the CLI. Click on the User button to display the Admin choices in the main PIAF Menu. Click on the FreePBX option to load the FreePBX GUI. You will be prompted for an Apache username and password. For the username, use maint. For the password, use whatever password you set up with passwd-master.
PIAF-Green Virtual Machine: Installing Skype with the One-Click Installer
Now the fun. First, be sure you’ve set up a Skype account that can be dedicated for exclusive use with PIAF-Green. Once you have your Skype username and password in hand, you’re ready to begin. While logged into your server as root, issue the following command: /root/skype-install.
Accept the license agreement and then you’ll be prompted for your Skype username (one word!) and password. Type carefully. Once you’ve checked your entries, press the Enter key to begin the install. Skype will be downloaded and installed after which FreeSwitch will be configured for use with PIAF-Green. The whole process takes about a minute.
PIAF-Green Virtual Machine: Taking Skype for a Test Drive
The easiest way to make sure everything is working is to assemble all of the needed components on your Windows or Mac desktop and then walk through an inbound and outbound call using Skype.
First, let’s get Skype and FreeSwitch running under PIAF-Green. From the command prompt, issue the following commands:
pkill skype
pkill Xvfb
sh /usr/local/freeswitch/skypopen/skype-clients-startup-dir/start_skype_clients.sh
/usr/local/freeswitch/bin/freeswitch
Second, switch back to your desktop PC or Mac and install the Skype client for your operating system. Make sure that you have a different Skype account that can be used for this testing. Once installed, run Skype on your desktop and log in with your different Skype credentials.
Third, while still on your desktop PC or Mac, download and install the Yate SIP softphone. Run the Yate client and choose Settings -> Accounts -> New. Plug in the IP address of your PIAF-Green Virtual Machine (type status in the Linux CLI if you don’t know it). For the extension, use 701. For the password use 1234secret. Make sure the client shows it registered. If not, check your IP address, extension, and password for typos.

Now let’s try a call to your PIAF-Green Virtual Machine using the Skype client on your desktop computer. Plug in the Skype name that you assigned to the virtual machine and click the dial button. Within a couple seconds, your Yate SIP softphone should start ringing. Click Answer on the phone and say a few words. Yes, there will be echo. You’re using both phones on the same desktop. Click Hangup. If you run the Asterisk CLI in the appliance window of VirtualBox, you can watch the entire process unfold with realtime alerts from both Asterisk and FreeSwitch.
As configured, you can use your Yate softphone to make outbound PSTN calls through Skype on the PIAF-Green Virtual Machine, but this requires you to have money in your Skype Credit account. If you have a positive balance, simply dial an 11-digit number, e.g. 1-843-284-6844. If you only want to make free calls to other people using Skype anywhere in the world, then you need to adjust your FreePBX dialplan slightly. Log into FreePBX as explained above and then make the following change to SkypeOut which is accessible by going to Connectivity -> Outbound Routes -> SkypeOut:

In the original version of the appliance, to place PSTN calls by dialing 10-digit numbers and to place calls to other Skype users by dialing *SkypeName from a SIP softphone, you needed to adjust the Dial Patterns for SkypeOut so that they looked like what is shown above. Then clicking Submit Changes and Apply Changes implemented the changes. With the current release, these features already are included.
PIAF-Green Virtual Machine: Auto-Starting Skype and FreeSwitch on Bootup
Once you’re sure everything is working as it should, you’ll find it more convenient to automatically start Skype and FreeSwitch whenever you boot up your PIAF-Green Virtual Machine. Just issue the following commands while logged into your server as root and then reboot to try it out:
echo "sh /usr/local/freeswitch/skypopen/skype-clients-startup-dir/start_skype_clients.sh" \
>> /etc/rc.d/rc.local
echo "ulimit -s 240" >> /etc/rc.d/rc.local
echo "/usr/local/freeswitch/bin/freeswitch &" >> /etc/rc.d/rc.local
reboot
PIAF-Green Virtual Machine: Skype Tips and Tricks
We’ve designed the one-click Skype installer so that you can rerun it at a later date if it becomes necessary to change your Skype credentials.
As a cautionary note, be advised that you cannot load Incredible PBX on this build without wiping out the Skype and FreeSwitch functionality, but we’re working on it.
One of the wrinkles with Skype is that Skype uses names for its users rather than numbers. If you don’t have a SIP URI-capable softphone, there’s still an easy way to place calls to your Skype friends using FreePBX. The solution is to set up speed dial numbers for your Skype friends by adding a Speed Dial number to your FreePBX dialplan. Let’s set one up for Skype’s Call Testing Service to show how it’s done. Choose Applications -> Extensions -> Other (Custom) Device in FreePBX. Provide an Extension Number (8378 spells T-E-S-T) which will be the Speed Dial number. This could just as easily spell your friend’s name using a TouchTone phone. Next enter a Display Name for the extension, e.g. Test Skype. Then insert the following in the dial field. If you were setting up a custom extension for a friend, just replace echo123 with your friend’s actual Skype name using the syntax below. Save your entries and reload the dialplan when prompted.
SIP/echo123@127.0.0.1:5070
Now you can dial 8378 using your Yate softphone or any extension on your PBX to connect to the Skype Call Testing Service. Enjoy!

Originally published: Friday, April 26, 2013

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.
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…