I've bumped into a very strange behaviour on a ROS 7.14.3 system yesterday and I wonder if this is by design or a bug:
I have a script in /system/scritps called "telegramSend" that sends the content of a variable "message" to the preconfigured chat with a preconfigured bot token
I wanted the router to send messages when a VPN connection is established and made the following script in the "on-up" section of the PPP profile:
Code: Select all
{
:local remad $"caller-id";
[[:parse [/system script get telegramSend source]] message="Admin VPN login $user from $remad"]
}
This failed miserably. I've spent several hours trying to figure out what was wrong with this and it turned out that the variable substitution in the same line as function execution was preventing the script to complete. So the following modification fixed the problem:
Code: Select all
{
:local remad $"caller-id";
:local msg "Admin VPN login $user from $remad"
[[:parse [/system script get telegramSend source]] message=$msg]
}
Code: Select all
...
/tool fetch url="https://api.telegram.org/bot$botToken/sendmessage\?chat_id=$chatID&text=$message" keep-result=no
...