Ernstm
1
Hi
Please could someone assist me with this?
I need script to remove sip connections every hour. I have tried the following
/ip firewall connection remove [/ip firewall connection find where connection-type=sip]
I also tried to mark the connections and then
/ip firewall connection remove [/ip firewall connection find where connection-mark=SIP]
Also tried — /ip firewall connection remove numbers=[/ip firewall connection find where connection-mark=SIP]
and — /ip firewall connection remove numbers=[/ip firewall connection find where connection-type=sip]
None of these have any effect.
Please can someone show me what I am doing wrong?
Thanks
Jotne
2
What is the output of:
:put [/ip firewall connection find where connection-type=sip]
and
:put [/ip firewall connection find where connection-mark=SIP]
If its more than one, you may need to loop trough it.
pudl
3
I am using this script for removing rogue SIP connections:
:global SIP [ /ip firewall connection find where connection-type=sip and assured=no ];
:global SRC [ /ip firewall connection get $SIP src-address ];
:global DST [ /ip firewall connection get $SIP dst-address ];
:global currentSIP [ :toarray $SIP ];
:global message "SIP - delete non-assured connections: SRC:$SRC DST:$DST";
:if ( $currentSIP="" ) do={
/log info "SIP - no non-assured connections"
} else={
/ip firewall connection remove $currentSIP;
# /tool e-mail send server=******** user=******** password=******* to=******** body=$message;
/log info "SIP - delete non-assured connections: SRC:$SRC DST:$DST";
/tool e-mail send to="*********" subject="SIP!" body=$message;
}
}
I set the scheduler to run it every 3 minutes.