Skype for Business 2019 Trunk settings

Hi,

I’m having some issues with my sip trunk settings.

The infrastructure I’m working with right now has one FreePBX VM and a Skype for Business 2019 VM in the same subnet with no firewalls in between.

I am able to make calls from the FreePBX to Skype for business users, but no the other way around so I figured the problem is with the peer details.

Here’s what I have:

host=IP of skype for business server
transport=tcp
type=friend
qualify=yes
promiscredir=yes
port=5060
insecure=very
canreinvite=yes
context=from-internal

When I go on the FreePBX cli, and do a sip show peers, the skype for business server shows as OK, but when I attempt to make a call from Skype to FreePBX, it show the following error:

Ext. s:6 @from-sip-external: “Rejecting unknown SIP connection from *IP of Skype for Business”.

Anyone has any idea what setting I would need to use or if something else is blocking it?

Thanks

Make this type=peer

With default settings, pjsip binds to port 5060 and chan_sip to port 5160. If SFB is statically configured to send calls to your port 5060, they will reach the pjsip driver and (unless you also have a pjsip trunk configured for SFB) will be rejected as unknown.

I changed the type to peer as you said, but it’s still rejecting the call.

So Chan_SIP is listening on what port and what port is Skype trying to send calls to?

I forgot to say that I did manually change the chan_sip bind port to 5060 on FreePBX, but it’s still rejecting the call.

OK then, so now you need to get into the Asterisk console and run a debug.

  1. SSH into the box
  2. Do: asterisk -r
  3. Do: sip set debug on
  4. Make call
  5. Copy and paste the output from the start of the call to the end here so we can review it.

This parameter was used in older versions of Asterisk. I am not sure whether it still works in current versions (it was deprecated long ago). The current equivalent would be “insecure=port,invite”

That should allow the incoming calls to match your trunk based on IP address alone.

Here’s the output:

<— SIP read from TCP:S4B IP:62176 —>
INVITE sip:4000@freepbx.domain;user=phone SIP/2.0
FROM: “testuser”<sip:0456@ domain;user=phone>;epid=1A2512F9FC;tag=18a78fc448
TO: <sip:4000@ freepbx.domain;user=phone>
CSEQ: 4523 INVITE
CALL-ID: d627a246-603e-4973-8bb3-2f18db70bf60
MAX-FORWARDS: 70
VIA: SIP/2.0/TCP S4B IP:62176;branch=z9hG4bKd315c5f
CONTACT: <sip:S4B IP.domain:5060;transport=Tcp;maddr=S4B IP;ms-opaque=2bd72463f49d1de5>
CONTENT-LENGTH: 336
SUPPORTED: 100rel
USER-AGENT: RTCC/7.0.0.0 MediationServer
CONTENT-TYPE: application/sdp
ALLOW: ACK
Allow: CANCEL,BYE,INVITE,PRACK,UPDATE

