PJSIP trunk with 2N GSM GW

Hello to all!
I’m new with FreePBX but need to configure trunk between my FreePBX and GSM GW.
It works fine with old asterisk but this PJSIP driving me crazy.

This GSM GW trying to send register messages to FreePBX but What I see is only this warning:
[2022-03-07 11:42:15] WARNING[8694]: res_pjsip_registrar.c:1116 registrar_on_rx_request: AOR ‘gsmgw’ has no configured max_contacts. Endpoint ‘gsmgw’ (192.168.5.35:5060) unable to register
In FreePBX I have set allow only PJSIP and give it port 5060 in Settings - Asterisk SIP Settings - SIP Settings [chan_pjsip] - udp - 0.0.0.0 - All set to yes, Ports to Listen On set to 5060

And in Settings - Advanced Settings I have SIP channel Driver set to chan_pjsip.

My trunk settings:
General:
Trunk Name: gsmgw

pjsip Settings:
General:
Secret: secret
Authentication: Both
Registration: None
SIP Server: "192.168.5.35"
SIP Server Port: 5060
Context: from-pstn

Everything else lefted to defaults.

And I can see this:

<--- Received SIP request (712 bytes) from UDP:192.168.5.35:5060 --->
REGISTER sip:192.168.5.103:5060 SIP/2.0
Max-Forwards: 70
Via: SIP/2.0/UDP 192.168.5.35:5060;branch=z9hG4bK-23562118759213
From: <sip:[email protected]>;tag=7c1eb301983c-23126-7141f2d
To: <sip:[email protected]:5060>
Call-ID: [email protected]
CSeq: 23535 REGISTER
Contact: <sip:[email protected]:5060;user=phone;phone-context=gsmgw>
Authorization: Digest username="gsmgw",realm="asterisk",nonce="something",uri="sip:192.168.5.103",qop=auth,nc=00000001,cnonce="some_number",response="another_sequence",opaque="another_hexa",algorithm=MD5
Expires: 600
User-Agent: 2N VBN 1.36.2.39.2
Content-Length: 0


<--- Transmitting SIP response (378 bytes) to UDP:192.168.5.35:5060 --->
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 192.168.5.35:5060;rport=5060;received=192.168.5.35;branch=z9hG4bK-23562118759213
Call-ID: [email protected]
From: <sip:[email protected]>;tag=7c1eb301983c-23126-7141f2d
To: <sip:[email protected]>;tag=z9hG4bK-23562118759213
CSeq: 23535 REGISTER
Server: FPBX-15.0.22(16.20.0)
Content-Length:  0

[2022-03-07 11:42:15] WARNING[8694]: res_pjsip_registrar.c:1116 registrar_on_rx_request: AOR 'gsmgw' has no configured max_contacts. Endpoint 'gsmgw' (192.168.5.35:5060) unable to register

Why it has no configured max_contacts? Everywhere else it is automaticly configured to 1 why not there?

Or maybe more generel question:
What should I change in settings to make it work? In my desperate mood I tried mostly every possible variation of trunk setting :smiley:

But always the result was somekind of error or warning :smiley:

Please help, thanks to all.
Alex

Either set the GW to not register (each side statically configured with the address of the other), or set Registration Receive for the trunk.

Hello Stewart,
thanks for reply.
I changed the setting of Registration parameter to Receive.
Now I don’t getting any error.

