FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
364 views 1 comments
by anonymous

Hello,

I have a RUTX12 with firmware RUTX_R_00.07.03.1.

I am testing the creation of SMS utilities custom rule with "Execute custom script" action.

If I create a new rule with "SMS text" set to "toto", the rule is triggered by sending sms with "toto" content but also by any sms that starts with "toto". It is very tempting to use that behavior to send parameters to the custom shell script itself :-)

I haven't been able to get the original sms content to parse it. I tried basic "$*", "$1", ... shell variables but they are empty. I also tried to get the sms using gsmctl -S -t and gsmctl -S -r N but sms handled with sms rules does not seems to be saved.

It seems to be possible, as "uci" rules does it, but it is a built-in rule. So my question is, is it possible to get the sms "parameters" or the full sms content in the shell script of a "Execute custom script" ? If so, how to do it ?

Thanks for your help.

2 Answers

0 votes
by anonymous
Since version RUTX_R_00.07.04, you can get arguments using $1, $2, ...

It is working great, thank you for adding this feature.
Best answer
+1 vote
by anonymous

Hello,

I've tested this out and while that is the case, it would be very hard to actually utilize this to pass extra arguments. This is because after receiving an SMS that matches one of the SMS rules, it automatically gets deleted afterward.

One way this theoretically could be achieved is by setting the SMS storage limit to 1 and creating an SMS rule, that would trigger a separate shell script. This script would be waiting for a new message to arrive (by periodically checking the output of command ubus call gsm.modem0 read_sms '{"index":1}' ). Then the user would send an SMS with the command that should be executed, and the running script would execute it.

I've not tried this and I'm sure there would be a lot of issues to overcome.

Thankfully, this feature is currently in the progress of being implemented and should appear in v7.4 of RutOS if all goes according to plan.

Best regards,
DaumantasG

by anonymous
Hello,

The workaround seems a bit complicated for a few months until the release. I will rework my use cases to simplify them and duplicates custom rules in the mean time.

Thank you for your help.