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!
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.