Remove connections via scrip when internet link down

Hi,

I have a question,

Is there any posibility to remove connections via script , when the ppoe descconects? I have a problem with Voip when internet via ppoe disconnect,

I have this for remove connections but I don’t know ho to do when ppoe disconnects

Any advice will be apreciated
/ip firewall connection remove [/ ip firewall connection find dst-address~“x.x.x.x:5060”]

Thank you

In “/ppp profile” you have the option to set “on-up” and “on-down” scripts.

Create a separate profile with your desired scripts, use that profile for your outbound PPPoE session.

Please do some search instead of open new topic.

Is better to close all invalid connections than only the VoIP

http://forum.mikrotik.com/t/script-to-clean-firewall-connections-after-public-ip-changes/135275/5

you can paste this on on-up script on profile used from pppoe-out1, do not change nothing, it retrieve automatically new pppoe ip (can be the same)

:global newIP [:tostr $"local-address"]

/ip fire conn
:foreach idc in=[find where timeout>60 and (!(reply-dst-address~$newIP))] do={
 remove [find where .id=$idc]
}