Mikrotik Router SIP Connection Blocked.

Sometimes my SIP device’s don’t register until I delete the connection. The connection to delete is UDP 5060.

Is there are any timer I can change to prevent this happening or renewing the connection from time to time to avoid this problem? Is there a script I can run?

I already changed the: Firewall|Connections|Tracking: UDP Timeout:1d 00:00:00 to 00:01:00. And is not solving the problem.

If I go to Firewall|Connections| I can delete manually that connection and it works, but I need something automatic, instead of doing this for each device in every router…

THX.

have you tried playing with ‘Firewall->Service Ports->sip’ state?

Yes, it is enabled the SIP service on ports 5060 ad 5061.

I have this problem with my SIP connections when one of my gateways fails, lost Internet Connection for a moment, change of IP, etc. and then I need to move the connected SIP connections over to the other interface, or deleting that specific connection and it will reconnect immediately after deleting that “freezed and not Real Connection”. I even can disconnect my SIP device and it still appears that the connection still working… until I do the “IP - Connections - Connection Remove” It will work again as fast as I connect the device again, or if it´s already connected It will work immediately.

THX, for your help.

oh, I see… it’s NAT problem. you may delete connections by something like

/ip firewall connection remove [find where src-address~"\^client's_ip:"]

Thats correct, but the problem is that this is happening very often, and some Routers are in a Remote area, so I want to write a Script in each device, to do this automatically, is there a way instead of doing it manually every time?

Thx.

what if you remove connection while SIP device is in work?..

It will Reconnect automatically, and it will work again in 2 seconds.

2 seconds is too long for periodic action… so you need to determine link reconnection in some way…

I was planning to run this script every 30 minutes or every hour, thats enough for the service they need, and It will keep them connected. But I´m not so sure how to write that script. The time I checked with them right now, and They say it is automatic, they removed the connection and immediately they got the green light on the device, meaning that they are connected again.

Script:

:put [/ip firewall connection remove [/find where src-address~“1.1.2.6”] ]


Where 1.1.2.6 is the src. address and 192.168.2.200 is the Dst. Address.
is that correct?

well, if 192.168.2.200 is the address of your SIP server, then it’s better to use

/ip firewall connection remove [/find where dst-address~"192.168.2.200"]

, I believe

i think there is more going on here that we need to investigate. We have the same issue periodically and a router reboot seems to help it for a few weeks. im wondering if there is a problem with the connection tracking somehow. you shouldnt need to be removing connections manually, especially UDP, they should just flow thru.

changeip, are you using NAT in that config?

yes. worked fine for many years in same config setup, until just recently i replaced this offices x86 with a routerboard. have seen it in multiple locations with routerboards so far, all using nat. typically i assign a sip control port and a range of rtp ports for each phone behind nat so i dont need helpers, etc. same configs, just later versions of MT i am seeing more of this. sip helper disabled cuz it always seems to break things : )

i forgot to mention, it seems to only happen 1 min into the conversation, probably matching the udp timeout setting maybe. will packet sniff and investigate more now that i know others are having same issue.

I thought, canuno’s problem is that when router’s IP changes, it still does NAT to previous IP…

THX for your interest and help. I really appreciate your advice for this issue.

you are welcome =)

There is definately an issue with the Mikrotik maintaining and tracking a SIP connection. Obviously becomes more of an issue with multiple NAT’s. For some reason, different SIP kit seems to manage/handle this better, but we have found that specifically with Quintum kit, everything breaks.

This was my solution, and I run it every 5 minutes through the scheduler… Workaround works and clients satisfied.

:foreach i in=[/ip firewall connection find dst-address~“:5060” protocol~“udp”] do={
/ip firewall connection remove $i
}

HI

We have the same problems and it is only fixed by deleting the connection. I will try this script.

Dolf

I tried the script but it doesn’t work. I did include an ip address. I don’t see anything in my logs te help me find the fault.

Thanks

Dolf