Asterisk put his private ip however external_signaling_address is defined

I have Asterisk behind NAT with forwarded 5060 port to his private ip 172.17.0.2. Though I have followed recommendations for setup Asterisk to work through NAT here:
https://wiki.asterisk.org/wiki/display/AST/Configuring+res_pjsip+to+work+through+NAT

And setup in pjsip.conf:

external_signaling_address=192.168.12.101
external_media_address=192.168.12.101
local_net=172.17.0.0/16

192.168.12.101 is my external IP relatively to Asterisk
172.17.0.2 Asterisk’s private IP in 172.17.0.0/16 private subnet (docker)

But I still see private ip Asterisk 172.17.0.2 in Contact header in “200 OK” response to my softphone which is behind NAT relatively to Asterisk. That is why softphone’s “ACK” cannot reach the Asterisk, that is why call is terminating after ~30 sec.

However “Via” header has “external” 192.168.12.101 ip, Contact header still has private IP “172.17.0.2”.

How I can say Asterisk that it will replace ip in Contact header as well?

Try adding rewrite_contact=yes

1 Like

rewrite_contact option is only available for type endpoint, but asterisk itself, who answer “200 OK” with Contact header with private IP in it don’t represented in pjsip.conf by section type “endpoint”.

It would be better specify in section type transport, but this type section don’t has this option.

rewrite_contact

On inbound SIP messages from this endpoint, the Contact header or an appropriate Record-Route header will be changed to have the source IP address and port. This option does not affect outbound messages sent to this endpoint. This option helps servers communicate with endpoints that are behind NATs. This option also helps reuse reliable transport connections such as TCP and TLS.

What version of Asterisk? What is the actual output of “pjsip set logger on”?

Using Asterisk version 16.7.0.

This is a INVITE from soft phone in subnet 10.21.35.0/24 and answer “200 OK” sent by Asterisk behind the NAT in subnet 172.17.0.0/16 from ip 172.17.0.2.

After which expected ACK from soft phone, but, my guess, due to 172.17.0.2 in Contact header in “200 OK” response soft phone don’t know where this request should be routed to. That is why user’s hang up don’t terminate the call and call interrupted after ~30 sec. As rules in RFC specify interrupt the call if not received ACK at establishing step.

From pjsip set logger on

<--- Received SIP request (1208 bytes) from UDP:172.17.0.1:36703 --->
INVITE sip:mobile@10.21.35.160 SIP/2.0
Via: SIP/2.0/UDP 10.21.35.160:64946;rport;branch=z9hG4bKPjgWIoOHZhKIDv19y0X1CjvOy60aMDam34
Max-Forwards: 70
From: "softphone" <sip:softphone@10.21.35.160>;tag=0nXREo8JaV0wBJVQXADd0vWcRJ4xxzYv
To: <sip:mobile@10.21.35.160>
Contact: "softphone" <sip:softphone@10.21.35.160:64946;ob>
Call-ID: xH-bMeZLMjzfgINtLx3HIVOE5qMOwFzK
CSeq: 31782 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, norefersub
User-Agent: Telephone 1.4
Authorization: Digest username="softphone", realm="asterisk", nonce="1578915989/f3f0009f425dffd4445db7276d317ea1", uri="sip:mobile@10.21.35.160", response="45a70ad958348f258b42bc67bd4d4707", algorithm=md5, cnonce="q72i-LPSWo58vJ4pEPMl1Si.XQ1QZ-Gq", opaque="266811f01d82279e", qop=auth, nc=00000001
Content-Type: application/sdp
Content-Length:   298

v=0
o=- 3787904789 3787904789 IN IP4 10.21.35.160
s=pjmedia
b=AS:84
t=0 0
a=X-nat:0
m=audio 4010 RTP/AVP 8 0 101
c=IN IP4 10.21.35.160
b=TIAS:64000
a=rtcp:4011 IN IP4 10.21.35.160
a=sendrecv
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16






