mirror of
https://github.com/pothi/mikrotik-scripts.git
synced 2025-07-10 06:34:28 +02:00
Migrate LTE scripts to its dedicated repo and update docs
This commit is contained in:
parent
591ed2d662
commit
7c39017944
6 changed files with 17 additions and 197 deletions
|
@ -1,38 +0,0 @@
|
|||
# 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
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
# SMS to Email
|
||||
|
||||
# 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!
|
||||
|
||||
:global adminEmail
|
||||
|
||||
:local smsPhone
|
||||
:local smsMessage
|
||||
:local smsTimeStamp
|
||||
|
||||
/tool sms inbox
|
||||
|
||||
:foreach receivedSMS in=[find] do={
|
||||
:set smsPhone [get $receivedSMS phone]
|
||||
:set smsMessage [get $receivedSMS message]
|
||||
:set smsTimeStamp [get $receivedSMS timestamp]
|
||||
|
||||
:log info "\nSMS Received From: $smsPhone on $smsTimeStamp Message: $smsMessage"
|
||||
|
||||
# Send Email to $adminEmail
|
||||
:do {
|
||||
/tool e-mail send to="$adminEmail" body="$smsMessage" \
|
||||
subject="SMS from $smsPhone at $smsTimeStamp"
|
||||
} on-error={ :log error "SMS to Email Failed." }
|
||||
:delay 3s
|
||||
|
||||
# Let's remove the SMS!
|
||||
remove $receivedSMS
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
# SMS to SMS
|
||||
|
||||
# Limitation: It just forwards the SMS. It doesn't forward the senderPhoneNumber or timestamp of received SMS.
|
||||
|
||||
# Source: https://forum.mikrotik.com/viewtopic.php?f=9&t=61068#p312202
|
||||
|
||||
:global adminPh
|
||||
:local smsForwardPh $adminPh
|
||||
|
||||
:local smsPhone
|
||||
:local smsMessage
|
||||
:local smsTimeStamp
|
||||
|
||||
/tool sms inbox
|
||||
|
||||
:foreach receivedSMS in=[find] do={
|
||||
:set smsPhone [get $receivedSMS phone]
|
||||
:set smsMessage [get $receivedSMS message]
|
||||
:set smsTimeStamp [get $receivedSMS timestamp]
|
||||
|
||||
:log info "\nSMS Received From: $smsPhone on $smsTimeStamp Message: $smsMessage"
|
||||
|
||||
# Forward the SMS to $smsForwardPh, without $smsPhone and smsTimeStamp
|
||||
:do {
|
||||
/tool sms send lte1 phone-number=$smsForwardPh message=$smsMessage
|
||||
} on-error={ :log error "SMS to SMS Failed." }
|
||||
:delay 2s
|
||||
|
||||
# Let's NOT remove the SMS!
|
||||
# Let the other script (SMS to Email) remove it, after sending the message with full details.
|
||||
# remove $receivedSMS
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
# Applicable for RouterOS above 6.45.1
|
||||
# see https://wiki.mikrotik.com/wiki/Dual_SIM_Application#Initial_settings
|
||||
|
||||
:log "info" "SIM toggled by the script"
|
||||
|
||||
:local simSlot [/system routerboard modem get sim-slot]
|
||||
|
||||
:if ( $simSlot = "a" ) do={
|
||||
/system routerboard modem set sim-slot=b
|
||||
} else={
|
||||
/system routerboard modem set sim-slot=a
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue