I am trying to create a Scheduler on startup to switch between sim slots 2 and 3.
Basically what will happen :
I have 2 Sim Cards with Different Providers in Slots 2 and 3.
I also have watchdog pinging a server online. If watchdog fails (because LTE Tower is down, or connection is broken, or the are out of data), the router reboots.
On reboot, the startup scheduler script needs to see if the LTE sim is currently on slot 2, and switch to slot3,
and also the opposite (if it was on slot3, must switch to slot2). This will make it switch to the 2nd Provider automatically.
I was trying to make up a a script, but if I tell it :
/interface lte settings get sim-slot
it does not give me any result (even just in the terminal)
but if I go
/interface lte settings print
Then it gives me
mode: auto
firmware-path: firmware
sim-slot: 2
So, for some reason the get command is not returning a result, which means my script will not be able to detect what is the current sim slot.
But I can control the sim slot using the set command fine.
Now I have Netwatch calling this script whenever it sees no connectivity to the Internet (i.e. 8.8.8.
Netwatch will start checking 5 minutes after startup, and checks every 5 minutes. If it sees a failure, the script switches over to backup sim.
{
global simSlot [/interface lte settings get sim-slot]
:log warning message=“Connectivity Test Failed, Switching to Alternate”
if ($simSlot=“2”) do={
:log warning message=“Current Simslot is 2 - Telkom”
:log warning message=“Switching to Simslot 3 - Vodacom”
/interface lte settings set sim-slot=3
}
if ($simSlot=“3”) do={
:log warning message=“Current Simslot is 3 - Vodacom”
:log warning message=“Switching to Simslot 2 - Telkom”
/interface lte settings set sim-slot=2
}
}
If it doesn’t come up on the 2nd link, then the Watchdog will restart the router within 15 minutes.
When the Router restarts, I have a startup schedule that sets the Sim card back to the Primary.
So, if the Internet goes down, in less than 5 minutes, Netwatch would see it, and switch over to the Backup sim.
If the Backup sim also does not have connectivity (I.E. Both Providers Towers are down), then Watchdog will restart the router shortly thereafter, and it will revert to the Primary Sim card, and repeat the cycle.
The Watchdog is just as a backup in case the LTE Modem freezes, or some other unforseen problem.
I could modify the system, so that it will keep on toggling automatically between the Primary and Secondary until it gets a connection, but this will suit the client fine.