<--- Transmitting SIP response (863 bytes) to UDP:172.17.0.1:36703 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.21.35.160:64946;rport=36703;received=172.17.0.1;branch=z9hG4bKPjgWIoOHZhKIDv19y0X1CjvOy60aMDam34
Call-ID: xH-bMeZLMjzfgINtLx3HIVOE5qMOwFzK
From: "softphone" <sip:softphone@10.21.35.160>;tag=0nXREo8JaV0wBJVQXADd0vWcRJ4xxzYv
To: <sip:mobile@10.21.35.160>;tag=2b41863f-a044-4b1f-95c3-1cc004845645
CSeq: 31782 INVITE
Server: Asterisk PBX 16.7.0
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Contact: <sip:172.17.0.2:5060>
Supported: 100rel, timer, replaces, norefersub
Content-Type: application/sdp
Content-Length:   233

v=0
o=- 3787904789 3787904791 IN IP4 172.17.0.2
s=Asterisk
c=IN IP4 172.17.0.2
t=0 0
m=audio 10686 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

Full log below:

<--- Received SIP request (909 bytes) from UDP:172.17.0.1:36703 --->
INVITE sip:mobile@10.21.35.160 SIP/2.0
Via: SIP/2.0/UDP 10.21.35.160:64946;rport;branch=z9hG4bKPjUyHrGAwocIjlcNTtR7rAa2VT4xhms13p
Max-Forwards: 70
From: "softphone" <sip:softphone@10.21.35.160>;tag=0nXREo8JaV0wBJVQXADd0vWcRJ4xxzYv
To: <sip:mobile@10.21.35.160>
Contact: "softphone" <sip:softphone@10.21.35.160:64946;ob>
Call-ID: xH-bMeZLMjzfgINtLx3HIVOE5qMOwFzK
CSeq: 31781 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, norefersub
User-Agent: Telephone 1.4
Content-Type: application/sdp
Content-Length:   298

v=0
o=- 3787904789 3787904789 IN IP4 10.21.35.160
s=pjmedia
b=AS:84
t=0 0
a=X-nat:0
m=audio 4010 RTP/AVP 8 0 101
c=IN IP4 10.21.35.160
b=TIAS:64000
a=rtcp:4011 IN IP4 10.21.35.160
a=sendrecv
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16

<--- Transmitting SIP response (566 bytes) to UDP:172.17.0.1:36703 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.21.35.160:64946;rport=36703;received=172.17.0.1;branch=z9hG4bKPjUyHrGAwocIjlcNTtR7rAa2VT4xhms13p
Call-ID: xH-bMeZLMjzfgINtLx3HIVOE5qMOwFzK
From: "softphone" <sip:softphone@10.21.35.160>;tag=0nXREo8JaV0wBJVQXADd0vWcRJ4xxzYv
To: <sip:mobile@10.21.35.160>;tag=z9hG4bKPjUyHrGAwocIjlcNTtR7rAa2VT4xhms13p
CSeq: 31781 INVITE
WWW-Authenticate: Digest realm="asterisk",nonce="1578915989/f3f0009f425dffd4445db7276d317ea1",opaque="266811f01d82279e",algorithm=md5,qop="auth"
Server: Asterisk PBX 16.7.0
Content-Length:  0


<--- Received SIP request (391 bytes) from UDP:172.17.0.1:36703 --->
ACK sip:mobile@10.21.35.160 SIP/2.0
Via: SIP/2.0/UDP 10.21.35.160:64946;rport;branch=z9hG4bKPjUyHrGAwocIjlcNTtR7rAa2VT4xhms13p
Max-Forwards: 70
From: "softphone" <sip:softphone@10.21.35.160>;tag=0nXREo8JaV0wBJVQXADd0vWcRJ4xxzYv
To: <sip:mobile@10.21.35.160>;tag=z9hG4bKPjUyHrGAwocIjlcNTtR7rAa2VT4xhms13p
Call-ID: xH-bMeZLMjzfgINtLx3HIVOE5qMOwFzK
CSeq: 31781 ACK
Content-Length:  0


