I have a grandstream I have configured an analog line on and registered to my cloud PBX to provide sip connectivity. The grandstream shows the PJSIP connection as registered, and I can make outbound calls as expected, no issues.
When I try to call in to the extension, FreePBX says the extension is not available (NOANSWER). When I look at Asterisk Info, sure enough it says the extension is unavailable.
Endpoint: 5555555555/5555555555 Unavailable 0 of inf
InAuth: 5555555555-auth/5555555555
Aor: 5555555555 1
Contact: 5555555555/sip: 5555555555@GrandstreamIPAddress b69bc5dacd Unavail nan
When I look at the Asterisk Logs I see over and over:
31624 [2022-09-01 22:16:57] VERBOSE[16200] res_pjsip_registrar.c: Removed contact 'sip: 5555555555@GrandstreamIP: 30092;x-ast-orig-host=PbxIP:6068' from AOR '5555555555' due to remove existing
31625 [2022-09-01 22:16:57] VERBOSE[2005] res_pjsip/pjsip_options.c: Contact 5555555555/sip:#5555555555@ GrandstreamIP:30092;x-ast-orig-host=PbxIP:6068 has been deleted
31626 [2022-09-01 22:16:57] VERBOSE[5619] res_pjsip/pjsip_configuration.c: Endpoint 5555555555 is now Reachable
31627 [2022-09-01 22:16:57] VERBOSE[5619] res_pjsip/pjsip_options.c: Contact 5555555555/sip: 5555555555@GrandstreamIP:54242;x-ast-orig-host=1PbxIP:6068 is now Reachable. RTT: 66.727 msec
31628 [2022-09-01 22:18:00] VERBOSE[16200] res_pjsip/pjsip_configuration.c: Endpoint 5555555555 is now Unreachable
If I happen to get a inbound call in while the number is reachable, it works as expected, so I know the reason this is not working is because FreePBX loses connectivity, but I am not sure where to go from here with my troubleshooting from here.
The grandstream stays registered the whole time and I continue to be able to make outbound calls from the analog phone, no problem.
The grandstream is failing to refresh its registration in time.
1a) You are relying on registration rather than static addresses.
For confirmation, you will need to use βpjsip set logger onβ and look at the REGISTER and OPTIONS requests an their responses. Make sure you use the log file, not a screen scrape, as time stamps are important.
Note that βPJSIP connectionβ really means SIP registration. The Grandstream will not care what software you use to implement SIP.
If you are only seeing OPTIONS, it isnβt registering. If you are only seeing outbound options, you need to find where in the network they, or their responses, are getting lost.
It is registered in the sense that the grandstream reports the lines as registered and I can user the analog phone to make outbound calls no problem.
If I turn off the cloud pbx (responsive) firewall nothing changes, so I guess Iβll start seeing if the local firewall the grandstream sits behind is doing something with the grandstreamβs outbound traffic.
Registration only affects calls towards the analogue phone; itβs about telling the PBX how to reach the ATA, not about authorising the ATA to use the PBX. Thatβs why one way of avoiding the problem is to use static addresses, so that the PBX knows how to contact the ATA without the latter having to register. However, Iβm not sure that FreePBX allows that for extensions.
The only way that the ATA can, legitimately, claim to be registered is if it has sent a REGISTER request and received a response, more recently than the agreed registration timeout. Therefore there should be both REGISTER requests and responses, from which it should be possible to establish the timeout and whether it has expired.
res_pjsip/pjsip_options.c: Contact 5555555555/sip:#5555555555@ GrandstreamIP:30092;x-ast-orig-host=PbxIP:6068 has been deleted||
res_pjsip/pjsip_options.c: Contact 5555555555/sip: 5555555555@GrandstreamIP:54242;x-ast-orig-host=1PbxIP:6068 is now Reachable. RTT: 66.727 msec||
The source port changing from 30092 to 54242 shows that the NAT association was being lost and reestablished.
Please try the following:
In the Grandstream, set Register Expiration to 2 (minutes). In your router/firewall, check that any SIP ALG or similar function is turned off. In FreePBX, set Max Contacts for the extension to 4.
If no luck, please post:
Grandstream model, any non-default settings other than username, password and SIP server. Router/firewall make/model, any VoIP-related settings.
If router/firewall does not have a public IP address on its WAN interface, please explain (ISP gateway configured as router, etc.)
Paste 5 minutes of the Asterisk log (with pjsip logger on) at pastebin.freepbx.org and post the link here.
The expiration to 2 and the max contacts to 4 seems to have fixed it. It is showing available/online on the freepbx side. Iβm asking the network team to check the sip Alg settings still.
Endpoint: 5555555555/5555555555 Not in use 0 of inf
InAuth: 5555555555-auth/5555555555
Aor: 5555555555 4
Contact: 5555555555/sip: 5555555555@PublicIPForGrandstream:30 1b3624878f Unavail nan
Contact: 5555555555/sip: 5555555555@PublicIPForGrandstream:16 709b75fceb Avail 54.792
@Stewart1 so the symptom is the Grandstream is not responding quickly enough to the FreePBX? But do you know if there is a way to resolve this without needing to increase max contacts?
The unstable address, which is likely to be a router or service provider, problem may well be causing OPTIONS to get lost completely, rather than just be delayed.