sipsorcery icon indicating copy to clipboard operation
sipsorcery copied to clipboard

How can I send a keepalive message to the server?

Open RomanPlekhanov opened this issue 3 years ago • 3 comments

Hi! The server is located behind NAT. After some time, during an active conversation, the server terminates the connection due to the absence of incoming packets. Does the sipsorcery send the keepalive itself? If not, how can I do it myself? I use 4.0.51-pre sipsorcery version.

RomanPlekhanov avatar Sep 07 '21 08:09 RomanPlekhanov

I'm guessing you mean for a SIP registration? The simple way would be to reduce the register expiry interval to less than the NAT connection timeout. Try a value of 180 seconds.

Other than that there was NAT keep alive logic in a previous sipsorcery SIP Registrar server, see here. There's currently no equivalent logic in the SIPRegistrationUserAgent, PR's welcome.

sipsorcery avatar Sep 07 '21 20:09 sipsorcery

We tried to set the value using SetExpiry, but it is confused by another value from the header. I attach the wireshark log. https://disk.yandex.ru/d/bHM749PBDfOOjQ

RomanPlekhanov avatar Sep 09 '21 06:09 RomanPlekhanov

We tried to set the value using SetExpiry, but it is confused by another value from the header.

Can you explain what you mean?

In your wireshark trace the client requested an expiry of 600 seconds and the server accepted it. Do you mean the server wouldn't accept vaues below 600? If so that's not unusual, SIP Registrars often set a limit on the minimum expiry time to avoid getting overloaded.

sipsorcery avatar Sep 09 '21 08:09 sipsorcery