PIONEERS Lenny Is Back!

Discussion in 'PIAF 3 Add-Ons' started by wardmundy, Aug 9, 2013.

  1. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
    [​IMG]

    Great news. For those of you that have been missing Lenny, we're delighted to report that Brian West, the author of the site, has given us permission to pass along the Lenny sound recordings. He is actively working to find a better home for It's Lenny in the not too distant future as well. If this is all Greek to you, visit Reddit for some quick entertainment.

    FREE DEMO: If you'd like to "try before you buy" (joke! ), we've put up a system to let you take Lenny for a spin. Here's the IPkall number: 1-206-424-6913. For purists, here is a SIP URI courtesy of our RentPBX sponsors and SIP2SIP:[email protected].

    While you're waiting on ItsLenny.com to return, here's an easy way to roll your own. Someone on another forum posted some of the sound recordings and we've added a script to go along with them so that you can host this on your own PIAF server.

    LEGALESE: Recording other people without their knowledge or permission is a slippery slope. For those in the U.S., it is legal in some states and not in others. Some require only the callee's permission while others require permission from the callee and caller. You're NOT the problem. The problem is the caller. The important point to remember is the situs of the caller determines the state law that prevails (in the U.S. only). We have no idea what the rules are elsewhere so consult your attorney, or don't record or, at the very least, give callers notice that they are being recorded. Here's a table of the state laws but we have not verified any of it. If there is any chance you will have callers or blacklisted callers from two-party consent states or foreign countries, then activate the "This call is being recorded component" below. Or, better yet, leave call recording disabled on all calls. And, remember, the NSA may be listening as well.

    BY USING ANYTHING THAT FOLLOWS, YOU ASSUME ALL LEGAL RESPONSIBILITY FOR YOUR ACTIONS!!!

    PREREQUISITES: We've tested this successfully on PBX in a Flash servers running Asterisk 1.8 and Asterisk 11. On other platforms, YMMV!

    INSTALLATION: Log into your server as root and issue the following commands:

    Code:
    #!/bin/bash
     
    mkdir /var/lib/asterisk/sounds/lenny
    chown asterisk:asterisk /var/lib/asterisk/sounds/lenny
    cd /var/lib/asterisk/sounds/lenny
    wget http://pbxinaflash.com/Lenny.tgz
    tar zxvf Lenny.tgz
    rm Lenny.tgz
     
    cd /tmp
    wget http://pbxinaflash.com/lsupport.tgz
    tar zxvf lsupport.tgz
    rm lsupport.tgz
    sed -i '\:// BEGIN Lenny Remake:,\:// END Lenny Remake:d' /etc/asterisk/extensions_custom.conf
    sed -i '/\[from-internal-custom\]/r /tmp/lenny.txt' /etc/asterisk/extensions_custom.conf
    rm lenny.txt
    mv 3.gsm /var/lib/asterisk/sounds/lenny
    cd /var/lib/asterisk/sounds/lenny
    chown asterisk:asterisk *
    chmod 755 *
     
    echo " " >> /etc/asterisk/extensions_custom.conf
    echo "[bridgit]" >> /etc/asterisk/extensions_custom.conf
    echo "exten => 4,1,Pickup([email protected])" >> /etc/asterisk/extensions_custom.conf
    echo "exten => 4,2,Pickup([email protected])" >> /etc/asterisk/extensions_custom.conf
    echo " " >> /etc/asterisk/extensions_custom.conf
     
    asterisk -rx "dialplan reload"
     
    echo "Try it out by dialing 53669 from any extension on your PBX."
    
    BLACKLIST MOD: If you want to use Lenny for your BlackList callers, you'll need to install the lgaetz BlackList MOD. Once installed, open the Lenny Blacklist MOD under Other in FreePBX and configure it to look like this:

    [​IMG]

    REDIRECTING RINGING INBOUND CALLS TO LENNY: At least on the Yealink T46G, we've got dialplan code working that lets you push a button and redirect ringing inbound calls to Lenny. This only works while the inbound calls are ringing. You can test it by dialing a monitored extension and pressing the Lenny button while the call is ringing. On the Yealink, here's what our DSSKey entry looks like:

    [​IMG]

    If you've followed the install above, you will note that a [bridgit] context has been added at the bottom of /etc/asterisk/extensions_custom.conf. This is where you tell Asterisk which calls to intercept and forward to Lenny at extension 53669. As configured, it will forward ringing calls to extension 701 and ring group 777 when you press a button on your phone that has been mapped to dial 536691. You can change the extensions to meet your requirements, or you can add additional ones by expanding the entries with 4,3 and 4,4 entries in [bridgit].

    Code:
    [bridgit]
    exten => 4,1,Pickup([email protected])
    exten => 4,2,Pickup([email protected])
    
    REDIRECTING RINGING CALLS TO OTHER EXTENSIONS: We've included dialplan code at the top of extensions_custom.conf called ;# // BEGIN Lenny Remake. If you scroll down to the 536691 section, you will see that 3 lines have been commented out:
    Code:
    ;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)
    
    By uncommenting these 3 lines, you will be able to forward ringing calls to any extensions by simply keying in the extension number after you press the Lenny button. If you only press #, the call will be forwarded to Lenny at extension 53669.

    ENABLING RECORDING OF CALLS: At the top of same section of the dialplan, you will see that 3 lines are commented out in the 53669 section:
    Code:
    ;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)
    
    Uncommenting the first two will enable recording of every Lenny call. Uncommenting the third line (highly recommended) plays a warning at the beginning of every call notifying the caller that they're being recorded.

    EMAILING RECORDINGS TO YOURSELF: The easiest way to get the recorded calls is to email them to yourself once or more each day. A script to convert the recordings to MP3s and email them to you and delete the recordings would look like this. Just plug in your email address and save as /root/convert2mp3.sh.

    Code:
    #!/bin/bash
    # name of this script: convert2mp3.sh
    # wav to mp3 and email the results to:
     
    email="[email protected]"
     
    cd /tmp/Lenny
    for i in *.wav; do
    if [ -e "$i" ]; then
    file=`basename "$i" .wav`
    lame -h -b 64 "$i" "$file.mp3"
    rm "$file.wav"
    /usr/local/bin/mime-construct --file "$file.mp3" --to $email --from [email protected] --type audio/mpeg --subject "Lenny recording"
    rm "$file.mp3"
    fi
    done
     
    # end of script
    
    Then add the following entry to /etc/crontab to get the emails at 1:06 a.m. each day:

    Code:
    6 1 * * * root /root/convert2mp3.sh >/dev/null 2>&1
    Let us know if you have problems. :beta1:
     
    sukasem, jmcman, Trimline2 and 3 others like this.
  2. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512

    Actually, it's 15 recordings presently. The more recordings, the merrier. I'm taking a recorder with us to record the mountain men next week.

    [​IMG]
     
  3. atsak

    atsak Guru

    Joined:
    Sep 7, 2009
    Messages:
    1,752
    Likes Received:
    161
    If this isn't a job for a newfie I don't know what is. FYI in Ontario only one party has to agree to the recording :)
     
  4. Trimline2

    Trimline2 Guru

    Joined:
    May 23, 2013
    Messages:
    525
    Likes Received:
    95
    Here's the whole run down for recording laws - http://en.wikipedia.org/wiki/Telephone_recording_laws

    I placed mine to be read in French - but it's purpose? How do you squeeze in "entertainment". Most, if not all of these calls, are made ignoring the Do Not Call Registry in the first place.
    ;exten => 53669,n,Playback(fr/this-call-may-be-monitored-or-recorded)
     
  5. hernanp

    hernanp New Member

    Joined:
    Dec 30, 2007
    Messages:
    7
    Likes Received:
    0
    "SIP URI courtesy of our RentPBX sponsors and SIP2SIP: [email protected]"


    That sip uri is not working :(

    Is there any other place where Lenny is up and running where to forward calls?
    I 've installed it at home (raspi) , but would like to use it from my cell too, forwarding to a sip uri...
     
  6. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
  7. mbellot

    mbellot Active Member

    Joined:
    Dec 15, 2008
    Messages:
    320
    Likes Received:
    78
    Ward - Excellent write-up, I'm going to have to try this when I get a chance.

    One thing. The original Lenny.tgz (that gets unzipped into /var/lib/asterisk/sounds/lenny) includes a 3.gsm file, why is there another one in lsupport.tgz that overwrites the original?
     
  8. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512

    Some folks originally used the sound files from another forum, and it didn't include 3.gsm which is 3 seconds of silence. Aside from that, chalk it up to sloppy coding. :arabia:
     
  9. Mango

    Mango www.toao.net

    Joined:
    Aug 10, 2013
    Messages:
    46
    Likes Received:
    13
    I was thrilled to discover Lenny this week. Unfortunately (in an ironic sort of way) I've done an excellent job of getting my phone number removed from a lot of telemarketing lists and haven't had any exciting results yet.

    Ward, I wanted to let you know I corrected some errors in the files I made. I removed some background noise that shouldn't have been there, added comfort noise to 14, and also made a one minute comfort noise file. This seems to make Lenny sound more realistic in my testing. The new files don't have the leading 0 in front of the numbers but that could be easily replaced if necessary. Feel free to grab them from the other forum, if you want to!
     
    Trimline2, lgaetz and wardmundy like this.
  10. mvoip

    mvoip New Member

    Joined:
    Dec 8, 2010
    Messages:
    15
    Likes Received:
    2
    Hi Ward,
    I have installed as described. When I call, I cannot get beyond "sorry I can barely hear you there" message. It keeps looping no matter how loud I speak. I tried to play with "BackgroundDetect(lenny/3,3000,30)", but cannot get it working. I have Asterisk 1.8.19.1 and FreePBX 2.10.1.1. Is it the FreePBX version?

    Thanks.
     
  11. mvoip

    mvoip New Member

    Joined:
    Dec 8, 2010
    Messages:
    15
    Likes Received:
    2
    Upgraded to
    FreePBX 2.11.0.10
    still the same issue.
     
  12. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512

    Perhaps sip2sip.info has a filter of some sort. I think they throw calls in the bit bucket when your volume is above 90% of their users so that may be the problem for a bit. Try later and let us know.
     
  13. randy7376

    randy7376 Guru

    Joined:
    Sep 29, 2010
    Messages:
    802
    Likes Received:
    90
    I've decided to come play for a little while... ;)

    I get the same thing. Watching the console and seeing that it's stuck in the loop, I keep getting "0 milliseconds of talk detected" and "TALK_DETECTED=0". Will have too dig deeper...
     
  14. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
    Please run the commands below to load the latest working release (recording disabled by default):
    Code:
    cd /tmp
    wget http://pbxinaflash.com/lsupport.tgz
    tar zxvf lsupport.tgz
    rm lsupport.tgz
    sed -i '\:// BEGIN Lenny Remake:,\:// END Lenny Remake:d' /etc/asterisk/extensions_custom.conf
    sed -i '/\[from-internal-custom\]/r /tmp/lenny.txt' /etc/asterisk/extensions_custom.conf
    rm lenny.txt
    rm 3.gsm
    asterisk -rx "dialplan reload"
    
     
  15. tm1000

    tm1000 Schmoozecom INC/FreePBX

    Joined:
    Dec 1, 2009
    Messages:
    1,360
    Likes Received:
    77
    lgaetz

    Anyway we can combine this into a module to avoid having to modify custom (not that I dont want users in there, just trying to make it more user friendly, upgradable)
     
  16. tm1000

    tm1000 Schmoozecom INC/FreePBX

    Joined:
    Dec 1, 2009
    Messages:
    1,360
    Likes Received:
    77
    I figured that. I will await wardmundy's reply on the licensing...

     
  17. mbellot

    mbellot Active Member

    Joined:
    Dec 15, 2008
    Messages:
    320
    Likes Received:
    78
    404...

     
  18. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512

    Covered in the Nerd Vittles article.
     
  19. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,701
    Likes Received:
    2,512
    We've pulled the dialplan code until we can sort out a couple of bugs. Please delete your existing copy and reload Asterisk for the time being.

    Code:
    sed -i '\:// BEGIN Lenny Remake:,\:// END Lenny Remake:d' /etc/asterisk/extensions_custom.conf
     
  20. phoneguy

    phoneguy Guru

    Joined:
    Jan 13, 2008
    Messages:
    285
    Likes Received:
    54
    It would just require the Sound Files to be GPL