<--- Received SIP request (1208 bytes) from UDP:172.17.0.1:36703 --->
INVITE sip:mobile@10.21.35.160 SIP/2.0
Via: SIP/2.0/UDP 10.21.35.160:64946;rport;branch=z9hG4bKPjgWIoOHZhKIDv19y0X1CjvOy60aMDam34
Max-Forwards: 70
From: "softphone" <sip:softphone@10.21.35.160>;tag=0nXREo8JaV0wBJVQXADd0vWcRJ4xxzYv
To: <sip:mobile@10.21.35.160>
Contact: "softphone" <sip:softphone@10.21.35.160:64946;ob>
Call-ID: xH-bMeZLMjzfgINtLx3HIVOE5qMOwFzK
CSeq: 31782 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, norefersub
User-Agent: Telephone 1.4
Authorization: Digest username="softphone", realm="asterisk", nonce="1578915989/f3f0009f425dffd4445db7276d317ea1", uri="sip:mobile@10.21.35.160", response="45a70ad958348f258b42bc67bd4d4707", algorithm=md5, cnonce="q72i-LPSWo58vJ4pEPMl1Si.XQ1QZ-Gq", opaque="266811f01d82279e", qop=auth, nc=00000001
Content-Type: application/sdp
Content-Length:   298

v=0
o=- 3787904789 3787904789 IN IP4 10.21.35.160
s=pjmedia
b=AS:84
t=0 0
a=X-nat:0
m=audio 4010 RTP/AVP 8 0 101
c=IN IP4 10.21.35.160
b=TIAS:64000
a=rtcp:4011 IN IP4 10.21.35.160
a=sendrecv
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16

  == Setting global variable 'SIPDOMAIN' to '10.21.35.160'
<--- Transmitting SIP response (368 bytes) to UDP:172.17.0.1:36703 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.21.35.160:64946;rport=36703;received=172.17.0.1;branch=z9hG4bKPjgWIoOHZhKIDv19y0X1CjvOy60aMDam34
Call-ID: xH-bMeZLMjzfgINtLx3HIVOE5qMOwFzK
From: "softphone" <sip:softphone@10.21.35.160>;tag=0nXREo8JaV0wBJVQXADd0vWcRJ4xxzYv
To: <sip:mobile@10.21.35.160>
CSeq: 31782 INVITE
Server: Asterisk PBX 16.7.0
Content-Length:  0


    -- Executing [mobile@internal:1] Dial("PJSIP/softphone-0000000a", "PJSIP/mobile") in new stack
    -- Called PJSIP/mobile
<--- Transmitting SIP request (895 bytes) to UDP:172.17.0.1:50339 --->
INVITE sip:mobile@172.17.0.1:50339 SIP/2.0
Via: SIP/2.0/UDP 172.17.0.2:5060;rport;branch=z9hG4bKPj7f58edd5-6e69-4082-b5c9-1d1723a2e621
From: "softphone" <sip:softphone@172.17.0.2>;tag=94b52eda-15f5-47b4-be3d-c97f45b26735
To: <sip:mobile@172.17.0.1>
Contact: <sip:asterisk@172.17.0.2:5060>
Call-ID: 4074e166-2243-4404-95d9-9f00b9a1a51e
CSeq: 14932 INVITE
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: Asterisk PBX 16.7.0
Content-Type: application/sdp
Content-Length:   233

v=0
o=- 1018702486 1018702486 IN IP4 172.17.0.2
s=Asterisk
c=IN IP4 172.17.0.2
t=0 0
m=audio 28140 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<--- Received SIP response (360 bytes) from UDP:172.17.0.1:50339 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 172.17.0.2:5060;rport=5060;branch=z9hG4bKPj7f58edd5-6e69-4082-b5c9-1d1723a2e621;received=10.21.35.160
From: "softphone" <sip:softphone@172.17.0.2>;tag=94b52eda-15f5-47b4-be3d-c97f45b26735
To: <sip:mobile@172.17.0.1>;tag=3970467091
Call-ID: 4074e166-2243-4404-95d9-9f00b9a1a51e
CSeq: 14932 INVITE
Content-Length: 0


    -- PJSIP/mobile-0000000b is ringing
