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
1,495 views 10 comments
by anonymous
Is it possible to switch sim using UCI?
by anonymous
Peasant,

thanks! Where may I find the list of supported procedures?

1 Answer

0 votes
by anonymous

Greetings,

Yes, you can switch to another sim by following these commands. 

uci set simcard.@sim[0].primary=1

uci set simcard.@sim[1].primary=0

uci commit simcard

luci-reload

/etc/init.d/simcard restart

I hope this helps.

EB.

by anonymous
Well, this is to change default SIM. But I thought there's an API to execute `switch_sim` though
by anonymous
Hi again,

sim_switch is automatic service that lets you switch between sim cards on special actions. It won't help you in manually switching sim card through uci. As you see, the router will always seek its primary/default sim, and only if it's inactive it will switch to secondary, that is why it's easier to set secondary sim as default sim and see it as a "switch".

EB.
by anonymous
ErnestasB, If I send SMS with `switch_sim` it changes operator/network and stays on it until I switch it back or network connection is failing. For my use case, it is nice to switch it like that because of traffic shaping after 3 Gigabytes limit. There is no such condition in RUTX11 to switch sim by speed limit so I'm thinking of writing a script for that...
by anonymous
Is UCI necessary for your solution or I can offer you another way around with SSH?
by anonymous

SSH is fine as I was using it anyway:

$ ssh root@192.168.1.1 uci get wireless.@wifi-iface[0].ssid

RUT_88D7_2G

by anonymous
Would you provide me an example?
by anonymous

As you're already using SMS utilities to switch sim cards, I can offer you this solution

gsmctl -S -s "YourRouterPhoneNumber admin01 switch_sim"

instead of YourRouterPhoneNumber insert your sim card phone number with country code starting like 00366xxxxx or for example 003706xxxxxx, then instead of admin01 use your own admin password that you use on the router. 

This command will send SMS from your active sim card in the router back to itself and will switch sim cards. Just keep in mind, that after a switch, if you want to switch back, you will have to use your other sim card phone number to send and receive SMS.

EB.

by anonymous
Thanks, but if I can SSH the device I see no reason of using SMS - there should be an API... Is there any other way of doing it?
by anonymous

Hello,

Take a look at this page: https://wiki.teltonika-networks.com/view/RUT955_Monitoring_via_JSON-RPC_windows

Guide is for RUT955, but it is also applicable to RUTx11, just use username: admin instead of root when generating a token.