Нашел такой скрипт:
Код: Выделить всё
#!/bin/bash
declare -a array
while read -e ARG && [ "$ARG" ] ; do
array=(` echo $ARG | sed -e 's/://'`)
export ${array[0]}=${array[1]}
done
EMAIL=my@email.com
DATE=`date "+%m-%d-%Y %H:%M"`
HOST=`hostname`
CID=`echo $agi_callerid`
CIDNAME=`echo $agi_calleridname`
EXTENSION=`echo $agi_extension`
DNID=`echo $agi_dnid`
STATUS=`echo $agi_dialstatus`
CHANNEL=`echo $agi_channel`
CAUSE=`echo $agi_causecode`
CODEC=`echo $agi_causecode`
HANGUPREASON=`echo $agi_hangupcause`
REASON=${REASON}
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 has failed on host [$HOST] at $DATE \n\n"
MSG="$MSG Number that was dialed : [$DNID] on trunk [VITELITY] \n\n"
MSG="$MSG with error : [$STATUS] and hangup cause is : [$REASON] \n\n"
# log
echo >> /var/log/asterisk/trunkfailure.log
echo -e "$MSG" >> /var/log/asterisk/trunkfailure.log
# Send an email
echo -e "$MSG" | mail -s " VITELITY - Failed call on host [$HOST] - dialing [$DNID] - " "$EMAIL"
Может у кого-то есть действующий скрипт?