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:54
SMSTools3 Community » Help and support Bottom

Sending/receiving UCS2 sms's

Login and Post Reply

Page:  1

Author Post
Member
Registered:
Sep 2011
Location: Lisboa, Portugal
Operating system name and version: Win XP SP2
Version of smsd: 3.1.14
Smsd installed from: sources
Name and model of a modem / phone: Siemens MC35
Interface: serial

Hi all,
Im currently trying to setup a configuration for sending several sms's in different formats for terminal devices testing purposes.
I followed the instructions for installing and setup of this great tool but im currently getting some problems when receiving or sending sms's in UCS2.

My setup is the following:
_____________________
smsd.conf:
checkhandler = /usr/local/bin/smsd_checkhandler.sh
eventhandler = /usr/local/bin/smsd_eventhandler.sh
devices = GSM1
logfile = /var/log/smsd.log
loglevel = notice
smart_logging = yes
sent= /var/spool/sms/sent
store_received_pdu = 3
store_sent_pdu = 3
#stats_no_zeroes = yes
log_charconv = yes


[GSM1]
device = /dev/ttyS0
incoming = yes
#pin = 1111
decode_unicode_text = yes
_______________________
smsd_checkhandler.sh
#!/bin/bash

if sed -e '/^$/ q' < "$1" | grep "^Alphabet: UTF-8" > /dev/null; then
TMPFILE=`mktemp /tmp/smsd_XXXXXX`
sed -e '/^$/ q' < "$1" | sed -e 's/Alphabet: UTF-8/Alphabet: UCS2/g' > $TMPFILE
sed -e '1,/^$/ d' < "$1" | iconv -f UTF-8 -t UNICODEBIG >> $TMPFILE
mv $TMPFILE "$1"
fi
__________________
smsd_eventhandler.sh
#!/bin/bash

if [ "$1" == "RECEIVED" ]; then

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

fi
_________________

With this configuration, i always get the following errors in the sms_trouble.log:
2011-09-19 13:51:00,3, GSM1: Exec: eventhandler encountered errors:
2011-09-19 13:51:00,3, GSM1: ! /usr/local/bin/smsd_eventhandler.sh: line 2: $'\r': command not found
2011-09-19 13:51:00,3, GSM1: ! /usr/local/bin/smsd_eventhandler.sh: line 12: syntax error near unexpected token `fi'
2011-09-19 13:51:00,3, GSM1: ! /usr/local/bin/smsd_eventhandler.sh: line 12: `fi'
2011-09-19 13:51:00,3, GSM1: ALERT: problem with eventhandler, result 2
2011-09-19 13:51:00,6, GSM1: Deleting message 1
....
2011-09-19 14:00:22,3, smsd: Exec: checkhandler encountered errors:
2011-09-19 14:00:22,3, smsd: ! /usr/local/bin/smsd_checkhandler.sh: line 2: $'\r': command not found
2011-09-19 14:00:22,3, smsd: ! /usr/local/bin/smsd_checkhandler.sh: line 8: syntax error near unexpected token `fi'
2011-09-19 14:00:22,3, smsd: ! /usr/local/bin/smsd_checkhandler.sh: line 8: `fi'

______________________

I hope that someone can help me, im a little stuck here...
If i remove the event and check handler from the config, then i can send/receive simple GSM sms's with no kind of hassle.

When i have this problem solved, i will try to implement the new "Single shift" and "Locking shift" encoding tables as this is fundamental for the kind if implementation that i need :)

Thanks for your help!

Member
Registered:
Sep 2011
Location: Brusturoasa, Romania
I don't think the if 'condition' is right, it should be between "[" and "]". http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-6.html

You should study more bash.

Vlad.

Member
Registered:
Sep 2011
Location: Lisboa, Portugal
Topic owner
atnet wrote
I don't think the if 'condition' is right, it should be between "[" and "]". http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-6.html

You should study more bash.

Vlad.

Thanks Vlad for your replay.
Its true, i need to learn Bash but im using the structure given in this forum and it works for everyone...except for me :(

BTW, i tried the changes that you suggested and the error is the same.

Member
Registered:
Sep 2011
Location: Lisboa, Portugal
Topic owner
OK, i have found the several problems and fixed it.

1) The checkhandler.sh and eventhandler.sh must be in UNIX format (Windows users - use a code editor and set the code format to UNIX).
In Windows every code line has in the end the "\r\n" end of line indicator. In UNIX, the end of line is "\n".

2) the sms file must be in UTF-8 file character format. if you create the sms file with notepad or similar the format will be ANSI.

3) In the sms file body, include "Alphabet: UTF-8" when sending accentuated characters so the checkhandler can identify the encoding.

With the above configuration and this two "workarounds" the accentuated characters (UCS2) are sent and received fine!

Wope that this will save some headaches to someone else :)

Member
Registered:
May 2012
Location: Portugal
Hi alexbb,

you said

"When i have this problem solved, i will try to implement the new "Single shift" and "Locking shift" encoding tables as this is fundamental for the kind if implementation that i need :)"

have you implemented or try to implement anything related to national shift tables?

Login and Post Reply

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.