Repeating connections and disconnections on trunks only - why?

I am trying to figure out why on my PJSIP trunks do I get repeating connections and disconnections like this:

[2022-03-14 16:14:17]   == Endpoint XXXX-PJSIP is now Unreachable
[2022-03-14 16:14:17]     -- Contact XXXX-PJSIP/sip:[email protected] is now Unreachable.  RTT: 0.000 msec
[2022-03-14 16:15:14]   == Endpoint XXXX-PJSIP is now Reachable
[2022-03-14 16:15:14]     -- Contact XXXX-PJSIP/sip:[email protected] is now Reachable.  RTT: 147.001 msec

[2022-03-14 16:31:17]   == Endpoint XXXX-PJSIP is now Unreachable
[2022-03-14 16:31:17]     -- Contact XXXX-PJSIP/sip:[email protected] is now Unreachable.  RTT: 0.000 msec
[2022-03-14 16:33:14]   == Endpoint XXXX-PJSIP is now Reachable
[2022-03-14 16:33:14]     -- Contact XXXX-PJSIP/sip:[email protected] is now Reachable.  RTT: 147.001 msec

This seems to happen about once every 16-17 minutes on each affected trunk but Expiration is set to 3600 seconds (one hour) so I don’t get it. Is there a different setting I should be looking at?

My guess is that your router kills the connection after 15 minutes (default UDP/TCP timeout, or something like this). Try a lower value, like 5 minutes and see if it still happens

I tried setting it down to 120 seconds but it does the same thing at about the same interval. Really am puzzled by this one.

If it’s consistently around 15min this probably won’t help but try change qualify frequency from 60 to 45s in pjsip Settings > Advanced. If that doesn’t work, try set it to 0 to disable qualify and create a forward route for that SIP providers IP(s) to your PBX, if practical/possible.

I tried setting qualify to 45 and that did not help. Then I set it to 0 and the messages went away. I tried a test call and it worked but I don’t know if the problem still exists and I am just hiding it, or if this really solved the problem.

I am not sure what you mean by “create a forward route for that SIP providers IP(s) to your PBX” but I am connecting to the IP address of the systems in question. Anyway guess I will see if this works or not. I had never noticed any issue with outgoing calls so my suspicion is maybe qualify was seeing a problem that didn’t really exist? But then again this is a very low-usage system so a lot of intermittent issues could go unnoticed for a long time.

Hard to tell. When a contact becomes ‘unreachable’, that means Asterisk sent an OPTIONS SIP packet and did not receive a response. By disabling qualify, you just stopped sending OPTIONS packets. Lack of response to OPTIONS is can be indicative of wider SIP signaling issues, but it may well be that this contact just doesn’t deal with OPTIONS well in which case you may have solved the problem. There may be a further issue if the PBX is behind NAT without signaling port forwarding, the OPTIONS will not serve to keep the connection alive, so you will need to rely on the SIP REGISTER to do that.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.