SIP Trunks randomly rejected, won't reconnect


(Turrican) #1

I am using FreePBX 15.0.16.49

I have 2 SIP trunks to different providers. Unfortunately from time to time, mainly after an Internet dropout one or both of the trunks become rejected. (pjsip show registration status is rejected)
Simply disabling and enabling the trunk solves the problem. However this cause outages until the problem fixed manually with the mentioned workaround.

[2020-05-18 09:40:23] VERBOSE[18297] res_pjsip/pjsip_configuration.c: Endpoint siphone is now Unreachable
[2020-05-18 09:40:23] VERBOSE[18297] res_pjsip/pjsip_options.c: Contact siphone/sip:XXXXXXXX@sip.s****.com:5060 is now Unreachable. RTT: 0.000 msec
[2020-05-18 09:41:20] VERBOSE[18297] res_pjsip/pjsip_configuration.c: Endpoint siphone is now Reachable
[2020-05-18 09:41:20] VERBOSE[18297] res_pjsip/pjsip_options.c: Contact siphone/sip:XXXXXXXX@sip.s****.com:5060 is now Reachable. RTT: 14.228 msec

Packet capture shows that I receive the following from the service provider:
SIP/2.0 400 Bad request

Do you know by chance why this happens?
Thank you!


#2

Possibly, the router has a bad NAT association that is being kept alive by aggressive retries. In the trunk settings, try setting all 3 retry intervals to 300 (5 minutes). Also, make sure that Max Retries is set to 10000 or more, and Permanent Auth Rejection is No. If no luck, also set Qualify Frequency to 300.

If you still have trouble, confirm that registration is being attempted every 5 minutes and is getting a 400 response each time. Then, look at the request and see if it is actually ok. If so, perhaps your router/firewall is somehow mangling the request. Make/model? Do you have a way to capture traffic on the WAN side?


(Turrican) #3

Hi Stewart

I have the following values:
Permanent Auth Rejection: Yes
Forbidden Retry Interval: 10
Fatal Retry Interval: 0
General Retry Interval: 60
Max Retry: 10000000
Qualify: 60

Firewall is Netgate SG-2440 and I was able to do packet capture on WAN.

I don’t see register sent out in every 5 minutes. Also I checked after 3600 sec but no register sent out.
All I see is that FPBX sends “OPTIONS” in every 60 seconds and receive “400 Bad request” from the provider. I think this is sent because of the qualify = 60.

I have changed the value of Fatal Retry to 10 and after FPBX sent registration message.
The trunk is up and running now.

Thank you for helping me to the right direction.