Author |
Post |
|
#1 Fri Nov 26, 2021 23:51, 36 months ago.
|
Member
Registered: Nov 2021
Location: Sudbury, Ontario, Canada
|
Operating system name and version: Raspberry Pi 4 Version of smsd: Latest Smsd installed from: sources Name and model of a modem / phone: Quelcom EC25 (on a Sixfab hat) Interface: USB When I use incoming to a file, The message sometimes comes in as UCS2, for instance if I receive a emoticon with text. If I use tr to extract all the binary it partially works Is there a way to extract message only from the file with smstools? Sample incoming : /var/spool/sms/incoming/SIXFAB.QVMHIe
|
|
#2 Sat Nov 27, 2021 02:38, 36 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
You can use the eventhandler to convert this kind of incoming messages to UTF-8. In global part of smsd.conf, define: eventhandler = /usr/local/bin/smsd_eventhandler.shCreate this file with a following content: #!/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 'bash' Syntax Highlight powered by GeSHi Make the file executable for smsd and restart the daemon.
|
|
#3 Sat Nov 27, 2021 15:41, 36 months ago.
|
Member
Registered: Nov 2021
Location: Sudbury, Ontario, Canada
Topic owner
|
Oh my god.... Amazing! Merry Christmas. You made my MONTH!
|