<--- Transmitting SIP response (553 bytes) to UDP:172.17.0.1:36703 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 10.21.35.160:64946;rport=36703;received=172.17.0.1;branch=z9hG4bKPjgWIoOHZhKIDv19y0X1CjvOy60aMDam34
Call-ID: xH-bMeZLMjzfgINtLx3HIVOE5qMOwFzK
From: "softphone" <sip:softphone@10.21.35.160>;tag=0nXREo8JaV0wBJVQXADd0vWcRJ4xxzYv
To: <sip:mobile@10.21.35.160>;tag=2b41863f-a044-4b1f-95c3-1cc004845645
CSeq: 31782 INVITE
Server: Asterisk PBX 16.7.0
Contact: <sip:172.17.0.2:5060>
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Content-Length:  0


    -- PJSIP/mobile-0000000b is ringing
<--- Received SIP response (647 bytes) from UDP:172.17.0.1:50339 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 172.17.0.2:5060;rport=5060;branch=z9hG4bKPj7f58edd5-6e69-4082-b5c9-1d1723a2e621;received=10.21.35.160
From: "softphone" <sip:softphone@172.17.0.2>;tag=94b52eda-15f5-47b4-be3d-c97f45b26735
To: <sip:mobile@172.17.0.1>;tag=3970467091
Call-ID: 4074e166-2243-4404-95d9-9f00b9a1a51e
CSeq: 14932 INVITE
Contact: "mobile" <sip:mobile@172.17.0.1:50339;transport=udp>
Content-Type: application/sdp
Content-Length: 196

v=0
o=- 1578915988921 1578915993783 IN IP4 10.21.35.169
s=-
c=IN IP4 10.21.35.169
t=0 0
m=audio 44744 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16

    -- PJSIP/mobile-0000000b answered PJSIP/softphone-0000000a
       > 0x7fd89c08f630 -- Strict RTP learning after remote address set to: 10.21.35.169:44744
<--- Transmitting SIP request (402 bytes) to UDP:172.17.0.1:50339 --->
ACK sip:mobile@172.17.0.1:50339 SIP/2.0
Via: SIP/2.0/UDP 172.17.0.2:5060;rport;branch=z9hG4bKPjb82ca41e-3c48-485a-9125-3b2e3a03d152
From: "softphone" <sip:softphone@172.17.0.2>;tag=94b52eda-15f5-47b4-be3d-c97f45b26735
To: <sip:mobile@172.17.0.1>;tag=3970467091
Call-ID: 4074e166-2243-4404-95d9-9f00b9a1a51e
CSeq: 14932 ACK
Max-Forwards: 70
User-Agent: Asterisk PBX 16.7.0
Content-Length:  0


       > 0x7fd89c0467b0 -- Strict RTP learning after remote address set to: 10.21.35.160:4010
<--- Transmitting SIP response (863 bytes) to UDP:172.17.0.1:36703 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.21.35.160:64946;rport=36703;received=172.17.0.1;branch=z9hG4bKPjgWIoOHZhKIDv19y0X1CjvOy60aMDam34
Call-ID: xH-bMeZLMjzfgINtLx3HIVOE5qMOwFzK
From: "softphone" <sip:softphone@10.21.35.160>;tag=0nXREo8JaV0wBJVQXADd0vWcRJ4xxzYv
To: <sip:mobile@10.21.35.160>;tag=2b41863f-a044-4b1f-95c3-1cc004845645
CSeq: 31782 INVITE
Server: Asterisk PBX 16.7.0
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Contact: <sip:172.17.0.2:5060>
Supported: 100rel, timer, replaces, norefersub
Content-Type: application/sdp
Content-Length:   233

