Asterisk pjsip nat keep_alive_interval

I’m trying to verify that Asterisk is regularly sending keepalives to keep an open hole in the nat.
I read that a global setting has been implemented for dynamic change of keep alive interval in Asterisk, and that this is set in the global section of pjsip.conf. With command “pjsip show settings” asterisk 13 (also tried asterisk 12 but the same command does not appear to be available there with the same conf setup) confirms that the nonzero setting for keep alives is set to a test value of 30 sec.
Using wireshark to watch for packets I don’t see Asterisk sending any related packets to the registrar. Would a guru kindly indicate what protocol I should filter for to see this activity? pjsip logger does not appear to pick anything up.

The “keep_alive_interval” option is for connection oriented transports such as TCP and TLS. It sends an empty packet over the connection to ensure it remains open.

For connectionless the “qualify_frequency” option on the AOR is used to send a SIP message to keep it open and to measure round trip time.

Thanks, working very nicely. SIP packets now visible in both Wireshark and the pjsip logger.
The setting is not visible from the command “pjsip show settings” but the logger provides both reassurance that things are happening and interval timing.

I just had an opportunity to see if the PJSIP “qualify_frequency” setting would keep the nat open; in my case it does not. This is strange - I can see the requests going out and the 200 OK coming back from the sip server, but the server cannot send me calls. On the same network I have an Snom phone which can be registered as POP to the DID and sends out keep alives; calling out through a separate identity to the DID is routed correctly back to the same phone. This seems to rule out the effect of any intermediate router - if the keep alives work on the Snom then asterisk should be good too. But calls are not routed back.

I’m not sure what other information would be useful to help isolate this issue, but the voip.ms support desk has been very cooperative so far and I am sure would continue to be so. Currently the voip provider has set a parameter to send keep alives from their end, and this so far is keeping the NAT open and calls flowing.

If we’re sending the SIP OPTIONS out at the provided interval and the remote SIP server is acknowledging it then I’m not really sure what else we could be doing. The only thing I could think of would be lowering the interval at which they’re sent as the device doing NAT may be closing it rapidly but that’s just a guess.

Thanks again, Joshua - agreed, it is very puzzling. I also thought of increasing the frequency, and have not tried this simply because as noted above, the Snom phone is able to keep NAT open with a 60 sec interval. This argues that changing the frequency will not help, and indicates that something at the voip provider end is closing down early in a way that I as a user have no control over. It may not be my NAT at all in which case my asterisk is quite innocent of any involvement in the issue. I have no knowledge of the server end port manipulations. I also considered explicitly opening ports in my router but this all just leads to security problems.

In the meantime voip.ms is keeping calls flowing by use of their keep alive, and I propose to leave this in place until they can eliminate their end from the enquiry, at which point I would expect them to provide some clue as to how I can diagnose my end more effectively. I’ll post back if I hear more.