No inbound call on sip trunk

HEllo,
I have installed FreePBX last version . followed wiki and basically outbound calls from pbx to outside over sip trunk it’s working.

Unfortunately inbound calls from are not working.

I have set debug info to on on CLI but I cannot see the attempt to receive the call.

I have taken a tcpdump and I see result below
it seems that freepbx keep answering with
“SIP/2.0 401 Unauthorized”

Any ideea how to investigate further it’s greatly appreciated.
Daniel

INVITE sip:[email protected]:5060 SIP/2.0

Record-Route: <sip:82.76.7.26;lr=on;ftag=gtej7Xy2mHyUS;vst=AAAAAAQBBAMDBQAJDHNAXEMWSiNLH1xTRQBFQQgDCgMANjA->

Via: SIP/2.0/UDP 82.76.7.26;branch=z9hG4bK8222.2a54adb391e4d20adce3b15b0b01975d.0

Via: SIP/2.0/UDP 82.76.7.26:5090;rport=5090;branch=z9hG4bKKZtgyHa8XjBmm

Max-Forwards: 13

From: "0722461594" <sip:[email protected]>;tag=gtej7Xy2mHyUS

To: <sip:[email protected]:5060>

Call-ID: 35c9f0da-3269-1239-d28f-a45d36c5665c

CSeq: 22039868 INVITE

Contact: <sip:[email protected]:5090>

User-Agent: MediaServer

Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE

Supported: timer, path, replaces

Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer

Content-Type: application/sdp

Content-Disposition: session

Content-Length: 296

v=0

o=MediaServer 3314728881 3314728882 IN IP4 82.76.7.26

s=MediaServer

c=IN IP4 82.76.7.26

t=0 0

m=audio 29064 RTP/AVP 8 121 101

c=IN IP4 82.76.7.26

a=rtpmap:8 PCMA/8000

a=rtpmap:121 frf-dialed-digit/8000

a=fmtp:121 0-15

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-16

a=ptime:20

SIP/2.0 401 Unauthorized

Via: SIP/2.0/UDP 82.76.7.26;rport=5060;received=82.76.7.26;branch=z9hG4bK8222.2a54adb391e4d20adce3b15b0b01975d.0

Via: SIP/2.0/UDP 82.76.7.26:5090;rport=5090;branch=z9hG4bKKZtgyHa8XjBmm

Record-Route: <sip:82.76.7.26;lr;ftag=gtej7Xy2mHyUS;vst=AAAAAAQBBAMDBQAJDHNAXEMWSiNLH1xTRQBFQQgDCgMANjA->

Call-ID: 35c9f0da-3269-1239-d28f-a45d36c5665c

From: "0722461594" <sip:[email protected]>;tag=gtej7Xy2mHyUS

To: <sip:[email protected]>;tag=z9hG4bK8222.2a54adb391e4d20adce3b15b0b01975d.0

CSeq: 22039868 INVITE

WWW-Authenticate: Digest realm="asterisk",nonce="1593187320/b3a999ed4398abf8ce94eac62f1ca7a9",opaque="0cce967016a2bc64",algorithm=md5,qop="auth"

Server: FPBX-15.0.16.56(16.6.2)

Content-Length: 0

ACK sip:[email protected]:5060 SIP/2.0

Via: SIP/2.0/UDP 82.76.7.26;branch=z9hG4bK8222.2a54adb391e4d20adce3b15b0b01975d.0

Max-Forwards: 13

From: "0722461594" <sip:[email protected]>;tag=gtej7Xy2mHyUS

To: <sip:[email protected]>;tag=z9hG4bK8222.2a54adb391e4d20adce3b15b0b01975d.0

Call-ID: 35c9f0da-3269-1239-d28f-a45d36c5665c

CSeq: 22039868 ACK

Content-Length: 0

INVITE sip:[email protected]:5060 SIP/2.0

Record-Route: <sip:82.76.7.26;lr=on;ftag=KNtvcFHDcc1Kc;vst=AAAAAAQBBAMDBQAJDHNAXEMWSiNLH1xTRQBFQQgDCgMANjA->

Via: SIP/2.0/UDP 82.76.7.26;branch=z9hG4bK5fe3.ce1bf5c605541a9bff323acbb48012f6.0