v=0
o=- 3787904789 3787904791 IN IP4 172.17.0.2
s=Asterisk
c=IN IP4 172.17.0.2
t=0 0
m=audio 10686 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

    -- Channel PJSIP/mobile-0000000b joined 'simple_bridge' basic-bridge <f6ed92c1-1dbb-4f9b-9b74-617d7cc32699>
    -- Channel PJSIP/softphone-0000000a joined 'simple_bridge' basic-bridge <f6ed92c1-1dbb-4f9b-9b74-617d7cc32699>
       > Bridge f6ed92c1-1dbb-4f9b-9b74-617d7cc32699: switching from simple_bridge technology to native_rtp
       > Remotely bridged 'PJSIP/softphone-0000000a' and 'PJSIP/mobile-0000000b' - media will flow directly between them
<--- Transmitting SIP request (911 bytes) to UDP:172.17.0.1:50339 --->
INVITE sip:mobile@172.17.0.1:50339 SIP/2.0
Via: SIP/2.0/UDP 172.17.0.2:5060;rport;branch=z9hG4bKPj269017f4-d571-4c79-8609-75c707f6ec62
From: "softphone" <sip:softphone@172.17.0.2>;tag=94b52eda-15f5-47b4-be3d-c97f45b26735
To: <sip:mobile@172.17.0.1>;tag=3970467091
Contact: <sip:asterisk@172.17.0.2:5060>
Call-ID: 4074e166-2243-4404-95d9-9f00b9a1a51e
CSeq: 14933 INVITE
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: Asterisk PBX 16.7.0
Content-Type: application/sdp
Content-Length:   234

v=0
o=- 1018702486 1018702487 IN IP4 172.17.0.2
s=Asterisk
c=IN IP4 10.21.35.160
t=0 0
m=audio 4010 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<--- Received SIP response (647 bytes) from UDP:172.17.0.1:50339 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 172.17.0.2:5060;rport=5060;branch=z9hG4bKPj269017f4-d571-4c79-8609-75c707f6ec62;received=10.21.35.160
From: "softphone" <sip:softphone@172.17.0.2>;tag=94b52eda-15f5-47b4-be3d-c97f45b26735
To: <sip:mobile@172.17.0.1>;tag=3970467091
Call-ID: 4074e166-2243-4404-95d9-9f00b9a1a51e
CSeq: 14933 INVITE
Contact: "mobile" <sip:mobile@172.17.0.1:50339;transport=udp>
Content-Type: application/sdp
Content-Length: 196

v=0
o=- 1578915988921 1578915993817 IN IP4 10.21.35.169
s=-
c=IN IP4 10.21.35.169
t=0 0
m=audio 44744 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16

       > 0x7fd89c08f630 -- Strict RTP learning after remote address set to: 10.21.35.169:44744
<--- Transmitting SIP request (402 bytes) to UDP:172.17.0.1:50339 --->
ACK sip:mobile@172.17.0.1:50339 SIP/2.0
Via: SIP/2.0/UDP 172.17.0.2:5060;rport;branch=z9hG4bKPj0ff30530-2486-45ca-a5b0-665eed0c957b
From: "softphone" <sip:softphone@172.17.0.2>;tag=94b52eda-15f5-47b4-be3d-c97f45b26735
To: <sip:mobile@172.17.0.1>;tag=3970467091
Call-ID: 4074e166-2243-4404-95d9-9f00b9a1a51e
CSeq: 14933 ACK
Max-Forwards: 70
User-Agent: Asterisk PBX 16.7.0
Content-Length:  0


<--- Transmitting SIP response (863 bytes) to UDP:172.17.0.1:36703 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.21.35.160:64946;rport=36703;received=172.17.0.1;branch=z9hG4bKPjgWIoOHZhKIDv19y0X1CjvOy60aMDam34
Call-ID: xH-bMeZLMjzfgINtLx3HIVOE5qMOwFzK
From: "softphone" <sip:softphone@10.21.35.160>;tag=0nXREo8JaV0wBJVQXADd0vWcRJ4xxzYv
To: <sip:mobile@10.21.35.160>;tag=2b41863f-a044-4b1f-95c3-1cc004845645
CSeq: 31782 INVITE
Server: Asterisk PBX 16.7.0
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Contact: <sip:172.17.0.2:5060>
Supported: 100rel, timer, replaces, norefersub
Content-Type: application/sdp
Content-Length:   233

