|
|
SMS Server Tools 3 Community |
Welcome, Guest. The forum is currently read-only, but will open soon. |
Mon Sep 08, 2025 01:24 |
Page: 1
Keywords: Mode: All keywords (AND) |
Mon Jan 21, 2013 08:33
|
adir: 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 :D
|
Mon Jan 21, 2013 04:07
|
adir: Hello Iam adi
I have a problem with smstools
when i send a sms to a modem, sms modem can not get into the database (sms_log) overall. sms_log does not show sender, recipient, message content, time sent and time received, but only show MSGID and the status of send / receive
this my sms.conf
_________________________________________________
devices = GSM1
outgoing = /var/spool/sms/outgoing
checked = /var/spool/sms/checked
failed = /var/spool/sms/failed
incoming = /var/spool/sms/incoming
sent = /var/spool/sms/sent
mypath = /usr/local/bin
logfile = /var/log/smsd.log
loglevel = 7
alarmlevel = 4
delaytime = 5
errorsleeptime = 5
blocktime = 3600
receive_before_send = no
# autosplit 0=no 1=yes 2=with text numbers 3=concatenated
autosplit = 3
[GSM1]
init = ATE0+CPMS="SM"
device = /dev/ttyUSB1
incoming = yes
mode = new
smsc = 6281100000
baudrate = 115200
rtscts = yes
cs_convert = yes
report = no
memory_start = 1
eventhandler = /usr/local/bin/smsbmsf
________________________________________________________
this is my smsbmf
________________________________________________________
#!/bin/sh
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'`
TO=`formail -zx To: < $2`
SUBJECT=`formail -zx Subject: < $2`
SENT=`formail -zx Sent: < $2`
TEXT=`formail -I "" <$2`
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\",TRIM(\"$TEXT\"));";
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\",TRIM(\"$TEXT\"));";
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
____________________________________________________________________________
I need your Help
thank :D
|
Page: 1
Time in this board is UTC.
|
|
|
 |
|
 |
|