Hello,
I’m using Monitor Trunk Failure
the detect when one trunk doesn’t work properly. On Edit Trunk
section I set Monitor Trunk Failure
to Yes
and put the filename in the box test.agi
.
Then I create this file under /var/lib/asterisk/agi-bin
, set asterisk
as owner and add execution privileges.
The file has the following code (that I paste from somewhere):
declare -a array
while read -e ARG && [ "$ARG" ] ; do
array=(` echo $ARG | sed -e 's/://'`)
export ${array[0]}=${array[1]}
done
EMAIL=you@your.domain
DATE=`date "+%m-%d-%Y %H:%M"`
HOST=`hostname`
CID=`echo $agi_callerid`
CIDNAME=`echo $agi_calleridname`
EXTENSION=`echo $agi_extension`
CHANNEL=`echo $agi_channel`
CONTEXT=`echo $agi_context`
REPORT=$EXTENSION
if [ "$EXTENSION" = "s-CHANUNAVAIL" ]
then
REPORT="Channel Unavailable"
fi
# Message Formating
MSG="\n\n A call from channel [$CHANNEL] \n"
MSG="$MSG With CID : [$CIDNAME] - [$CID] \n\n"
MSG="$MSG For CONTEXT : $CONTEXT \n\n"
MSG="$MSG has failed on host [$HOST] at $DATE \n\n"
MSG="$MSG with error : [$REPORT] \n\n"
# log
echo >> /var/log/asterisk/trunkfailuretest.log
echo -e "$MSG" >> /var/log/asterisk/trunkfailuretest.log
# Send an email
echo -e "$MSG" | mail -s " - Failed call on host [$HOST] -" "$EMAIL"
I can see properly the message, what I need now is to get the name of the trunk that fail…how can I do?
Thanks
Paolo