v=0
o=- 3787904789 3787904791 IN IP4 172.17.0.2
s=Asterisk
c=IN IP4 172.17.0.2
t=0 0
m=audio 10686 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<--- Transmitting SIP response (863 bytes) to UDP:172.17.0.1:36703 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.21.35.160:64946;rport=36703;received=172.17.0.1;branch=z9hG4bKPjgWIoOHZhKIDv19y0X1CjvOy60aMDam34
Call-ID: xH-bMeZLMjzfgINtLx3HIVOE5qMOwFzK
From: "softphone" <sip:softphone@10.21.35.160>;tag=0nXREo8JaV0wBJVQXADd0vWcRJ4xxzYv
To: <sip:mobile@10.21.35.160>;tag=2b41863f-a044-4b1f-95c3-1cc004845645
CSeq: 31782 INVITE
Server: Asterisk PBX 16.7.0
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Contact: <sip:172.17.0.2:5060>
Supported: 100rel, timer, replaces, norefersub
Content-Type: application/sdp
Content-Length:   233

v=0
o=- 3787904789 3787904791 IN IP4 172.17.0.2
s=Asterisk
c=IN IP4 172.17.0.2
t=0 0
m=audio 10686 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<--- Transmitting SIP response (863 bytes) to UDP:172.17.0.1:36703 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.21.35.160:64946;rport=36703;received=172.17.0.1;branch=z9hG4bKPjgWIoOHZhKIDv19y0X1CjvOy60aMDam34
Call-ID: xH-bMeZLMjzfgINtLx3HIVOE5qMOwFzK
From: "softphone" <sip:softphone@10.21.35.160>;tag=0nXREo8JaV0wBJVQXADd0vWcRJ4xxzYv
To: <sip:mobile@10.21.35.160>;tag=2b41863f-a044-4b1f-95c3-1cc004845645
CSeq: 31782 INVITE
Server: Asterisk PBX 16.7.0
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Contact: <sip:172.17.0.2:5060>
Supported: 100rel, timer, replaces, norefersub
Content-Type: application/sdp
Content-Length:   233

v=0
o=- 3787904789 3787904791 IN IP4 172.17.0.2
s=Asterisk
c=IN IP4 172.17.0.2
t=0 0
m=audio 10686 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<--- Received SIP request (369 bytes) from UDP:172.17.0.1:39322 --->
OPTIONS sip:10.21.35.160 SIP/2.0
Call-ID: 80ea6a958baf0d43661d84eb8120ce56@10.21.35.169
CSeq: 411 OPTIONS
From: "mobile" <sip:mobile@10.21.35.160>;tag=3026052792
To: "mobile" <sip:mobile@10.21.35.160>
Via: SIP/2.0/UDP 10.21.35.169:37345;branch=z9hG4bKd218f6de611f6e66542a354d4af53f77363937;rport
Max-Forwards: 70
User-Agent: SIPAUA/0.1.001
Content-Length: 0


<--- Transmitting SIP response (567 bytes) to UDP:172.17.0.1:39322 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.21.35.169:37345;rport=39322;received=172.17.0.1;branch=z9hG4bKd218f6de611f6e66542a354d4af53f77363937
Call-ID: 80ea6a958baf0d43661d84eb8120ce56@10.21.35.169
From: "mobile" <sip:mobile@10.21.35.160>;tag=3026052792
To: "mobile" <sip:mobile@10.21.35.160>;tag=z9hG4bKd218f6de611f6e66542a354d4af53f77363937
CSeq: 411 OPTIONS
WWW-Authenticate: Digest realm="asterisk",nonce="1578915998/8d2623cd15f905776706c87975c25da6",opaque="38edcfbc666a4f7e",algorithm=md5,qop="auth"
Server: Asterisk PBX 16.7.0
Content-Length:  0


