Ever heard of Lenny? Considering you are reading this, chances are yes. AETB is built on top of the original Lenny code with extendibility in mind. Additionally, AETB has 2 modes:
Unmanned talk bots work the same as standard Lenny. They listen for noise followed by 1.5 seconds of silence then play the next audio. This mode is intended for inbound calls.
Manned talk bots are intended to be conferenced with other calls using a softphone like PhonerLite. They work just like unmanned talk bots but provide the following control:
- 1.5 seconds after the bot has picked up you may enter the recording number to start with on your keypad.
- When the bot is listening you may press
#
to advance or*
to pause.
In this guide we add manned Lenny. Before you start, download and extract this repo.
- FTP into your PBX.
- Under
/var/lib/asterisk/sounds/
create a folder namedtalk-bot
. - Copy the files from
audio
into thetalk-bot
folder. - Go to Admin > Config Edit, then copy the contents of
main.conf
intoextensions_custom.conf
. Remember to save.
- Create a custom destination with the target set to
talk-bot-manned,lenny,1
- Create a virtual extension.
- Under Advanced > Optional Destinations set Not Reachable to the custom destination you created.
- Save & Apply Config. Then give the extension a call.
- FTP into your PBX.
- Under
/var/lib/asterisk/sounds/
create a folder namedtalk-bot
. - Copy the files from
audio
into thetalk-bot
folder. - Copy the contents of
main.conf
into/etc/asterisk/vitalpbx/extensions__90-talk-bot.conf
. - Create a Custom Context with the destination set to hangup.
- Create a Custom Application with the destination set to your Custom Context.
- Update & Apply Config. Then give the application a call.
- See Editing Tips, then using ocenaudio or Audacity edit your recording(s) to wav or mp3 clips.
- In order number each clip from 1 to however many clips you have.
- Run the audio conversion script to convert the files to a suitable format.
- In the talk bot audio folder, create a new folder named after your talk bot.
- Copy the converted audio into the newly created folder.
- Refer to the following on how to add your talk bot to the dialplan:
In this example a new talk bot is added whose name is Johny. It consists of 20 audio files (Arg 2) contained in the johny
folder (Arg 1). The loop starts on audio file 5 (Arg 3). For consistency the extension is named the same as Arg 1.
; main.conf
[talk-bot-manned]
exten => lenny,1,Gosub(talk-bot-core,init,manned(lenny,16,7))
exten => johny,1,Gosub(talk-bot-core,init,manned(johny,20,5)) ; new
[talk-bot-unmanned]
exten => lenny,1,Gosub(talk-bot-core,init,unmanned(lenny,16,7))
exten => johny,1,Gosub(talk-bot-core,init,unmanned(johny,20,5)) ; new
; ^ ^ ^ ^
; Extension | | Arg 3
; | Arg 2
; ... Arg 1
Extension | Same as Arg 1. |
Arg 1 | Name of folder containing audio files. |
Arg 2 | Number of audio files. |
Arg 3 | On what number file should the loop begin. |
- At a minimum you should have around 15+ audio clips per talk bot.
- Clips should be a sentence or two. Avoid using single word clips, especially in succession to each other.
- Clips should be ambiguous and engaging. Questions should be open-ended and accusations broad.
This script will convert mp3 and wav files to raw audio files suitable for Asterisk (8kHz mono G.711u).
- Make sure FFmpeg is installed.
- In your terminal, navigate to the directory containing the audio files to be converted.
- Paste the appropriate script into your terminal.
output="converted"
mkdir -p $output
for file in *.mp3 *.wav; do
name="$output/${file%.${file##*.}}.ulaw"
ffmpeg -i "$file" -ar 8000 -ac 1 -acodec pcm_mulaw -f mulaw "$name";
done
$output = "converted"
New-Item -Path $output -ItemType Directory -Force
Get-ChildItem | where {$_.extension -in ".mp3",".wav"} | ForEach-Object {
$name = "$output/$($_.BaseName).ulaw"
& ffmpeg -i $_.Name -ar 8000 -ac 1 -acodec pcm_mulaw -f mulaw $name
}