v=0
o=- 74 1 IN IP4 S4B IP
s=session
c=IN IP4 S4B IP
b=CT:1000
t=0 0
m=audio 56668 RTP/AVP 97 101 13 0 8
c=IN IP4 S4B IP
a=rtcp:56669
a=label:Audio
a=sendrecv
a=rtpmap:97 RED/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtpmap:13 CN/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=ptime:20
<------------->
— (14 headers 18 lines) —
Sending to S4B IP:62176 (no NAT)
Sending to S4B IP:62176 (no NAT)
Using INVITE request as basis request - d627a246-603e-4973-8bb3-2f18db70bf60
No matching peer for ‘0456’ from ‘S4B IP:62176’
Found RTP audio format 97
Found RTP audio format 101
Found RTP audio format 13
Found RTP audio format 0
Found RTP audio format 8
Found unknown media description format RED for ID 97
Found audio description format telephone-event for ID 101
Found audio description format CN for ID 13
Found audio description format PCMU for ID 0
Found audio description format PCMA for ID 8
Capabilities: us - (ulaw|alaw|gsm|g726|g722), peer - audio=(ulaw|alaw)/video=(nothing)/text=(nothing), combined - (ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x3 (telephone-event|CN|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port S4B IP:56668
Looking for 4000 in from-sip-external (domain freepbx.domain)
sip_route_dump: route/path hop: <sip:S4B IP.domain:5060;transport=Tcp;maddr=S4B IP;ms-opaque=2bd72463f49d1de5>

<— Transmitting (no NAT) to S4B IP:62176 —>
SIP/2.0 100 Trying
Via: SIP/2.0/TCP S4B IP:62176;branch=z9hG4bKd315c5f;received=S4B IP
From: “testuser”<sip:0456@ domain;user=phone>;epid=1A2512F9FC;tag=18a78fc448
To: <sip:4000@ freepbx.domain;user=phone>
Call-ID: d627a246-603e-4973-8bb3-2f18db70bf60
CSeq: 4523 INVITE
Server: FPBX-14.0.13.4(13.22.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:4000@SIP Phone IP:5060;transport=tcp>
Content-Length: 0

<------------>
[2019-07-29 12:10:17] WARNING[11180][C-00000002]: Ext. s:6 @ from-sip-external: “Rejecting unknown SIP connection from S4B IP
Audio is at 10008
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP

<— Reliably Transmitting (no NAT) to S4B IP:62176 —>
SIP/2.0 200 OK
Via: SIP/2.0/TCP S4B client IP:62176;branch=z9hG4bKd315c5f;received=S4B client IP
From: “testuser”<sip:0456@ domain;user=phone>;epid=1A2512F9FC;tag=18a78fc448
To: <sip:4000@ freepbx.domain;user=phone>;tag=as638452aa
Call-ID: d627a246-603e-4973-8bb3-2f18db70bf60
CSeq: 4523 INVITE
Server: FPBX-14.0.13.4(13.22.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:4000@FREEPBX IP:5060;transport=tcp>
Content-Type: application/sdp
Content-Length: 274

v=0
o=root 1635555308 1635555308 IN IP4 FreePBX IP
s=Asterisk PBX 13.22.0
c=IN IP4 FreePBX IP
t=0 0
m=audio 10008 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<------------>

<— SIP read from TCP:SIP Phone IP:11844 —>
REGISTER sip:freepbx.domain:5060 SIP/2.0
Via: SIP/2.0/TCP SIP Phone IP:5060;branch=z9hG4bK958848065
From: “3000” <sip:3000@ freepbx.domain:5060>;tag=2404835808
To: “3000” <sip:3000@ freepbx.domain:5060>
Call-ID: 0_2956647971@SIP IP Phone
CSeq: 91 REGISTER
Contact: <sip:3000@SIP Phone IP:5060;transport=TCP>
Authorization: Digest username=“3000”, realm=“asterisk”, nonce=“66419d8a”, uri=“sip:freepbx.domain:5060”, response=“578205542d3652b507594c3f8935a134”, algorithm=MD5
Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
Max-Forwards: 70
User-Agent: Yealink W60B 77.83.0.25
Expires: 180
Allow-Events: talk,hold,conference,refer,check-sync
Content-Length: 0

<------------->
— (14 headers 0 lines) —
Sending to SIP Phone IP:5060 (no NAT)
Sending to SIP Phone IP:5060 (no NAT)

<— Transmitting (no NAT) to 10.50.2.109:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/TCP SIP Phone IP:5060;branch=z9hG4bK958848065;received=10.50.2.109
From: “3000” <sip:3000@ freepbx.domain:5060>;tag=2404835808
To: “3000” <sip:3000@ freepbx.domain:5060>;tag=as01cceb98
Call-ID: 0_2956647971@SIP IP Phone
CSeq: 91 REGISTER
Server: FPBX-14.0.13.4(13.22.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce=“66310148”
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘0_2956647971@SIP Phone IP’ in 32000 ms (Method: REGISTER)

<— SIP read from TCP: SIP Phone IP:11844 —>
REGISTER sip:freepbx.domain:5060 SIP/2.0
Via: SIP/2.0/TCP SIP Phone IP:5060;branch=z9hG4bK1463243007
From: “3000” <sip:3000@ freepbx.domain:5060>;tag=2404835808
To: “3000” <sip:3000@ freepbx.domain:5060>
Call-ID: 0_2956647971@ SIP IP Phone
CSeq: 92 REGISTER
Contact: <sip:3000@SIP Phone IP:5060;transport=TCP>
Authorization: Digest username=“3000”, realm=“asterisk”, nonce=“66310148”, uri=“sip:freepbx.domain:5060”, response=“5a0a8133a1358c642bce97208ae8ba60”, algorithm=MD5
Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
Max-Forwards: 70
User-Agent: Yealink W60B 77.83.0.25
Expires: 180
Allow-Events: talk,hold,conference,refer,check-sync
Content-Length: 0

<------------->
— (14 headers 0 lines) —
Sending to SIP Phone IP:5060 (no NAT)
Reliably Transmitting (no NAT) to SIP Phone IP:5060:
OPTIONS sip:3000@SIP Phone IP:5060;transport=TCP SIP/2.0
Via: SIP/2.0/TCP FreePBX IP:5060;branch=z9hG4bK23ec7a52
Max-Forwards: 70
From: “Unknown” <sip:Unknown@FreePBX IP>;tag=as0c5c1cd1
To: <sip:3000@SIP Phone IP:5060;transport=TCP>
Contact: <sip:Unknown@FreePBX IP:5060;transport=tcp>
Call-ID: 251a842643448a816502125c563e9b9f@FreePBX IP:5060
CSeq: 102 OPTIONS
User-Agent: FPBX-14.0.13.4(13.22.0)
Date: Mon, 29 Jul 2019 16:10:17 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<— Transmitting (no NAT) to SIP Phone IP:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/TCP SIP Phone IP:5060;branch=z9hG4bK1463243007;received=SIP Phone IP
From: “3000” <sip:3000@ freepbx.domain:5060>;tag=2404835808
To: “3000” <sip:3000@ freepbx.domain:5060>;tag=as01cceb98
Call-ID: 0_2956647971@SIP Phone IP
CSeq: 92 REGISTER
Server: FPBX-14.0.13.4(13.22.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Expires: 180
Contact: <sip:3000@SIP Phone IP:5060;transport=TCP>;expires=180
Date: Mon, 29 Jul 2019 16:10:17 GMT
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘0_2956647971@SIP Phone’ in 32000 ms (Method: REGISTER)

<— SIP read from TCP:SIP Phone:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/TCP FreePBX IP:5060;branch=z9hG4bK23ec7a52
From: “Unknown” <sip:Unknown@FreePBX IP>;tag=as0c5c1cd1
To: <sip:3000@SIP phone:5060;transport=TCP>;tag=3094584608
Call-ID: 251a842643448a816502125c563e9b9f@FreePBX IP:5060
CSeq: 102 OPTIONS
User-Agent: Yealink W60B 77.83.0.25
Content-Length: 0

<------------->
— (8 headers 0 lines) —

<— SIP read from TCP: S4B IP:62176 —>
ACK sip:4000@FreePBX IP:5060;transport=tcp SIP/2.0
FROM: <sip:0456@ domain;user=phone>;epid=1A2512F9FC;tag=18a78fc448
TO: <sip:4000@ freepbx.domain;user=phone>;tag=as638452aa
CSEQ: 4523 ACK
CALL-ID: d627a246-603e-4973-8bb3-2f18db70bf60
MAX-FORWARDS: 70
VIA: SIP/2.0/TCP S4B IP:62176;branch=z9hG4bKbbf4eb81
CONTENT-LENGTH: 0
USER-AGENT: RTCC/7.0.0.0 MediationServer

<------------->
— (9 headers 0 lines) —
Really destroying SIP dialog ‘251a842643448a816502125c563e9b9f@FreePBX IP:5060’ Method: OPTIONS

<— SIP read from TCP:SIP phone:11844 —>

<------------->

<— SIP read from TCP: S4B IP:62176 —>
BYE sip:4000@ S4B IP:5060;transport=tcp SIP/2.0
FROM: <sip:0456@ domain;user=phone>;epid=1A2512F9FC;tag=18a78fc448
TO: <sip:4000@ freepbxdomain;user=phone>;tag=as638452aa
CSEQ: 4524 BYE
CALL-ID: d627a246-603e-4973-8bb3-2f18db70bf60
MAX-FORWARDS: 70
VIA: SIP/2.0/TCP S4B IP:62176;branch=z9hG4bKdb834c9
CONTACT: <sip: S4B IP.domain:5060;transport=Tcp;maddr= S4B IP>
CONTENT-LENGTH: 0
USER-AGENT: RTCC/7.0.0.0 MediationServer

<------------->
— (10 headers 0 lines) —
Sending to S4B IP:62176 (no NAT)
Scheduling destruction of SIP dialog ‘d627a246-603e-4973-8bb3-2f18db70bf60’ in 32000 ms (Method: BYE)

<— Transmitting (no NAT) to S4B IP:62176 —>
SIP/2.0 200 OK
Via: SIP/2.0/TCP S4B IP:62176;branch=z9hG4bKdb834c9;received=S4B IP
From: <sip:0456@ domain;user=phone>;epid=1A2512F9FC;tag=18a78fc448
To: <sip:4000@ freepbx.domain;user=phone>;tag=as638452aa
Call-ID: d627a246-603e-4973-8bb3-2f18db70bf60
CSeq: 4524 BYE
Server: FPBX-14.0.13.4(13.22.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

<------------>
Really destroying SIP dialog ‘e0373861b0cf4add8e26c383bfa295b4’ Method: OPTIONS

Tried replacing it, still doesn’t work unfortunately.

Chan_SIP doesn’t see this as a valid peer either by IP or username.

Show your entire trunk config. Because something still isn’t right in it. Also, you don’t need to waste time masking private LAN IPs. In fact since this is a peer setup we need to confirm the IPs are absolutely correct.

Here it is without the IPs masked.
<— SIP read from TCP:172.16.1.12:62176 —>
INVITE sip:4000@ -freepbx.domain;user=phone SIP/2.0
FROM: “testuser”<sip:0456@ domain;user=phone>;epid=1A2512F9FC;tag=18a78fc448
TO: <sip:4000@ -freepbx.domain;user=phone>
CSEQ: 4523 INVITE
CALL-ID: d627a246-603e-4973-8bb3-2f18db70bf60
MAX-FORWARDS: 70
VIA: SIP/2.0/TCP 172.16.1.12:62176;branch=z9hG4bKd315c5f
CONTACT: <sip: -SKYPE1.domain:5060;transport=Tcp;maddr=172.16.1.12;ms-opaque=2bd72463f49d1de5>
CONTENT-LENGTH: 336
SUPPORTED: 100rel
USER-AGENT: RTCC/7.0.0.0 MediationServer
CONTENT-TYPE: application/sdp
ALLOW: ACK
Allow: CANCEL,BYE,INVITE,PRACK,UPDATE

v=0
o=- 74 1 IN IP4 172.16.1.12
s=session
c=IN IP4 172.16.1.12
b=CT:1000
t=0 0
m=audio 56668 RTP/AVP 97 101 13 0 8
c=IN IP4 172.16.1.12
a=rtcp:56669
a=label:Audio
a=sendrecv
a=rtpmap:97 RED/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtpmap:13 CN/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=ptime:20
<------------->
— (14 headers 18 lines) —
Sending to 172.16.1.12:62176 (no NAT)
Sending to 172.16.1.12:62176 (no NAT)
Using INVITE request as basis request - d627a246-603e-4973-8bb3-2f18db70bf60
No matching peer for ‘0456’ from ‘172.16.1.12:62176’
Found RTP audio format 97
Found RTP audio format 101
Found RTP audio format 13
Found RTP audio format 0
Found RTP audio format 8
Found unknown media description format RED for ID 97
Found audio description format telephone-event for ID 101
Found audio description format CN for ID 13
Found audio description format PCMU for ID 0
Found audio description format PCMA for ID 8
Capabilities: us - (ulaw|alaw|gsm|g726|g722), peer - audio=(ulaw|alaw)/video=(nothing)/text=(nothing), combined - (ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x3 (telephone-event|CN|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 172.16.1.12:56668
Looking for 4000 in from-sip-external (domain -freepbx.domain)
sip_route_dump: route/path hop: <sip: -SKYPE1.domain:5060;transport=Tcp;maddr=172.16.1.12;ms-opaque=2bd72463f49d1de5>

<— Transmitting (no NAT) to 172.16.1.12:62176 —>
SIP/2.0 100 Trying
Via: SIP/2.0/TCP 172.16.1.12:62176;branch=z9hG4bKd315c5f;received=172.16.1.12
From: “testuser”<sip:0456@ domain;user=phone>;epid=1A2512F9FC;tag=18a78fc448
To: <sip:4000@ freepbx.domain;user=phone>
Call-ID: d627a246-603e-4973-8bb3-2f18db70bf60
CSeq: 4523 INVITE
Server: FPBX-14.0.13.4(13.22.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:4000@ 172.16.1.19:5060;transport=tcp>
Content-Length: 0

<------------>
[2019-07-29 12:10:17] WARNING[11180][C-00000002]: Ext. s:6 @ from-sip-external: “Rejecting unknown SIP connection from 172.16.1.12”
Audio is at 10008
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP

<— Reliably Transmitting (no NAT) to 172.16.1.12:62176 —>
SIP/2.0 200 OK
Via: SIP/2.0/TCP 172.16.1.12:62176;branch=z9hG4bKd315c5f;received=172.16.1.12
From: “testuser”<sip:0456@ domain;user=phone>;epid=1A2512F9FC;tag=18a78fc448
To: <sip:4000@ freepbx.domain;user=phone>;tag=as638452aa
Call-ID: d627a246-603e-4973-8bb3-2f18db70bf60
CSeq: 4523 INVITE
Server: FPBX-14.0.13.4(13.22.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:4000@ 172.16.1.19:5060;transport=tcp>
Content-Type: application/sdp
Content-Length: 274

v=0
o=root 1635555308 1635555308 IN IP4 172.16.1.19
s=Asterisk PBX 13.22.0
c=IN IP4 172.16.1.19
t=0 0
m=audio 10008 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<------------>

<— SIP read from TCP:10.50.2.109:11844 —>
REGISTER sip: -freepbx.domain:5060 SIP/2.0
Via: SIP/2.0/TCP 10.50.2.109:5060;branch=z9hG4bK958848065
From: “3000” <sip:3000@ freepbx.domain:5060>;tag=2404835808
To: “3000” <sip:3000@ freepbx.domain:5060>
Call-ID: 0_2956647971@ 10.50.2.109
CSeq: 91 REGISTER
Contact: <sip:3000@ 10.50.2.109:5060;transport=TCP>
Authorization: Digest username=“3000”, realm=“asterisk”, nonce=“66419d8a”, uri=“sip: -freepbx.domain:5060”, response=“578205542d3652b507594c3f8935a134”, algorithm=MD5
Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
Max-Forwards: 70
User-Agent: Yealink W60B 77.83.0.25
Expires: 180
Allow-Events: talk,hold,conference,refer,check-sync
Content-Length: 0

<------------->
— (14 headers 0 lines) —
Sending to 10.50.2.109:5060 (no NAT)
Sending to 10.50.2.109:5060 (no NAT)

<— Transmitting (no NAT) to 10.50.2.109:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/TCP 10.50.2.109:5060;branch=z9hG4bK958848065;received=10.50.2.109
From: “3000” <sip:3000@ -freepbx.domain:5060>;tag=2404835808
To: “3000” <sip:3000@ -freepbx.domain:5060>;tag=as01cceb98
Call-ID: 0_2956647971@ 10.50.2.109
CSeq: 91 REGISTER
Server: FPBX-14.0.13.4(13.22.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce=“66310148”
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘[email protected]’ in 32000 ms (Method: REGISTER)

<— SIP read from TCP:10.50.2.109:11844 —>
REGISTER sip: -freepbx.domain:5060 SIP/2.0
Via: SIP/2.0/TCP 10.50.2.109:5060;branch=z9hG4bK1463243007
From: “3000” <sip:3000@ -freepbx.domain:5060>;tag=2404835808
To: “3000” <sip:3000@ -freepbx.domain:5060>
Call-ID: 0_2956647971@ 10.50.2.109
CSeq: 92 REGISTER
Contact: <sip:3000@ 10.50.2.109:5060;transport=TCP>
Authorization: Digest username=“3000”, realm=“asterisk”, nonce=“66310148”, uri=“sip: -freepbx.domain:5060”, response=“5a0a8133a1358c642bce97208ae8ba60”, algorithm=MD5
Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
Max-Forwards: 70
User-Agent: Yealink W60B 77.83.0.25
Expires: 180
Allow-Events: talk,hold,conference,refer,check-sync
Content-Length: 0

<------------->
— (14 headers 0 lines) —
Sending to 10.50.2.109:5060 (no NAT)
Reliably Transmitting (no NAT) to 10.50.2.109:5060:
OPTIONS sip:[email protected]:5060;transport=TCP SIP/2.0
Via: SIP/2.0/TCP 172.16.1.19:5060;branch=z9hG4bK23ec7a52
Max-Forwards: 70
From: “Unknown” <sip:Unknown@ 172.16.1.19>;tag=as0c5c1cd1
To: <sip:3000@ 10.50.2.109:5060;transport=TCP>
Contact: <sip:Unknown@ 172.16.1.19:5060;transport=tcp>
Call-ID: [email protected]:5060
CSeq: 102 OPTIONS
User-Agent: FPBX-14.0.13.4(13.22.0)
Date: Mon, 29 Jul 2019 16:10:17 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<— Transmitting (no NAT) to 10.50.2.109:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/TCP 10.50.2.109:5060;branch=z9hG4bK1463243007;received=10.50.2.109
From: “3000” <sip:3000@ -freepbx.domain:5060>;tag=2404835808
To: “3000” <sip:3000@ -freepbx.domain:5060>;tag=as01cceb98
Call-ID: 0_2956647971@ 10.50.2.109
CSeq: 92 REGISTER
Server: FPBX-14.0.13.4(13.22.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Expires: 180
Contact: <sip:3000@ 10.50.2.109:5060;transport=TCP>;expires=180
Date: Mon, 29 Jul 2019 16:10:17 GMT
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘[email protected]’ in 32000 ms (Method: REGISTER)

<— SIP read from TCP:10.50.2.109:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/TCP 172.16.1.19:5060;branch=z9hG4bK23ec7a52
From: “Unknown” <sip:Unknown@ 172.16.1.19>;tag=as0c5c1cd1
To: <sip:3000@ 10.50.2.109:5060;transport=TCP>;tag=3094584608
Call-ID: [email protected]:5060
CSeq: 102 OPTIONS
User-Agent: Yealink W60B 77.83.0.25
Content-Length: 0

<------------->
— (8 headers 0 lines) —

<— SIP read from TCP:172.16.1.12:62176 —>
ACK sip:[email protected]:5060;transport=tcp SIP/2.0
FROM: <sip:0456@ domain;user=phone>;epid=1A2512F9FC;tag=18a78fc448
TO: <sip:4000@ -freepbx.domain;user=phone>;tag=as638452aa
CSEQ: 4523 ACK
CALL-ID: d627a246-603e-4973-8bb3-2f18db70bf60
MAX-FORWARDS: 70
VIA: SIP/2.0/TCP 172.16.1.12:62176;branch=z9hG4bKbbf4eb81
CONTENT-LENGTH: 0
USER-AGENT: RTCC/7.0.0.0 MediationServer

<------------->
— (9 headers 0 lines) —
Really destroying SIP dialog ‘[email protected]:5060’ Method: OPTIONS

<— SIP read from TCP:10.50.2.109:11844 —>

<------------->

<— SIP read from TCP:172.16.1.12:62176 —>
BYE sip:[email protected]:5060;transport=tcp SIP/2.0
FROM: <sip:0456@ domain;user=phone>;epid=1A2512F9FC;tag=18a78fc448
TO: <sip:4000@ -freepbx.domain;user=phone>;tag=as638452aa
CSEQ: 4524 BYE
CALL-ID: d627a246-603e-4973-8bb3-2f18db70bf60
MAX-FORWARDS: 70
VIA: SIP/2.0/TCP 172.16.1.12:62176;branch=z9hG4bKdb834c9
CONTACT: <sip: -SKYPE1.domain:5060;transport=Tcp;maddr=172.16.1.12>
CONTENT-LENGTH: 0
USER-AGENT: RTCC/7.0.0.0 MediationServer

<------------->
— (10 headers 0 lines) —
Sending to 172.16.1.12:62176 (no NAT)
Scheduling destruction of SIP dialog ‘d627a246-603e-4973-8bb3-2f18db70bf60’ in 32000 ms (Method: BYE)

<— Transmitting (no NAT) to 172.16.1.12:62176 —>
SIP/2.0 200 OK
Via: SIP/2.0/TCP 172.16.1.12:62176;branch=z9hG4bKdb834c9;received=172.16.1.12
From: <sip:0456@ domain;user=phone>;epid=1A2512F9FC;tag=18a78fc448
To: <sip:4000@ freepbx.domain;user=phone>;tag=as638452aa
Call-ID: d627a246-603e-4973-8bb3-2f18db70bf60
CSeq: 4524 BYE
Server: FPBX-14.0.13.4(13.22.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

<------------>
Really destroying SIP dialog ‘e0373861b0cf4add8e26c383bfa295b4’ Method: OPTIONS

And here’s the peer details:

host=172.16.1.12
transport=tcp
type=peer
qualify=yes
promiscredir=yes
port=5060
insecure=port,invite
canreinvite=yes
context=from-internal
allow=all

What is the name of the peer and does 0456 exist on the PBX?

The trunk name is SkypeForBusiness (I’m guessing this is what you meant by peer name?)

As for the 0456, it only exists on the Skype for Business server.

So when I enable Allow Anonymous Inbound SIP Calls, the call does go through, so I’m 100% sure it has to do with the trunk peer details.

Does anyone have any idea which of my details are wrong?

You don’t have any other peers setup to work with the Skype server right? No other extensions, etc registering from the Skype server to the PBX?

The only thing that’s going from the PBX to the Skype server is the trunk.

I do have a trunk/PSTN gateway setup on the Skype server that’s pointing to the FreePBX as well.

OK, THAT is important. You have two peers with the same host, etc. It’s going to match on the first one. So it’s matching on the wrong peer and trying to auth against the from user which doesn’t match it.

Show both peer settings, with their peer names.

The settings on my Skype server are the following:

Trunk: freepbx.domain
PSTN gateway: freepbx.domain
Listening port: 5060
SIP Transport Protocol: TCP
Mediation Server: Skype.domain
Mediation server port: 5060

and the peer settings on the FreePBX are still the same as the ones I posted here earlier, but here they are again:
Trunk name: SkypeForBusiness

host=172.16.1.12 (This is the IP of the Skype server)
transport=tcp, udp
type=peer
qualify=yes
promiscredir=yes
port=5060
insecure=port,invite
canreinvite=yes
context=from-internal
allow=all