SMS Server Tools 3
This site is hosted by Kekekasvi.com
 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. Please login or register. Thu Apr 18, 2024 22:21
SMSTools3 Community » Help and support Bottom

Read incoming message as UCS2

Login and Post Reply

Page:  1

Author Post
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


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

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

Member
Registered:
Nov 2021
Location: Sudbury, Ontario, Canada
Topic owner
Oh my god.... Amazing!
Merry Christmas. You made my MONTH!

:) :) :)

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.