[Solved] Forward SMS using Freetz mit 4G LTE dongle und SMSTools3

cybermaus

Neuer User
Mitglied seit
5 Mai 2008
Beiträge
104
Punkte für Reaktionen
2
Punkte
18
Entschuldigung für mein armes Deutsch.

Ich habe seit Jahren nichts mehr mit Freetz gemacht, es funktioniert einfach.

Aber jetzt möchte ich einen neuen Fritz mit 4G-Dongle als Hauptanschluss verwenden. Gibt es eine Methode zum Weiterleiten von SMS- und Dienstnachrichten, die auf der SIM-Karte ankommen, an ... irgendwo. Andere SMS oder E-Mail.

Kann mir jemand ein paar Tipps geben, wo ich suchen soll, welche Tools zu kompilieren sind uzw
 
Bei der Fritzbox 6890 LTE soll es seit der Labor-Reihe FRITZ!OS 07.24 ein "SMS-Journal" geben. Vielleicht ist dies auch bei anderen Modellen (7490, 7590) mit USB Mobilfunk-Dongle der Fall.

Ansonsten gibt seit FRITZ!OS 07.10 einen E-Mail Push-Service für empfangene SMS-Nachrichten. Diese werden dann nicht mehr nur in den Ereignissen protokolliert.
 
  • Like
Reaktionen: cybermaus
Aha. schon in das Betriebssystem eingebaut. Hatte ich nicht erwartet, dass es so einfach sein würde. Ich dachte, ich müsste Skripte erstellen und Tools benutzen.

ich habe gerade ein gebrauchtes 1&1 7560 gekauft.
OS7.12 scheint der letste version zu sein. Vielleicht kan ich ein neueres version kompilieren, obwol 7.12 dan schon klapt.

Vielen Dank

-- Zusammenführung Doppelpost gemäß Boardregeln by stoney

Capture von AVM Labor: Nur 6890LTE

1607974912745.png
 
Zuletzt bearbeitet von einem Moderator:
Nur bei 6890
1.jpg 2.jpg

Bei anderen FB nur Empfang mit Eintrag ins System Log oder Email (PushMail), kein Versand.

Ein Weiterleiten per Email ist möglich, auch ohne Modifikation.
3.jpg
 
