Asterisk Ramblings

2 March 2024 – Instructions on how to get good stereo recordings

Visit the code repo here:

Setup your asterisk/freePBX to run a “Post call recording processing script”, clone the repo and copy the bash script (.sh) into ‘/var/asterisk/’, set the file as executable (chmod +x, and point freePBX/Asterisk at the script.

Now, when calls are made on your PBX, you will get four files per call – “out_”, “trans_out”, “recv_out”, and “stereo_out_”. This makes it easier to post-process and edit the calls to fix bad audio.

In addition to this, I utilize some python scripts to pre-process calls for later editing. I’ve found that the current outputs are usually about 6db lower than needed in a final mix, but this gives you headroom in editing, which can be beneficial to avoid all sorts of distortion that may come from very noisy lines.

Voicemail prompt bots –

For over six years, developing Asterisk voicemail prompts, especially those designed to mislead scammers, has become an engaging hobby. This interest was sparked by the “It’s Lenny” bot, featuring an old Australian man. Inspired by this, we created “MiriamBot,” a similar concept adjusted over two years to suit Miriam’s unique personality, diverging slightly from Lenny’s original script. This page aims to provide tips on enhancing voicemail bots for more intriguing callback experiences.

Bots for Download:

Angry Hillbilly Bot –

Angry Man Bot –

confused Old Lady Bot –

Voicemail Tweaks

Typically, if you follow the age-old “It’s Lenny” installation instructions, you’ll start by creating a custom extension within the extensions_custom.conf file – Something like the below might look somewhat similar to what you have for ItsLenny.

exten => talk,1,Set(i=${IF($[“0${i}”=”23”]?7:$[0${i}+1])})
same => n,ExecIf($[${i}=1]?MixMonitor(${UNIQUEID}${CALLERID(num)}.wav,r(${UNIQUEID}${CALLERID(num)}oldManXmas_in.wav)t(${UNIQUEID}${CALLERID(num)}_oldManXmas_out.wav)))
same => n,Playback(oldManXmas/${i})
same => n,BackgroundDetect(JobAppBot/backgroundnoise,500)

a custom extension with some useful options for file-naming

In the above example, the first line, ‘[oldManXmas]’ is the name of the Custom Destination that you need to create within your FreePBX install, under the Admin menu. In there, you’ll need to set a few things, mainly to direct the asterisk software to connect the Custom Destination to the voicemail bot, with instructions to have the bot answer, talk, wait 1 second, and then continue.

The MixMonitor section is the major bit of change in this example versus the “It’s Lenny” 4-liner that’s floating around.

This line includes options to split the voicemail audio into 2 legs, so you get an ‘in’ and ‘out’ audio file, as well as the original mono call, and the 2 legs are labeled with the name of the bot, so that it’s easier to tell which bot got the call. This is useful for instant-replay situations and to help organize hilarious results more quickly. It’s also incredibly useful for creating new bots.

You can look at the example above as a sort of scripted sequence that gets initiated by the Custom Destination – which needs to have something like the below set up to work at all:


Custom Destination name needs to be set to <botName>,talk,1 in order to execute the custom extension’s scripted sequence

Typically, this is all you need to have a bot waiting for incoming connections, however you may wish to send people to extensions, so typically, a new extension with no new user is created, and pointed to the Custom Destination created above. This can be useful if you wish to ‘pull in’ a bot during a phone call, by simply dialing an extension on your phone system.

NOTE: Upon further testing, you really want to create a virtual extension for your custom destinations, so that they can ‘return’ to the beginning appropriately. Don’t follow my advice above if you want it to loop back or be sent to another ‘destination’ (read: virtual extension that points TO the custom destination itself. If you don’t implement the virtual extension, you will not get all the benefits that the voicemail prompt bots offer.

It’s a good idea to alert people that they are on a recorded line. You can set this up via many different methods built-in to FreePBX/IncrediblePBX, with either an interactive menu or scripted sequence. There’s too many methods to list here.

Now What?

Now you’ve got voicemails in mono, as well as ‘in’ and ‘out’ files, labelled with the UniqueID, CallerID, and botName in the filename. You can take the In and Out labelled files and put them in an audio editor, assign them left and right speaker positions, or mix them mono with volume-correction on crummy incoming phone lines.

This is how each episode of the show is mixed, so why not voicemails too? No longer do quiet phone lines need to be penalized when they call the voicemail prompt bots – now you can raise their volume, and offer isolated audio for soundbites to use in later calls or hand it out for artists to use.

The goal here is to make fun ‘found audio’ more accessible. We like to get reactions, and capture that lightning in a bottle, for later use!

Take from this what you will, it’s written for educational purposes only. Check out the bots provided for download above, free of charge for anyone to use. They may work as good or better than the old Lenny bot – your mileage may vary.