Keywords: Mode: All keywords (AND) |
Mon May 09, 2011 22:52
|
kcee: Operating system name and version: Ubuntu 9.04
Version of smsd: 3.1.14
Smsd installed from: sources
Name and model of a modem / phone: Siemens TC65 Quad Band
Interface: serial (via USB interface)
I am using the sms server tool in a way that it sends text messages to different people. I am trying to implement a "timeout" in getting response back from the people that I have texted earlier. So that if I don't get a response back from a person, I put a flag in my database.
Is this feature available within the SMS SERVER TOOL? And where would I find more information about STATISTICS feature ?
thanks
kc
|
Fri May 06, 2011 19:21
|
kcee: First of all, thanks to you Keke, sms server tool is now logging received sms to mySQL db.
Nonetheless, I don't think the sms server tool is logging sent sms.
I ran: sudo sendsms ####### 'ping'
Even though I receive a text to my mobile phone from the sms server tool, I don't see a logged line in my mySQL.
sudo cat /usr/local/bin/smsd_eventhandler.sh:
#!/bin/bash
# This is an example script that logs all events into an SQL database
SQL_HOST=localhost
SQL_USER=root
SQL_PASSWORD="********"
SQL_DATABASE=smsd
SQL_TABLE=sms_log
DATE=`date +"%Y-%m-%d %H:%M:%S"`
#Extract data from the SMS file
FROM=`formail -zx From: < $2 | sed 's/"//g'`
TO=`formail -zx To: < $2`
#Remove plus sign, spaces, minus and short number prefix
TO=`echo "$TO" | sed 's/ //g' | sed 's/+//g' | sed 's/s//g' | sed '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')
#Set some SQL parameters
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"
#Insert a new entry into the SQL table
if [ "$1" = "FAILED" ] || [ "$1" = "SENT" ]; then
mysql $SQL_ARGS "insert into $SQL_TABLE (\`index\`,\`type\`,\`sent\`,\`sender\`,\`receiver\`,\`msgid\`,\`text\') values (NULL,\"$1\",\"$DATE\",\"$FROM\",\"$TO\",\"$3\",\"$TEXTSQL\");";
elif [ "$1" = "RECEIVED" ]; then
echo "RECEIVED!!"
mysql $SQL_ARGS "insert into $SQL_TABLE (\`index\`,\`type\`,\`sent\`,\`received\`,\`sender\`,\`receiver\`,\`text\`) values (NULL,\"RECEIVED\",\"$SENT\",\"$DATE\",\"$FROM\",\"$SUBJECT\",\"$TEXTSQL\");";
elif [ "$1" = "REPORT" ]; then
#Extract more data from the status report file
DISCHARGE=`sed -e 1,/SMS\ STATUS/d < $2 | formail -zx Discharge_timestamp:`
MSGID=`sed -e 1,/SMS\ STATUS/d < $2 | formail -zx Message_id:`
STATUS=`sed -e 1,/SMS\ STATUS/d < $2 | formail -zx Status: | cut -f1 -d,`
if [ "$MSGID" != "" ]; then
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
fi
What am I doing wrong?
|
Fri May 06, 2011 16:38
|
kcee: Again. I appreciate your reply. Thank you very much.
|
Fri May 06, 2011 16:13
|
kcee: Operating system name and version: Ubuntu 9.04
Version of smsd: 3.1.14
Smsd installed from: sources
Name and model of a modem / phone: Siemens TC65 Quad Band
Interface: serial (via USB interface)
I am just curious to find out how I should run the script file. Do I run it with "./sql_demo" or do I place the file into a particular location for the sms server tool to work with?
thanks
|
Fri May 06, 2011 16:10
|
kcee: It turns out that I did not have a correct port associated with the modem and that was the problem. The problem is now fixed. Thank you.
I have another question relating to running mySQL with sms server tool but I will start another thread for this topic.
|
Fri May 06, 2011 12:41
|
kcee: Thank you very much for your reply. I'll implement your suggestions within 2 hours - when Iget to work. I'll do a follow up after that.
Thank you Keke
|
Thu May 05, 2011 22:23
|
kcee: Operating system name and version: Ubuntu 9.04
Version of smsd: 3.1.14
Smsd installed from: sources
Name and model of a modem / phone: Siemens TC65 Quad Band
Interface: serial (via USB interface)
Hi
The GSM modem that I am trying to work is rated to work with ETSI EN 301 511, ETSI EN 301 489-1, and ETSI EN 301 489-7. I am just wondering if this modem will work with sms server tools 3. The FAQ points out that this tool will work with versions GSM 07.05 (=ETSI TS 300 585) and GSM 03.38 (=ETSI TS 100 900).
sudo tail - 20 /var/log/smsd.log:
2011-05-05 16:02:09,2, smsd: Smsd v3.1.14 started.
2011-05-05 16:02:09,2, smsd: Running as root:root.
2011-05-05 16:02:09,7, smsd: Running startup_check (shell): /var/spool/sms/incoming/smsd_script.TxCRmA /tmp/smsd_data.V6Z9iW
2011-05-05 16:02:09,7, smsd: Done: startup_check (shell), execution time 0 sec., status: 0 (0)
2011-05-05 16:02:09,4, smsd: File mode creation mask: 022 (0644, rw-r--r--).
2011-05-05 16:02:09,5, GSM1: Modem handler 0 has started. PID: 7430.
2011-05-05 16:02:09,5, GSM1: Using check_memory_method 1: CPMS is used.
2011-05-05 16:02:09,6, GSM1: Checking device for incoming SMS
2011-05-05 16:02:09,6, GSM1: Checking if modem is ready
2011-05-05 16:02:09,5, smsd: Outgoing file checker has started. PID: 7429.
2011-05-05 16:02:09,7, smsd: All PID's: 7429,7430
2011-05-05 16:02:09,7, GSM1: -> AT
2011-05-05 16:02:09,3, GSM1: Could not send character A, cause: Input/output error
2011-05-05 16:02:19,7, GSM1: -> .
2011-05-05 16:02:19,3, GSM1: Could not send character ., cause: Input/output error
|