bei anderen FB nur Empfang mit Eintrag ins System Log
Die nach einem Neustart/Reboot leider "flöten" gehen :(
Nur überrascht mich der passus mit "send SMS" als journal. Kann man mit der 6890 tatsächlich via GUI+Browser SMS verfassen+absenden? Dann wäre gefühlt der CVS-Mode alias GSM-Gateway in der Theorie möglich, wie LTE-Stick+FB7490/7590 aktuell (mit einer 7.24-Inhaus-FW) recht passabel beherrschen?
LG
Nachtrag: bzgl. FW-Status der FB7490/7590
 
Zuletzt bearbeitet:
Ja man kann mit passender SIM SMS versenden, kanns mit der Multicard aber nicht testen.

Und ja nach Neustart gehts flöten, daher ja PushMail nutzen.
 
Oder syslog server? Ich hatte das im vergangenheid mit Freetz, alles geht zur externes syslog server (papertrail) aber is dass vielleicht jetz auch im OS?
 
Als Laie/Noob verblüfft mich, dass Mobilanrufe (ein-/ausgehend) via Mobilfunstick/CVS brav im Anruflog (300 Stck. max.?) rebootresistent gespeichert werden, aber die SMS verworfen werden?
So wirklich Sinn macht das nicht?
LG
 
Danke, ja ich habe dies getestet.
Aber zuerst muss ich die Probleme mit dem LTE-Treiber lösen

-- Zusammenführung Doppelpost gemäß Boardregeln by stoney

In English (sorry, writing German is too hard, at least when I speak it, I can "hide" the spelling mistakes).

SMSTools3 is working well, and I worked around my LTE dongle problems.
Based on the example event handler, I made one to automatically forward provider SMS to my cell phone, and I can trigger returns by sending SMS with a "Forward: " header.
I decided to unify the more obvious "Forward-from:" and "Forward-to: into a single "Forward:" for easier copy-paste.

Example, The LTE dongle gets a message from the service provider (or anyone, really)
Code:
Your bundle is almost gone, send EXTEND 1GB to extend your bundle

It is forwarded to my real phone, but with the original sender added to the text and "Forward:" added to it (meaning Forward-From)
Code:
Forward: 1266 Your bundle is almost gone, send EXTEND 1GB to extend your bundle

I copy, paste, edit as desired, and send back to the LTE dongle: (now Forward: means Forward-To)
Code:
Forward: 1266 EXTEND 1GB

Now SMSTools3 removed the forward, and sends it
Code:
EXTEND 1GB

So the provider on number 1266 sees the message come from my LTE dongle phone number.

Possible problems:
It will forward messages from anyone to my phone, and if they known, anyone could make the dongle send to anyone else.
When this becomes a security or cost problem, some filter code could/should be added to the script to only allow known service provider numbers.
I think this may also fail if the SMS text has quotes (") or is in non-ISO character format.


How-To

1. Tweak Freetz sources smstools3.cfg & smstools3_conf as show further down and compile & flash
(eventually I may figure out how to add this to the web-ui config page)

1. Configure the event handler script name in Freetz smstools3 config
(as these patches are now part of the Freetz-NG)

2. Make sure the 4G-LTE stick is working (see here for my Alfa/Quectel model)

3. Configure smstools3 as normal
I put the folder in /var/media/ftp/sms so SMS are retained past reboot, and my SMS device is /dev/ttyUSB2

4. Put this event handler in /var/tmp/flash/smsforward.sh
( don't forget to make executable and modsave flash )
Freetz version, as it is rather non-standard implementation of smstools3
Code:
#!/bin/sh
# Forward for Freetz smstools3 implementation, which is non-standard
#
# Make executable: chmod a+x
# Debug by viewing /var/log/smsd

NUMBER=316xxxxxxxx   # My Phone
#NUMBER2=316xxxxxxxx  # My alternate Phone

SOURCE=`cat $2|grep ^From:|cut -d " " -f2`
FORWARD=`cat $2|grep ^Forward:|cut -d " " -f2`

SENDSMS="/etc/init.d/rc.smstools3 sendsms"

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

    # line number of the actual message (last line)
    line="$(awk '/^\s*$/{print NR}' $2|head -n 1)"
    [ -z "$line" ] && exit 0

    # extract message
    MESSAGE="`sed "1,${line}da" < $2`"

    # If forward command, then forward message
    if [ -n "$FORWARD" ];then
      #remove forward header
      MESSAGE2=${MESSAGE#Forward: [0-9]* }
      $SENDSMS "$FORWARD" "${MESSAGE2}"
      sleep 1 # force sepate timestamp in temp file
    fi

    # If no forward command, then forward to preprogrammed number
    # Even if a forward command, still forward to listed numbers, to show processing was OK
    if [ -n "$NUMBER" ];then
      $SENDSMS "$NUMBER" "Forward: ${SOURCE} ${MESSAGE}"
    fi
    if [ -n "$NUMBER2" ];then
      sleep 1 # force sepate timestamp in temp file
      $SENDSMS "$NUMBER2" "Forward: ${SOURCE} ${MESSAGE}"
    fi

fi

Tweaked Freetz source: make/smstools3/files/root/etc/default.smstools3/smstools3.cfg
Code:
export SMSTOOLS3_ENABLED='no'
export SMSTOOLS3_DIR=''
export SMSTOOLS3_DEVICE='/dev/ttyUSB0'
export SMSTOOLS3_PIN=''
export SMSTOOLS3_LOGLEVEL='5'
export SMSTOOLS3_EVENTS='/tmp/flash/smsforward.sh'

Tweaked Freetz source: make/smstools3/files/root/etc/default.smstools3/smstools3_conf
Code:
#!/bin/sh

cat << EOF
devices = GSM
logfile = /var/log/smsd.log
loglevel = $SMSTOOLS3_LOGLEVEL
eventhandler = $SMSTOOLS3_EVENTS

[GSM]
device = $SMSTOOLS3_DEVICE
incoming = yes
EOF

[ -n "$SMSTOOLS3_PIN" ] && echo "pin = $SMSTOOLS3_PIN"

For reference, my similar OpenWRT version (more standard smstools3 implementation)
Code:
#!/bin/sh

NUMBER=316xxxxxxxx   # My Phone
NUMBER2=316xxxxxxxx  # My alternate Phone
MAIL=
LOCAL=
SOURCE=`cat $2|grep ^From:|cut -d " " -f2`
FORWARD=`cat $2|grep ^Forward:|cut -d " " -f2`
TYPE="international"


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

    line="$(awk '/^\s*$/{print NR}' $2|head -n 1)"
    [ -z "$line" ] && exit 0

    cat $2 | grep UCS2
    if [ $? -eq 0 ]; then

    TMPFILE=`mktemp /tmp/forward_XXXXXX`
    sed -e "1,${line}d" $2 > $TMPFILE
    MESSAGE="`gl_modem convert $TMPFILE`"

    else

    MESSAGE="`sed "1,${line}da" < $2`"

    fi


    # If forward command, then forward message
    if [ -n "$FORWARD" ];then
      #remove forward header
      MESSAGE2=${MESSAGE##Forward: [0-9]* }
      sendsms "$FORWARD" "${MESSAGE2}"
    fi


    # If no forward command, then forward to preprogrammed number
    # Even if a forward command, still forward to listed numbers, to show processing was OK
    if [ -n "$NUMBER" ];then
      sendsms "$NUMBER" "Forward: ${SOURCE} ${MESSAGE}"
    fi
    if [ -n "$NUMBER2" ];then
      sendsms "$NUMBER2" "Forward: ${SOURCE} ${MESSAGE}"
    fi

fi
 
Zuletzt bearbeitet von einem Moderator:

Neueste Beiträge

Statistik des Forums

Themen
244,858
Beiträge
2,219,647
Mitglieder
371,571
Neuestes Mitglied
FritzFunk
Holen Sie sich 3CX - völlig kostenlos!
Verbinden Sie Ihr Team und Ihre Kunden Telefonie Livechat Videokonferenzen

Gehostet oder selbst-verwaltet. Für bis zu 10 Nutzer dauerhaft kostenlos. Keine Kreditkartendetails erforderlich. Ohne Risiko testen.

3CX
Für diese E-Mail-Adresse besteht bereits ein 3CX-Konto. Sie werden zum Kundenportal weitergeleitet, wo Sie sich anmelden oder Ihr Passwort zurücksetzen können, falls Sie dieses vergessen haben.