But Incoming call had been presented as anonymous and not as gsmrgw. Why?

 Executing [[email protected]:1] NoOp("PJSIP/anonymous-00000027", "Received incoming SIP connection from unknown peer to 8101") in new stack
    -- Executing [[email protected]:2] Set("PJSIP/anonymous-00000027", "DID=8101") in new stack
    -- Executing [[email protected]:3] Goto("PJSIP/anonymous-00000027", "s,1") in new stack
    -- Goto (from-sip-external,s,1)
    -- Executing [[email protected]:1] GotoIf("PJSIP/anonymous-00000027", "1?setlanguage:checkanon") in new stack
    -- Goto (from-sip-external,s,2)
    -- Executing [[email protected]:2] Set("PJSIP/anonymous-00000027", "CHANNEL(language)=en") in new stack
    -- Executing [[email protected]:3] GotoIf("PJSIP/anonymous-00000027", "1?noanonymous") in new stack
    -- Goto (from-sip-external,s,5)
    -- Executing [[email protected]:5] Set("PJSIP/anonymous-00000027", "TIMEOUT(absolute)=15") in new stack
    -- Channel will hangup at 2022-03-07 15:36:18.954 UTC.
    -- Executing [[email protected]:6] Set("PJSIP/anonymous-00000027", "receveip=pjsip,remote_addr") in new stack
    -- Executing [[email protected]:7] Log("PJSIP/anonymous-00000027", "WARNING,"Rejecting unknown SIP connection from 192.168.5.35:5060"") in new stack
[2022-03-07 15:36:03] WARNING[29794][C-0000001c]: Ext. s:7 @ from-sip-external: "Rejecting unknown SIP connection from 192.168.5.35:5060"
    -- Executing [[email protected]:8] Answer("PJSIP/anonymous-00000027", "") in new stack
       > 0x7f76fc125280 -- Strict RTP learning after remote address set to: 192.168.5.35:8042

Same problem for me as well.

I thought I solved this problem.
When I set:

My trunk settings:
General:
Trunk Name: gsmgw

pjsip Settings:
General:
Secret: secret
Authentication: Outbound
Registration: None
SIP Server: "192.168.5.35"
SIP Server Port: 5060
Context: from-trunk-custom

It appears in pjsip show aors:

Aor:  gsmgw                                            0
Contact:  gsmgw/sip:[email protected]:5060;us 78b82bbcf2 Avail         3.567
Contact:  gsmgw/sip:[email protected]:5060    40e396056f Avail         5.822

and everything works just fine. But only for a while. After that this WARNING appears:

WARNING[8451]: res_pjsip_registrar.c:1116 registrar_on_rx_request: AOR 'gsmgw' has no configured max_contacts. Endpoint 'gsmgw' (192.168.5.35:5060) unable to register
    -- Removed contact 'sip:[email protected]:5060;user=phone;phone-context=gsmgw' from AOR 'gsmgw' due to expiration
  == Contact gsmgw/sip:[email protected]:5060;user=phone;phone-context=gsmgw has been deleted

Why is this happen and how to prevent to this happen?

FreePBX is an implementation of a ‘Public Branch eXchange’, as such it is well setup to handle Phone numbers limited to [0-9] (but not letters), best that you have your gateway provide a numerical identification of your destination because ‘gsmgw’ is not numeric.

You could however write a custom context to re-write ‘gsmgw’ to an identifiable endpoint within FreePBX though. which apparently you have done, so show us your

[from-trunk-custom]

This is not true at all. I have used endpoints with non-numeric names and had no problems.

The error explained the issue clearly. The endpoint is set for inbound registrations and needs the max_contacts set for the AOR. That is missing. Set it to 1 and error goes away.

Because an extension has the expectation of inbound registers while trunks have expectations of outbound. You are using a trunk for inbound, you need to set it.

OK, I think I finally have it!

In Config Edit → pjsip.aor_custom_post.conf I added:

[gsmgw](+type=aor)
 contact=sip:[email protected]:5060
 max_contacts=1

now I can see in pjsip show aors

Aor:  gsmgw                                            0
Contact:  gsmgw/sip:[email protected]:5060;us 78b82bbcf2 Avail         3.567
Contact:  gsmgw/sip:[email protected]:5060    40e396056f Avail         5.822

And It’s stable and I can call in both ways.

So is it OK that I have two lines for same trunk or should I do it diffrent way?

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