Understanding Lenny files

Lenny as we all know and dearly love, repeats himself,… except Lenny1
So how do I introduce a Lenny0, along with Lenny 1 that wont get repeated?

I don’t understand the
,Set(i=${IF($[“0${i}”=“016”]?7:$[0${i}+1])})

Which no doubt is where it all happens, nor can I find any “good” references as to exactly what each of this is doing.

Any pointers?

(basically i have a ulaw file Lenny0 which has some local phone rings, and a couple of touch tone buttons pressed, that I want to insert before Lenny dopes all his magic, all other attempts like using an earlier Playback() fail dismally, thats if it doesnt get ignored or creash poor 'ol len altogether :slight_smile:

To say out loud what everyone else probably thought: WTH?

The regular expression is pretty straightforward (he says, lying through his teeth) but it sounds like you want concatenate a couple of WAV files, which is pretty simple is any free wave file editor.

Set(i=${IF($[“0${i}”=“016”]?7:$[0${i}+1])})

Lennie has 16 .wav files numbered 01 through 16, every time you iterate, you wait for audio and then increment i to then play the next audio file in sequence after waiting for audio, if the far end says anything it continues to the next iteration (talk) if not the channel is hungup. when you hit the limit at 16 you reset i to 7.

Listen to the files individually and you will see the beauty of lenny’s human engineering, the first 7 get attention the next 9 are random enough so the far end doesn’t get the repeat. When you hear the ducks twice, you will understand :wink:

You could insert your own exten => 1, . . . . . at the front end of

[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)

But you would need to change lenny’s 1 to n to accomodate

1 Like

@cynjut yeah :slight_smile:
Ohh I did solve my problem a week ago using audacity and sox, was just hoping that there was a cleaner way

edited: ruddy typos

thanks dicko, thats starting to make sense now

1 Like

If you care to , please spend a few hours with

http://asterisk-service.com/downloads/Asterisk-%20The%20Definitive%20Guide,%204th%20Edition.pdf

You will be amazed by how much 845 pages will help you get to be an Asterisk cognoscenti :wink:

:slight_smile: Thanks, looks like an interesting read for the holidays

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.