sms-forward: add workaround to fix removal of messages

Removal of messages is broken in RouterOS 7.8:

[admin@MikroTik] > /tool/sms/inbox/remove [ find ]
failure: Interface not running!

Of course the interface is running. Toggling the auto-erase setting
fixes this until next boot. So let's add a workaround...

Reported to support (SUP-110828), but not (yet) acknowledged. 🤨
This commit is contained in:
Christian Hesse 2023-03-23 13:51:52 +01:00
parent 0d4ab1fb3e
commit eab87e4d60

View file

@ -13,9 +13,11 @@
:global Identity;
:global SmsForwardHooks;
:global SmsForwardWorkaround;
:global IfThenElse;
:global LogPrintExit2;
:global RequiredRouterOS;
:global ScriptLock;
:global SendNotification2;
:global SymbolForNotification;
@ -28,6 +30,14 @@ $ScriptLock $0;
$LogPrintExit2 warning $0 ("Receiving of SMS is not enabled.") true;
}
:if ($SmsForwardWorkaround != true && \
[ $RequiredRouterOS $0 "7.8" false ] = true) do={
:local AutoErase [ /tool/sms/get auto-erase ];
/tool/sms/set auto-erase=(!$AutoErase);
/tool/sms/set auto-erase=$AutoErase;
:set SmsForwardWorkaround true;
}
$WaitFullyConnected;
:local Settings [ /tool/sms/get ];