I am trying to connect two Asterisk 13 servers via PJSIP. Both behind a NAT firewall with ports open.
Server A registers to server B but calls only work B to A.
When calling from A to B I am getting below error on the CLI of B:
[2018-03-28 13:09:11] NOTICE[84068]: res_pjsip/pjsip_distributor.c:649 log_failed_request: Request 'INVITE' from '"Soft Client" <sip:4301@10.4.35.10>' failed for '203.0.113.1:5160' (callid: 82aea23e-f0f7-4430-839b-7c8604eba2af) - No matching endpoint found
[2018-03-28 13:09:11] NOTICE[129569]: res_pjsip/pjsip_distributor.c:649 log_failed_request: Request 'INVITE' from '"Soft Client" <sip:4301@10.4.35.10>' failed for '203.0.113.1:5160' (callid: 82aea23e-f0f7-4430-839b-7c8604eba2af) - No matching endpoint found
[2018-03-28 13:09:11] NOTICE[129569]: res_pjsip/pjsip_distributor.c:649 log_failed_request: Request 'INVITE' from '"Soft Client" <sip:4301@10.4.35.10>' failed for '203.0.113.1:5160' (callid: 82aea23e-f0f7-4430-839b-7c8604eba2af) - Failed to authenticate
If I however set from_user=username for server A in pjsip.conf, the call goes through, and shows the username as CallerID then.
Why would my call get denied without it?
One thing I noticed, the IP address in the From Header
is the private IP of server A and not the external IP like it would be in chansip, not sure if this is an error.
Also the Invite contact header is Contact: <sip:asterisk@203.0.113.1:5160>
Why is the “Asterisk” in there, shouldn’t this rather be the calling party <sip:4301@203.0.113.1:5160
? In chansip it is.
Here is a SIP trace from Server A.
<--- Transmitting SIP request (944 bytes) to UDP:204.1.129.12:5160 --->
INVITE sip:5314@204.1.129.12:5160 SIP/2.0
Via: SIP/2.0/UDP 203.0.113.1:5160;rport;branch=z9hG4bKPj6c1c92c6-412c-4bb4-b832-d129dea04995
From: "Soft Client" <sip:4301@10.4.35.10>;tag=8e746a23-b936-42f0-a35d-e5897608275c
To: <sip:5314@204.1.129.12>
Contact: <sip:asterisk@203.0.113.1:5160>
Call-ID: 722491cd-8cda-4769-8dea-b76a90b37ffe
CSeq: 11207 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: FPBX-13.0.194.5(13.19.1)
Content-Type: application/sdp
Content-Length: 265
v=0
o=- 1693146580 1693146580 IN IP4 203.0.113.1
s=Asterisk
c=IN IP4 203.0.113.1
t=0 0
m=audio 18192 RTP/AVP 9 0 101
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv
<--- Received SIP response (592 bytes) from UDP:204.1.129.12:50233 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 203.0.113.1:5160;rport=5160;received=203.0.113.1;branch=z9hG4bKPj6c1c92c6-412c-4bb4-b832-d129dea04995
Call-ID: 722491cd-8cda-4769-8dea-b76a90b37ffe
From: "Soft Client" <sip:4301@10.4.35.10>;tag=8e746a23-b936-42f0-a35d-e5897608275c
To: <sip:5314@204.1.129.12>;tag=z9hG4bKPj6c1c92c6-412c-4bb4-b832-d129dea04995
CSeq: 11207 INVITE
WWW-Authenticate: Digest realm="asterisk",nonce="1522258077/eaafde63e93f520c4490671a3d2fe562",opaque="18aa96de790c91e3",algorithm=md5,qop="auth"
Server: FPBX-13.0.194.5(13.18.3)
Content-Length: 0
<--- Transmitting SIP request (450 bytes) to UDP:204.1.129.12:5160 --->
ACK sip:5314@204.1.129.12:5160 SIP/2.0
Via: SIP/2.0/UDP 203.0.113.1:5160;rport;branch=z9hG4bKPj6c1c92c6-412c-4bb4-b832-d129dea04995
From: "Soft Client" <sip:4301@10.4.35.10>;tag=8e746a23-b936-42f0-a35d-e5897608275c
To: <sip:5314@204.1.129.12>;tag=z9hG4bKPj6c1c92c6-412c-4bb4-b832-d129dea04995
Call-ID: 722491cd-8cda-4769-8dea-b76a90b37ffe
CSeq: 11207 ACK
Max-Forwards: 70
User-Agent: FPBX-13.0.194.5(13.19.1)
Content-Length: 0
<--- Transmitting SIP request (1249 bytes) to UDP:204.1.129.12:5160 --->
INVITE sip:5314@204.1.129.12:5160 SIP/2.0
Via: SIP/2.0/UDP 203.0.113.1:5160;rport;branch=z9hG4bKPjd7ba004f-39fc-44d5-a0a4-41ee4891cdaa
From: "Soft Client" <sip:4301@10.4.35.10>;tag=8e746a23-b936-42f0-a35d-e5897608275c
To: <sip:5314@204.1.129.12>
Contact: <sip:asterisk@203.0.113.1:5160>
Call-ID: 722491cd-8cda-4769-8dea-b76a90b37ffe
CSeq: 11208 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: FPBX-13.0.194.5(13.19.1)
Authorization: Digest username="TrunkAB", realm="asterisk", nonce="1522258077/eaafde63e93f520c4490671a3d2fe562", uri="sip:5314@204.1.129.12:5160", response="9348bb4fc7275fd011cdc2a96e27e0ad", algorithm=md5, cnonce="6bc73fdd-2d3d-4c5a-bb72-7e57bb3962fe", opaque="18aa96de790c91e3", qop=auth, nc=00000001
Content-Type: application/sdp
Content-Length: 265
v=0
o=- 1693146580 1693146580 IN IP4 203.0.113.1
s=Asterisk
c=IN IP4 203.0.113.1
t=0 0
m=audio 18192 RTP/AVP 9 0 101
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv
<--- Received SIP response (592 bytes) from UDP:204.1.129.12:50233 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 203.0.113.1:5160;rport=5160;received=203.0.113.1;branch=z9hG4bKPjd7ba004f-39fc-44d5-a0a4-41ee4891cdaa
Call-ID: 722491cd-8cda-4769-8dea-b76a90b37ffe
From: "Soft Client" <sip:4301@10.4.35.10>;tag=8e746a23-b936-42f0-a35d-e5897608275c
To: <sip:5314@204.1.129.12>;tag=z9hG4bKPjd7ba004f-39fc-44d5-a0a4-41ee4891cdaa
CSeq: 11208 INVITE
WWW-Authenticate: Digest realm="asterisk",nonce="1522258077/eaafde63e93f520c4490671a3d2fe562",opaque="53ecc463222c0597",algorithm=md5,qop="auth"
Server: FPBX-13.0.194.5(13.18.3)
Content-Length: 0
<--- Transmitting SIP request (450 bytes) to UDP:204.1.129.12:5160 --->
ACK sip:5314@204.1.129.12:5160 SIP/2.0
Via: SIP/2.0/UDP 203.0.113.1:5160;rport;branch=z9hG4bKPjd7ba004f-39fc-44d5-a0a4-41ee4891cdaa
From: "Soft Client" <sip:4301@10.4.35.10>;tag=8e746a23-b936-42f0-a35d-e5897608275c
To: <sip:5314@204.1.129.12>;tag=z9hG4bKPjd7ba004f-39fc-44d5-a0a4-41ee4891cdaa
Call-ID: 722491cd-8cda-4769-8dea-b76a90b37ffe
CSeq: 11208 ACK
Max-Forwards: 70
User-Agent: FPBX-13.0.194.5(13.19.1)
Content-Length: 0
[2018-03-28 10:27:57] WARNING[175371]: res_pjsip_outbound_authenticator_digest.c:190 digest_create_request_with_auth_from_old: Endpoint: 'TrunkAB': Authentication credentials not accepted by server.