Clearing connections table after the failover connection kicks in

Hi All,

My setup is a Mikrotik, a Netgear Nighthawk 4g Dongle any customer router.

Nighthawk is connected to Ether1 of my Mikrotik.
Customer Router is Connected to Ether5.
Phone system is hosted remotely by provider.

All traffic is routed through the 4g connection, and is to fail over to the customers connection if the 4g connection goes down.
My script checks the connection via the 4g connection every 10 seconds, by pinging 8.8.8.8 through the interface, then changes the route distance accordingly.

I have discovered that the phone isn’t automatically failing over to the other connection because the connection via the 4g is still active in the connections table.

Script:
:if ([/ping 8.8.8.8 interface=WAN count=5] >= 3) do={
/ip route set distance=3 [find comment=“LAN”]} else={
/ip route set distance=1 [find comment=“LAN”]}

ip route distance of 4g route is distance=2.

I need a way to clear the connections table when the connection fails over, but I cannot have this in the current script, as it runs every 10 seconds.
Any ideas?
Thankyou :slight_smile: