Hello Iam adi,
I try to use smstools
I success to show data received from smstools to sms_log(if I send data from Hp to modem, I can see all data received in sms_log), but (if I send data from modem to Hp) I failed to show all data send/failed sms overall.
this my eventhandler script
_____________________________________________
SQL_HOST=localhost
SQL_USER=adirusito
SQL_PASSWORD='adirusito123!'
SQL_DATABASE='sms'
SQL_TABLE=sms_log
SQL_TABLE_OUT=sms_out
DATE=`date +"%Y-%m-%d %H:%M:%S"`
FROM=`formail -zx From: < $2 | sed 's/"//g'`
#FROMO=$(echo "$FROM" | sed 's/ //g' | sed 's/+//g' | sed 's/s//g' | sed 's/-//g'| sed 's/"//g')
TO=`formail -zx To: < $2`
#TOO=$(echo "$TO" | formail 's/ //g' | formail 's/+//g' | formail 's/s//g' | formail 's/-//g')
SUBJECT=`formail -zx Subject: < $2`
SENT=`formail -zx Sent: < $2`
TEXT=`sed -e '1,/^$/ d' < $2`
TEXTSQL=$(echo "$TEXT" | sed 's/\\/\\\\/g' | sed 's/\"/\\\"/g')
LOGFILE="$(basename $2)"
if [ "$SQL_PASSWORD" != "" ]; then
SQL_ARGS="-p$SQL_PASSWORD";
else
SQL_ARGS="";
fi
SQL_ARGS="-h $SQL_HOST -u $SQL_USER $SQL_ARGS -D $SQL_DATABASE -s -e"
if [ "$1" = "FAILED" ] || [ "$1" = "SENT" ]; then
mysql $SQL_ARGS "insert into $SQL_TABLE (type,sent,sender,receiver,msgid,messages) values (\"$1\",\"$DATE\",\"$FROM\",\"$TO\",\"$LOGFILE\",\"$TEXTSQL\");";
mysql $SQL_ARGS "UPDATE sms_out SET sent=\"$DATE\",type=\"$1\",stat='1' WHERE msgid=\"$LOGFILE\" AND tono=\"$TO\";";
elif [ "$1" = "RECEIVED" ]; then
mysql $SQL_ARGS "insert into $SQL_TABLE (type,sent,received,sender,receiver,msgid,messages) values (\"RECEIVED\",\"$SENT\",\"$DATE\",\"$FROM\",\"$SUBJECT\",\"$LOGFILE\",\"$TEXTSQL\");";
elif [ "$1" = "REPORT" ]; then
DISCHARGE=`sed -e 1,7d < $2 | formail -zx Discharge_timestamp:`
MSGID=`sed -e 1,7d < $2 | formail -zx Message_id:`
STATUS=`sed -e 1,7d < $2 | formail -zx Status: | cut -f1 -d,`
ID=`mysql $SQL_ARGS "select id from $SQL_TABLE where receiver=\"$FROM\" and type=\"SENT\" and msgid=\"$MSGID\" order by id desc limit 1;"`
mysql $SQL_ARGS "update $SQL_TABLE set received=\"$DISCHARGE\",status=\"$STATUS\" where id=\"$ID\";"
fi
/usr/bin/php5 /usr/local/bin/cekbpr ${FROM}
#/usr/bin/php5 /usr/local/bin/schedcheck.php
_______________________________________________________
Please Help me,
Thank's