SMS Server Tools 3
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. The forum is currently read-only, but will open soon. Thu Nov 21, 2024 22:51
SMSTools3 Community » Help and support Bottom

[answered] Decoding troubles.

  This topic is locked

Page:  1

Author Post
Member
Registered:
Apr 2011
Location: Ukraine
Operating system name and version: FreeBSD 8.2
Version of smsd: smstools-3.1.14
Smsd installed from: FreeBSD ports tree
Name and model of a modem / phone: Huawei e1550
Interface: USB

I need to receive sms and store into DB.
I can write a perl script for insert into DB, but cant find solution for decoding into russian.
Help me to decode incoming messages into russian.

My conf is:
incoming_utf8 = yes
decode_unicode_text = yes
eventhandler  = /usr/SMS/event-decoder
devices = GSM1
logfile = /var/log/smsd.log
loglevel = 7

[GSM1]
device = /dev/cuaU0.0
incoming = yes
pin = 0000
[root@bsd /usr/SMS]#
 
'smsdconf' Syntax Highlight powered by GeSHi


/usr/SMS/event-decoder:
#!/bin/sh
# This sample converts a received message file from
# ISO to UTF-8 character set.

# After version 3.0.8 this is not needed.
# Use incoming_utf8 = yes in the modem settings.

case "$1" in
  SENT|RECEIVED|FAILED)
    FILE=`mktemp /tmp/smsd_XXXXXX`
    iconv -f ISO-8859-15 -t UTF-8  < $2 > $FILE
    cp $FILE /usr/SMS/
    #chmod 644 $2
    ;;
esac
 
'bash' Syntax Highlight powered by GeSHi


sample sms message looks like this:


I looking for correct solution for decode my sms from GSM into readable russian.
Thanks.


« Last edit by Alekk on Wed Apr 20, 2011 12:52, 165 months ago. »
Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Current version does not decode Unicode messages properly when it's written using your language. Internal conversion is limited to latin character set only.

Remove the setting decode_unicode_text. Smsd will then store messages using UCS2, and your eventhandler can use this kind of a code for decoding:

  if sed -e '/^$/ q' < "$2" | grep "^Alphabet: UCS2" > /dev/null; then
    TMPFILE=`mktemp /tmp/smsd_XXXXXX`
    sed -e '/^$/ q' < "$2" | sed -e 's/Alphabet: UCS2/Alphabet: UTF-8/g' > $TMPFILE
    sed -e '1,/^$/ d' < "$2" | iconv -f UNICODEBIG -t UTF-8 >> $TMPFILE
    mv $TMPFILE "$2"
  fi
 
'bash' Syntax Highlight powered by GeSHi


Member
Registered:
Apr 2011
Location: Ukraine
Topic owner
keke, i'm very grateful!
Now, incoming message easy converted by iconv!!!

p.s. thank you very much for your work and smstools3 !!!


« Last edit by Alekk on Wed Apr 20, 2011 13:43, 165 months ago. »

  This topic is locked

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.