<--- Received SIP request (370 bytes) from UDP:172.17.0.1:50339 --->
OPTIONS sip:10.21.35.160 SIP/2.0
Call-ID: ddd7df1b84e1444e42b4d94923901ca6@10.21.35.169
CSeq: 3187 OPTIONS
From: "mobile" <sip:mobile@10.21.35.160>;tag=2947115443
To: "mobile" <sip:mobile@10.21.35.160>
Via: SIP/2.0/UDP 10.21.35.169:40981;branch=z9hG4bK5bb5ae4fc7321ffb5e986f56dee6bbdc363937;rport
Max-Forwards: 70
User-Agent: SIPAUA/0.1.001
Content-Length: 0


<--- Transmitting SIP response (568 bytes) to UDP:172.17.0.1:50339 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.21.35.169:40981;rport=50339;received=172.17.0.1;branch=z9hG4bK5bb5ae4fc7321ffb5e986f56dee6bbdc363937
Call-ID: ddd7df1b84e1444e42b4d94923901ca6@10.21.35.169
From: "mobile" <sip:mobile@10.21.35.160>;tag=2947115443
To: "mobile" <sip:mobile@10.21.35.160>;tag=z9hG4bK5bb5ae4fc7321ffb5e986f56dee6bbdc363937
CSeq: 3187 OPTIONS
WWW-Authenticate: Digest realm="asterisk",nonce="1578915998/8d2623cd15f905776706c87975c25da6",opaque="2af1dae1469f5e24",algorithm=md5,qop="auth"
Server: Asterisk PBX 16.7.0
Content-Length:  0


<--- Transmitting SIP response (863 bytes) to UDP:172.17.0.1:36703 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.21.35.160:64946;rport=36703;received=172.17.0.1;branch=z9hG4bKPjgWIoOHZhKIDv19y0X1CjvOy60aMDam34
Call-ID: xH-bMeZLMjzfgINtLx3HIVOE5qMOwFzK
From: "softphone" <sip:softphone@10.21.35.160>;tag=0nXREo8JaV0wBJVQXADd0vWcRJ4xxzYv
To: <sip:mobile@10.21.35.160>;tag=2b41863f-a044-4b1f-95c3-1cc004845645
CSeq: 31782 INVITE
Server: Asterisk PBX 16.7.0
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Contact: <sip:172.17.0.2:5060>
Supported: 100rel, timer, replaces, norefersub
Content-Type: application/sdp
Content-Length:   233

v=0
o=- 3787904789 3787904791 IN IP4 172.17.0.2
s=Asterisk
c=IN IP4 172.17.0.2
t=0 0
m=audio 10686 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

a99fd683a1be*CLI> pjsip set logger off
PJSIP Logging disabled
    -- Channel PJSIP/softphone-0000000a left 'native_rtp' basic-bridge <f6ed92c1-1dbb-4f9b-9b74-617d7cc32699>
  == Spawn extension (internal, mobile, 1) exited non-zero on 'PJSIP/softphone-0000000a'
    -- Channel PJSIP/mobile-0000000b left 'native_rtp' basic-bridge <f6ed92c1-1dbb-4f9b-9b74-617d7cc32699>
    -- Executing [h@internal:1] Dial("PJSIP/softphone-0000000a", "PJSIP/h") in new stack
    -- Caller hung up before dial.
  == Spawn extension (internal, h, 1) exited non-zero on 'PJSIP/softphone-0000000a'

All the traffic is within the 172.17.0.0/16 network (the actual source IP address is within it, as well as outgoing), so the external settings would not be used. You’d need to remove the local_net option to have it kick in.

1 Like

Oh it’s sorcery man! Works! Thank you a lot! Have a nice day!

Spent 3 days on it ))