From 664f80d7c74beeb01b0bd743363743e8ee7d5dc7 Mon Sep 17 00:00:00 2001 From: Pothi Kalimuthu <1254302+pothi@users.noreply.github.com> Date: Sun, 6 Nov 2022 10:30:46 +0530 Subject: [PATCH] Add a new script and update docs --- README.md | 4 ++++ scripts/sms-forward-email.rsc | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 scripts/sms-forward-email.rsc diff --git a/README.md b/README.md index ae11991..2d2e055 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,10 @@ Scripts for MikroTik LTE products such as SXT LTE Kit. MikroTik LTE products wit - Coming soon (Mikrotik v7 scripts). - Coming soon (Mikrotik v7 changes). +## ToDo + +- auto-update of LTE firmware + # Contact You may contact me by my first name (Github username) @riseup.net, @protonmail.com, @duck.com. diff --git a/scripts/sms-forward-email.rsc b/scripts/sms-forward-email.rsc new file mode 100644 index 0000000..4e89dd6 --- /dev/null +++ b/scripts/sms-forward-email.rsc @@ -0,0 +1,38 @@ +# SMS Forward and Email + +# ToDo: Shorten the timestamp. + +# Source: https://forum.mikrotik.com/viewtopic.php?f=9&t=61068#p312202 + +# Note: The SMS is removed from the inbox after sent by Email and forwarded +# even if email and forward fail! So, test it often! + +:local adminEmail "admin@example.com" +:local smsForwardPh 9876543210 + +:local smsPhone +:local smsMessage +:local smsTimeStamp + +/tool sms inbox + +:foreach i in=[find] do={ + :set smsPhone [get $i phone] + :set smsMessage [get $i message] + :set smsTimeStamp [get $i timestamp] + + :log info "SMS Received From: $smsPhone at $smsTimeStamp Message: $smsMessage" + + # Forward the SMS to $smsForwardPh + :do { + /tool sms send lte1 phone-number=$smsForwardPh message="From: $smsPhone Date:$smsTimeStamp Msg: $smsMessage" + } on-error={ /tool e-mail send to="$adminEmail" subject="Sending SMS Failed" body="Check the log" } + :delay 2s + + # Send Email to $adminEmail + /tool e-mail send to="$adminEmail" body="$smsMessage" \ + subject="SMS from $smsPhone at $smsTimeStamp" + :delay 3s + + remove $i +}