Author |
Post |
|
#1 Thu Jul 07, 2011 21:13, 162 months ago.
|
Member
Registered: May 2011
Location: Lima, Peru
|
Operating system name and version: Debian Squeeze Version of smsd: 3.1.14 Smsd installed from: apt-get install Name and model of a modem / phone: SIM548C Interface: USB-Serial
Hi friends;
I want to know if it's possible to configure the max length of a sms. It's only that I am testing smstools with a modem just for receiving sms's and even the sms has 100 characters, smstools only get the first 50 chars.
Please tell me where can I configure this. Thanks!
|
|
#2 Fri Jul 08, 2011 11:08, 162 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Length is not configurable and smstools does not cut incoming messages.
Use the loglevel = 7 and show from the log how SMS is received. Also show hexdump -C < /var/spool/sms/<incoming SMS file>.
|
|
#3 Fri Jul 08, 2011 17:30, 162 months ago.
|
Member
Registered: May 2011
Location: Lima, Peru
Topic owner
|
Actually was my mistake, smstools is correctly getting the full incoming sms. But when I use sample code for inserting incoming sms into MySql table, the text is not complete.
The field txt in MySql table is varchar(220) so it would fit any sms.
But I only get the first 50 chars in MySql table. How to fix this? Thanks!
The code is
#Extract data from the SMS file FROM=`formail -zx From: < $2` TEXT=`formail -I "" <$2 | sed -e"1d"`
#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"
#Do the SQL Query #mysql $SQL_ARGS "UPDATE $SQL_TABLE SET stat=\"1\" WHERE cel=\"$FROM\";" mysql $SQL_ARGS "insert into $SQL_TABLE (cel,txt) values (substring(\"$FROM\",-9),\"$TEXT\");"
|
|
#4 Fri Jul 08, 2011 17:44, 162 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
What kind is the text in SMS, does it contain backslashes and/or double quotation marks? At least you should make it "SQL safe", like:
TEXT=$(echo "$TEXT" | sed 's/\\/\\\\/g' | sed 's/\"/\\\"/g')
|
|
#5 Fri Jul 08, 2011 19:22, 162 months ago.
|
Member
Registered: May 2011
Location: Lima, Peru
Topic owner
|
It's just text only 'a-z''A-Z''0-9' and blank spaces with no other symbols. I tested with 4 incoming SMS with more than 50 chars but when it's transfered to MySql it always get the first 50 chars.
I will test with your recommendation.
|
|
#6 Fri Jul 08, 2011 19:30, 162 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Check from the log of MySQL what kind of clause is executed, to see if the problem is on the script side, or on the server side. Also verify that the field surely is varchar(220).
|