Introducing Lenny

· 4 mins read · Tech

Over the past few years I’ve had a few assorted fun telephone numbers featuring everything from a Rick Astley line that plays Never Gonna Give You Up to my suite of Australian test phone numbers. Most of them have been kept private, but a few of them have been made public.

By far the most popular number has been Lenny — a voice activated ‘bot’ that is designed to keep telemarketers on the line. Lenny rambles on about his daughter Larissa, other members of his family, his home, finances, and basically anything to cause the telemarketer to repeat themselves and stay on the line as long as possible.

Reaching Lenny

Lenny is the sort that is always sitting by the phone waiting for your call. Lenny may be reached 24x7 by dialing:

  • 02 9192 0967 within Australia
  • 09 887 0377 within New Zealand
  • +61 2 9192 0967 from international ;or
  • sip:0291920967@pbx.shaun.net from a SIP device.

If you want to setup your own, read on!

Implementation

This instance of Lenny runs on my own FreePBX instance and was incredibly easy to setup. If you want to implement your own on FreePBX, this is what you do:

Implementation on native Asterisk is similar however you will need to configure items such as your call routes manually.

Step 1 — Install the sound files

Lenny uses a series of sound files that contains the speech, background noise, etc.

You can download these and then extract the archive to /var/lib/asterisk/sounds/Lenny. Make sure permissions on the directory and the actual sound files grant your Asterisk server read permission.

Step 2 — Setup the extension context

As I’m using FreePBX, I added the following code to /etc/asterisk/extensions_custom.conf:

[Lenny]
exten => talk,1,Set(i=${IF($["0${i}"="016"]?7:$[0${i}+1])})
same => n,Playback(Lenny/Lenny${i})
same => n,BackgroundDetect(Lenny/backgroundnoise,1500)

This code plays back the audio files starting from Lenny1.ulaw when it detects speech from the remote party.

Step 3 — Setup the custom destination

I use the Custom Destinations Module for FreePBX as it allows me to add code (such as the Lenny code above) in my extensions file and send calls directly to the context as part of my call flows, eg:

Custom Destination

If you have used the context suggested in the code snippet above “Lenny” then your custom destination should go to Lenny,talk,1.

Step 4 — Setup the extension

This step is optional but it will allow you to create an internal extension that you can dial internally or even transfer calls to.

First you need to create a new extension using “Other (virtual exten)” as the device type:

Add Extension

Don’t enable any extra services like User Manager or Voicemail as you don’t need them.

Once done you then configure the destinations to route to your custom destination:

Configure Extension

Step 4 — Setup the inbound call route

To route calls to Lenny you will need to setup an incoming call route. Your extension should be the extension you have just created:

Inbound Call Route

Step 5 — Recording the calls

If you want to record the calls, you can do it two ways:

  1. By setting your inbound call route to record calls. This has an added benefit as call recordings may be viewed from within your CDR reports,eg:
    Call Recording
  2. By adding a record function to the Lenny context, eg:
     [Lenny]
     exten => talk,1,Set(i=${IF($["0${i}"="016"]?7:$[0${i}+1])})
     same => n,ExecIf($[${i}=1]?MixMonitor(${UNIQUEID}.wav))
     same => n,Playback(Lenny/Lenny${i})
     same => n,BackgroundDetect(Lenny/backgroundnoise,1500)
    

Legislation regarding recording calls differs between countries. Make sure you are compliant before doing this.

Step 6 — You’re done

Apply your configuration and try calling Lenny.

Recording and Privacy Notice

Due to legal limitations with the Australian Telecommunications (Interception and Access) Act, calls to Lenny are not monitored or recorded. All calls are logged into a database, but this is only because all calls in and out of the system are logged. The call logs may be used to generate aggregated statistics and monitor for abuse but will not be used for any other purpose.

If you wish to record your own calls to Lenny then you may do so subject to any local laws in your jurisdiction.