How can I select a SIM slot based on ICMP detection?

I would like to switch between the primary and backup SIMs based on a ping to a remote server.

When the router cannot reach the remote server, it will switch to the backup sim.

Is there any way to set this up?


The following articles should prove useful for this scenario: