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
474 views 1 comments
by anonymous
Hi,

New user RUTX11 latest Firmware RUTX_R_00.07.02.7; 2 SIM cards installed from different providers (redundancy) with 10GB daily limit each. SIM1 is preferred provider.

We would like to switch from SIM1 to SIM2 only if (daily) limit of 9,5 GB is exceeded, but RUTX11 should switch back automatically every day to SIM1.

SIM1 settings:

automatic switching on data limit, no network/denied and data connection fail; Data limit 9500 MB daily, start hour 9.

SIM2 settings:

automatic switching on no network/denied; switch back to default SIM card after timeout 15 min.

Are the above settings sufficient to achieve this automatically?

EDIT: I forgot to mention that a periodic sim switch change as specified in the wiki (example: 01 09 * * 0-6 sim_switch change) would not help as the sim switch occurs regardless of which SIM is in use.

EDIT 2: I've found question of Apr 18  "sim switch change sim2" does not work, answered by @ricardo.zambrano that this should be fixed by a future firmware upgrade. A few comments before, I read that "ubus call sim change" is a workaround. I will try this today.

EDIT 3: As expected, the "ubus call sim change" does not differentiate between sim 1 or sim2, so I cannot get it to change back to sim 1 only.

So we need a firmware update which allows a crontab "01 09 * * 0-6 sim_switch change sim1". This should result in normal operations if sim1 was still active, and result in a sim switch from sim2 to sim1 if sim2 was active.

Is this possible please?

Kind regards,

1 Answer

0 votes
by anonymous

Hello,

Use ubus call sim get to query about the current active sim, and some scripting to extract and test the value:

set -- $(ubus call sim get|grep sim|cut -d":" -f2)
[ $1 -eq 2 ] && ubus call sim change

The complete crontab entry becomes:

01 09 * * 0-6 set -- $(ubus call sim get|grep sim|cut -d":" -f2); [ $1 -eq 2 ] && ubus call sim change
Regards
by anonymous
Tested this today and it works!

Thank you very much @flebourse