Analog Phone > Grandstream > Cloud PBX

FreePBX/Asterisk 16

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.

Any ideas? Thanks!

  1. 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.

1 Like

The grandstream is DHCP, but the public address it is coming from is a static address.

I enabled β€œpjsip set logger on”

This is what I got from the full Asterisk log:

<--- Transmitting SIP request (522 bytes) to UDP:GrandstreamPublicIP:2192 --->
OPTIONS sip:5555555555@GrandstreamPublicIP:2192;x-ast-orig-host=192.168.120.31:6068 SIP/2.0
Via: SIP/2.0/UDP PbxIP:5060;rport;branch=z9hG4bKPjf0e4227f-373d-4853-8cce-2db4a1687b6b
From: <sip: 5555555555@GrandstreamPublicIP>tag=95d2773e-137a-4f2a-99c2-91d705dcbe9b
To: <sip: 5555555555@GrandstreamPublicIP;x-ast-orig-host=192.168.120.31:6068>
Contact: <sip:5555555555@PbxIP:5060>
Call-ID: ffe07c6c-4782-46ad-8541-10d84197f757
CSeq: 43930 OPTIONS
Max-Forwards: 70
User-Agent: FPBX-16.0.21.9(16.8)
Content-Length: 0

I also used sngrep and only saw Options messages over and over again (11 messages).

**OPTIONS** **sip:5555555555@GrandstreamPublicIP:2192**;x-ast-orig-host=192.168.120.31:6068 SIP/2.0

**PbxIP:5060** GranstreamPublicIP:2192β”‚Via: SIP/2.0/UDP 
PbxIP:5060;rport;branch=z9hG4bKPj8e63cc65-6bac-463e-b016-8de959f6b250
──────────┬───────── ──────────┬─────────│From: <sip:5555555555@PbxIP>tag=04c903ea-7ba0-4c15-8042-7b136ad04129

β”‚ OPTIONS β”‚ β”‚To: <sip:5555555555@GrandstreamPublicIP;x-ast-orig-host=192.168.120.31:6068>

21:05:31.846037 β”‚ ──────────────────────────> β”‚ β”‚Contact: <sip:5555555555@PbxIP:5060>

+0.500331 β”‚ OPTIONS β”‚ β”‚Call-ID: **6d58152b-656e-4bee-8507-f55b5df28fe1**

21:05:32.346368 β”‚ ────────────────────────>>> β”‚ β”‚CSeq: 38984 OPTIONS

+0.999505 β”‚ OPTIONS β”‚ β”‚Max-Forwards: 70

21:05:33.345873 β”‚ ────────────────────────>>> β”‚ β”‚User-Agent: FPBX-16.0.21.9(16.8)

+2.000220 β”‚ OPTIONS β”‚ β”‚Content-Length: 0

21:05:35.346093 β”‚ ────────────────────────>>> β”‚ β”‚

What do you think?

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.

DHCP and static addresses are not incompatible.

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.

Thanks!

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.

1 Like
 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.

1 Like

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?

Max contacts isn’t addressing slow responses; it is addressing a situation where the contact address is unstable.

@david55 do you know what the issue might be?

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.

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