Hi, I’m trying to understand how the lenny script works.
I understand it works because the files are named Lenny1-16 and the script iterates by changing
[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)
The first line:
exten => talk,1,Set(i=${IF($["0${i}"="016"]?7:$[0${i}+1])})
exten gets the current context, not sure what does => but it seems to be default syntax.
I can’t find anything about what talk is, I found TALK_DETECT in the manual but I don’t think that’s what it is.
Set(i=${IF($["0${i}"="016"]?7:$[0${i}+1])})
This is setting the value of i but I have no idea whats happening here, looks like regex.
I also can’t find what the $ does anywhere (google is no help)
Line 2:
same => n,ExecIf($[${i}=1]?MixMonitor(${UNIQUEID}.wav))
I think this line is making sure Lenny1 is not played again and somehow mixing lenny clips to create new sounds?
n represents numbers 2-9 and ExecIf executes an Asterisk application under specific conditions. This is getting a little clearer.
MixMonitor records a call and mix the audio during the recording. UNIQUEID is as the name says. I’m guessing this somehow records clips of lenny as it plays and mixes them together and gives them a unique numbers?
The third line:
same => n,Playback(Lenny/Lenny${i})
This clearly plays the sound file Lennyi were i = current iteration
I don’t understand why n is there.
The forth line:
same => n,BackgroundDetect(Lenny/backgroundnoise,1500)
This is listening for sound to start and end before playing another lenny clip.
If anyone could explain the first 2 lines of the script I would really appreciate it, as you can see I’m very lost.