Home » Technology » MP3 Devices » 2013 Greatest Hits: Lenny Returns for an Encore Performance

The Most Versatile VoIP Provider: FREE PORTING

2013 Greatest Hits: Lenny Returns for an Encore Performance

blank

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:

[ca_audio url_mp3="http://www.itslenny.com/recording.php?file=4d8cde0cc5a4d86ccf221aa5b2903e95″ url_ogg="audiofile.ogg" width="400″ height="50″ css_class="codeart-google-mp3-player" autoplay="false" download="true" html5="true" skin="small" align="none"]

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:

blank

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:

blank

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


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


 

blank

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.


 

blank

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.

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

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

blankVitalPBX 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!
 

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


2 Comments

  1. If anybody’s wondering, this works great on Incredible Pi. When I first installed it, my CPU usage pegged (stayed between 95 and 100%). Not sure that was related, but a system reboot brought loading to normal (0 to 2%). Raspberry PI, no overclock, Sandisk Ultra class 6 SD.
    I’ve got Lenny somewhat busy: put him on all calls from an inbound GV trunk, sent an email to friends telling them about Lenny and asking them to call – which they’ve been doing. Meanwhile PBX operation unaffected. I figure if it works on a Pi, it’ll work on any platform.
    Thanks Ward!

Comments are closed.