TRY THIS IncrediblePBX - Trunk failure email alerts.

Discussion in 'General' started by sortons, Feb 8, 2019.

  1. sortons

    sortons New Member

    Joined:
    Aug 9, 2018
    Messages:
    14
    Likes Received:
    1
    Hi,

    I'm trying to add trunk failure email alerts to my IncrediblePBX running on Raspberry 3+. There are clear instructions in the article at http://nerdvittles.com/?p=6103. However, tar zxvf trunkcheck.tar.gz returns:

    gzip: stdin: not in gzip format
    tar: Child returned status 1
    tar: Error is not recoverable: exiting now

    Is the file corrupted, or any other reason?

    Thank you...
     
  2. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,507
    Likes Received:
    2,471
    @sortons: Try this script. Comment out or remove the exit line half way down if you want the Google Voice tests.
    Code:
    #!/bin/bash
    
    from="[email protected]"
    email="[email protected]"
    
    # Don't mess with stuff below here
    
    test=`asterisk -rx "sip show registry" | grep "Auth"`
    
    if [[ $test ]]; then
     test2=`echo -e "Trunk off line:\n$test"`
     echo $test2 | mail -r $from -s "SIP Trunk Failure" $email
    # echo -e "Trunk off line:\n$test"
    fi
    
    test=`asterisk -rx "sip show registry" | grep "Request Sent"`
    
    if [[ $test ]]; then
     test2=`echo -e "Trunk off line:\n$test"`
     echo $test2 | mail -r $from -s "SIP Trunk Failure" $email
    # echo -e "Trunk off line:\n$test"
    fi
    
    test=`asterisk -rx "iax2 show registry" | grep "Reje"`
    
    if [[ $test ]]; then
     test2=`echo -e "Trunk off line:\n$test"`
     echo $test2 | mail -r $from -s "IAX2 Trunk Failure" $email
    # echo -e "Trunk off line:\n$test"
    fi
    
    exit
    
    astversion=`sudo asterisk -rx "core show version" | grep -m 2 ^ | tail -1 | cut -f 2 -d " "`
    if [ "${astversion:0:2}" != "11" ]; then
     test3=`asterisk -rx "jabber show connections"`
    else
     test3=`asterisk -rx "xmpp show connections"`
    fi
    
    test=`echo "$test3" | grep "Authen"`
    if [[ $test ]]; then
     test2=`echo -e "Trunk off line:\n$test"`
     echo $test2 | mail -r $from -s "Google Trunk Failure" $email
    # echo -e "Trunk off line:\n$test"
    fi
    
    test=`echo "$test3" | grep "Disconn"`
    if [[ $test ]]; then
     test2=`echo -e "Trunk off line:\n$test"`
     echo $test2 | mail -r $from -s "Google Trunk Failure" $email
    # echo -e "Trunk off line:\n$test"
    fi
    
    test=`echo "$test3" | grep "Reques"`
    if [[ $test ]]; then
     test2=`echo -e "Trunk off line:\n$test"`
     echo $test2 | mail -r $from -s "Google Trunk Failure" $email
    # echo -e "Trunk off line:\n$test"
    fi
    
    test=`echo "$test3" | grep "Waitin"`
    if [[ $test ]]; then
     test2=`echo -e "Trunk off line:\n$test"`
     echo $test2 | mail -r $from -s "Google Trunk Failure" $email
    # echo -e "Trunk off line:\n$test"
    fi
    
    
    # end of trunkcheck script