Via: SIP/2.0/UDP 82.76.7.26:5090;rport=5090;branch=z9hG4bKpt6t32vjNDecQ

Max-Forwards: 13

From: "0722461594" <sip:[email protected]>;tag=KNtvcFHDcc1Kc

To: <sip:[email protected]:5060>

Call-ID: 35d7c792-3269-1239-d28f-a45d36c5665c

CSeq: 22039868 INVITE

Contact: <sip:[email protected]:5090>

User-Agent: MediaServer

Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE

Supported: timer, path, replaces

Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer

Content-Type: application/sdp

Content-Disposition: session

Content-Length: 296

v=0

o=MediaServer 3314728881 3314728882 IN IP4 82.76.7.26

s=MediaServer

c=IN IP4 82.76.7.26

t=0 0

m=audio 21088 RTP/AVP 8 121 101

c=IN IP4 82.76.7.26

a=rtpmap:8 PCMA/8000

a=rtpmap:121 frf-dialed-digit/8000

a=fmtp:121 0-15

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-16

a=ptime:20

SIP/2.0 401 Unauthorized

Via: SIP/2.0/UDP 82.76.7.26;rport=5060;received=82.76.7.26;branch=z9hG4bK5fe3.ce1bf5c605541a9bff323acbb48012f6.0

Via: SIP/2.0/UDP 82.76.7.26:5090;rport=5090;branch=z9hG4bKpt6t32vjNDecQ

Record-Route: <sip:82.76.7.26;lr;ftag=KNtvcFHDcc1Kc;vst=AAAAAAQBBAMDBQAJDHNAXEMWSiNLH1xTRQBFQQgDCgMANjA->

Call-ID: 35d7c792-3269-1239-d28f-a45d36c5665c

From: "0722461594" <sip:[email protected]>;tag=KNtvcFHDcc1Kc

To: <sip:[email protected]>;tag=z9hG4bK5fe3.ce1bf5c605541a9bff323acbb48012f6.0

CSeq: 22039868 INVITE

WWW-Authenticate: Digest realm="asterisk",nonce="1593187320/b3a999ed4398abf8ce94eac62f1ca7a9",opaque="5d69baec12e7bf26",algorithm=md5,qop="auth"

Server: FPBX-15.0.16.56(16.6.2)

Content-Length: 0

ACK sip:[email protected]:5060 SIP/2.0

Via: SIP/2.0/UDP 82.76.7.26;branch=z9hG4bK5fe3.ce1bf5c605541a9bff323acbb48012f6.0

Max-Forwards: 13

From: "0722461594" <sip:[email protected]>;tag=KNtvcFHDcc1Kc

To: <sip:[email protected]>;tag=z9hG4bK5fe3.ce1bf5c605541a9bff323acbb48012f6.0

Call-ID: 35d7c792-3269-1239-d28f-a45d36c5665c

CSeq: 22039868 ACK

Content-Length: 0

Yes this is basic SIP trunk configuration. It says “Unauthorized” because it does not recognize the incoming call as being related to your trunk. How you associate incoming calls with your trunk is different depending on whether you are using pjsip or chan_sip.

1 Like

Also depends on if you’re using registration or IP authentication.

1 Like

Thank you both for your answers !

Trunk it’s defined as chan_sip .
I guess that I am using registration . I guess that credentials and config string it’s completed well since outgoing ok.

I was guessing / suspecting / digging around NAT configuration . My little NTW setup looks like

Internet (pbx agents) -> pfsense ->192.168.1._ ETH1 ->FreePBX

SIpTrunkPRovider-> ONT box -> 192.168.32._ ETH0->FreePBX

I have declared 2 static routes toward my SIP trunk provider. all ntw setup it’s detected like in picture below in settings>asterisk sip settings.

Thank you for any suggestion.

@billsimon @Igaetz - if you know how to investigate further please tell me

This is my connection string (but again to place calls from freepbx to outside it’s working )

defaultuser=user
secret=pass
host=sip.rcs-rds.ro
fromdomain=sip.rcs-rds.ro
fromuser=user
type=peer
qualify=yes
insecure=port,invite
disallow=all
context=from-trunk
canreinvite=no
allow=alaw&ulaw
nat=yes

and for outgoing

user:[email protected]/pass

I have even tried to put “Allow Anonymous Inbound SIP Calls” - to yes. but still does not accept incoming calls from trunk.

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