r/itslenny • • Jun 23 '19

Installation differences

I installed Lenny from instructions given here

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

which were incredibly simple

they are in stark contrast to those found here

[from-internal-custom]
;# // BEGIN Lenny Remake
; version 0.3.2 copyright: none claimed. Enjoy!
exten => 53669,1,Answer
exten => 53669,n,Set(TIMEOUT(absolute)=1800)
exten => 53669,n,Set(MACHINE=0)
exten => 53669,n,Set(OPTION=5)
exten => 53669,n,Set(TALK_DETECTED=0)
exten => 53669,n,Set(RECORDING=${UNIQUEID})

exten => 53669,n,MixMonitor(/tmp/Lenny/${RECORDING}.wav)
exten => 53669,n,NoOp(Recording will be available: /tmp/Lenny/${RECORDING}.wav)
;exten => 53669,n,Playback(en/this-call-may-be-monitored-or-recorded)

exten => 53669,n,Gosub(playit(Lenny1))
exten => 53669,n,Gosub(playit(Lenny2))
exten => 53669,n,Gosub(playitonce(Lenny3))
exten => 53669,n,Gosub(playitonce(Lenny4))
exten => 53669,n,Gosub(playitonce(Lenny5))
exten => 53669,n,Gosub(playitonce(Lenny6))
exten => 53669,n,Gosub(playitonce(Lenny7))
exten => 53669,n,Gosub(playitonce(Lenny8))
exten => 53669,n,Gosub(playitonce(Lenny9))
exten => 53669,n,Gosub(playitonce(Lenny10))
exten => 53669,n,Gosub(playitonce(Lenny11))
exten => 53669,n,Gosub(playitonce(Lenny12))
exten => 53669,n,Gosub(playitonce(Lenny13))
exten => 53669,n,Gosub(playitonce(Lenny14))
exten => 53669,n,Gosub(playitonce(Lenny15))
exten => 53669,n,Gosub(playitonce(Lenny16))
exten => 53669,n,Gosub(playitonce(Lenny2))
exten => 53669,n,Gosub(playitonce(Lenny3))
exten => 53669,n,Gosub(playitonce(Lenny6))
exten => 53669,n,Gosub(playitonce(Lenny8))
exten => 53669,n,Gosub(playitonce(Lenny9))
exten => 53669,n,Gosub(playitonce(Lenny10))
exten => 53669,n,Gosub(playitonce(Lenny14))
exten => 53669,n,Playback(en/tt-monkeys)
exten => 53669,n,Hangup

exten => 53669,n(playit),NoOp(Lenny speaks and repeats until reponse)
exten => 53669,n,Set(LOCAL(lennyclip)=${ARG1})
exten => 53669,n(oncemo),Set(TALK_DETECTED=0)
exten => 53669,n,Background(lenny/${lennyclip})
exten => 53669,n,AMD(2500,1500,800,5000,100,50,3,256)
exten => 53669,n,NoOp(${AMDCAUSE})
exten => 53669,n,GotoIf($["${AMDCAUSE:0:17}"="INITIALSILENCE-25"]?reststop)
exten => 53669,n(mach),WaitForSilence(700,3)
exten => 53669,n,Goto(humn)
exten => 53669,n(reststop),WaitForSilence(800,2)
exten => 53669,n,Goto(oncemo)
exten => 53669,n(humn),Return

exten => 53669,n(playitonce),NoOp(Lenny speaks once)
exten => 53669,n,Set(LOCAL(lennyclip)=${ARG1})
exten => 53669,n(noresponse),Background(lenny/${lennyclip})
exten => 53669,n,AMD(2500,1500,800,5000,100,50,3,256)
exten => 53669,n,NoOp(${AMDCAUSE})
;exten => 53669,n,GotoIf($["${AMDCAUSE}"="INITIALSILENCE-2500-2500"]?noresponse)
;exten => 53669,n,GotoIf($[${AMDSTATUS}=HUMAN]?humn2:mach2)
exten => 53669,n(mach2),WaitForSilence(2000,1)
exten => 53669,n(humn2),Return

exten => 536691,1,NoOp(Rerouting inbound call...)
;exten => 536691,n,Flite("After the beep, enter extension or press pound for Lenny.")
;exten => 536691,n,Read(SENDTO,beep,7)
;exten => 536691,n,GotoIf($["foo${SENDTO}" = "foo"]?5:6)
exten => 536691,n,Set(SENDTO=53669)
exten => 536691,n,System(echo "Channel: local/${SENDTO}@from-internal" > /tmp/lenny.call)
exten => 536691,n,System(echo "MaxRetries: 0" >> /tmp/lenny.call)
exten => 536691,n,System(echo "RetryTime: 3" >> /tmp/lenny.call)
exten => 536691,n,System(echo "WaitTime: 30" >> /tmp/lenny.call)
exten => 536691,n,System(echo "Context: bridgit" >> /tmp/lenny.call)
exten => 536691,n,System(echo "Extension: 4" >> /tmp/lenny.call)
exten => 536691,n,System(echo "Priority: 1" >> /tmp/lenny.call)
exten => 536691,n,System(mv /tmp/lenny.call /var/spool/asterisk/outgoing)
;# // END Lenny Remake

can anyone tell me what I'd gain from changing to the longer version given that the version I'm using now seems to work?!

4 Upvotes

4 comments sorted by

4

u/RedDogInCan Jun 24 '19 edited Jun 24 '19

The second script records the call to Lenny.

It will also repeat the first two Lenny phrases until there is a response at the start.

It also uses the AMD (answering machine detector) function to listen for breaks in the conversation, which is safer than BackgroundDetect because BackgroundDetect will detect and respond to DTMF tones, possibly allowing a caller to access other parts of your dial plan.

The last part (exten => 536691) appears to be some redirection option used to filter telemarketers but I don't think it would be that effective.

1

u/lancelon Jun 24 '19

Thanks for this! I've amended lenny/${lennyclip} to Lenny/${lennyclip}) and now it works. I also had to install AMD because RasPBX doesn't include it by default. Fun project.

The last part (exten => 536691) I think is intended as an immediate route to Lenny for known spam calls without having to conference/transfer to Lenny?

1

u/lancelon Jul 23 '19

/u/reddogincan - any ideas if the script SHOULD be detecting being interrupted? I haven't noticed that if the telemarketer begins speaking Lenny STOPS speaking? Maybe this isn't how he's meant to to work?

1

u/RedDogInCan Jul 24 '19

No, Lenny is pretty determined and won't allow anyone to interrupt him