TRY THIS IncrediblePBX - Trunk failure email alerts.

sortons

Member
Joined
Aug 9, 2018
Messages
60
Reaction score
10
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...
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,227
@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
 

sortons

Member
Joined
Aug 9, 2018
Messages
60
Reaction score
10
Thank you!
The script runs on CentOS, not Raspberry - any idea?

root@incrediblepbx:~# sh trunkcheck.sh
trunkcheck.sh: 10: trunkcheck.sh: [[: not found
trunkcheck.sh: 18: trunkcheck.sh: [[: not found
trunkcheck.sh: 26: trunkcheck.sh: [[: not found

Any addition for PJSIP trunk checks?
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,227
Try changing the "if [[ $test ]]; then" lines to:
Code:
if [ ! -z "$test" ]; then
 
Last edited:

Members online

Forum statistics

Threads
25,824
Messages
167,825
Members
19,247
Latest member
mdauck
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top