Question

I have 2 Asterisk servers and want to connect them using chan_sip on one and pjsip on the other one. One is running at home and another at a VPS. The first one will be the client (with dynamic ip) and the 2nd the server.

The client uses sip and the server pjsip.

This is the client's sip.conf

[general]
context = default
allowguest = no
realm = myrealm.com
udpbindaddr = 0.0.0.0
qualify = yes
subscribecontext = default
localnet=192.168.1.0/255.255.255.0
externhost=myhost.com
externrefresh=30
dtmfmode = auto
canreinvite = no
jbenable = no
sendrpid = yes
trustrpid = no
disallow=all
allow=ulaw
allow=alaw
register => myuser:mypass@vpsserver

[vpsserver]
type=friend
secret=myuser
defaultuser=mypass
host=vpsserver.domain.com
context=inbound
canreinvite=no
insecure=port,invite

And this is the server's pjsip.conf

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0

[home]
type=endpoint
context=trusted
disallow=all
allow=ulaw
allow=alaw
transport=transport-udp
auth=home
aors=home

[home]
type=auth
auth_type=userpass
password=mypass
username=myuser

[home]
type=aor
max_contacts=10

When I check on the client, executing sip show registry I get

Host                                    dnsmgr Username       Refresh State                Reg.Time                 
vpsserver:5060                              N      myuser       104 Registered           Tue, 15 Apr 2014 22:57:34

which I guess means everything is ok... on the client side, I have on my extensions.conf

exten => 66,1,Dial(SIP/1@vpsserver)

and on the server's extensions.conf (in the trusted context) I have

exten => 1,1,Playback(hello-world)

So far so good... but when I dial 66 on my client Asterisk, I see the following SIP dialog on the server... the only weird thing is that I see some From: 192.168.1.112 (that's my home Asterisk's internal IP... the externhost works fine for all the providers I'm using, so I doubt that's an issue)

<--- Received SIP request (955 bytes) from UDP:179.25.158.95:5060 --->
INVITE sip:1@vpsserver.domain.com SIP/2.0
Via: SIP/2.0/UDP 179.25.158.95:5060;branch=z9hG4bK219989f7
Max-Forwards: 70
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>
Contact: <sip:8881112222@179.25.158.95:5060>
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 12.0.0
Date: Tue, 15 Apr 2014 23:07:29 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Remote-Party-ID: "192.168.1.112" <sip:8881112222@179.25.158.95>;party=calling;privacy=off;screen=no
Content-Type: application/sdp
Content-Length: 288

v=0
o=root 1744881556 1744881556 IN IP4 179.25.158.95
s=Asterisk PBX 12.0.0
c=IN IP4 179.25.158.95
t=0 0
m=audio 18242 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=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

<--- Transmitting SIP response (477 bytes) to UDP:179.25.158.95:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 179.25.158.95:5060;rport;received=179.25.158.95;branch=z9hG4bK219989f7
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>;tag=z9hG4bK219989f7
CSeq: 102 INVITE
WWW-Authenticate: Digest  realm="asterisk",nonce="1397603249/21b158867eafa0f75a16c9ba809b2958",opaque="0c72400848d0157c",algorithm=md5,qop="auth"
Content-Length:  0


<--- Received SIP request (955 bytes) from UDP:179.25.158.95:5060 --->
INVITE sip:1@vpsserver.domain.com SIP/2.0
Via: SIP/2.0/UDP 179.25.158.95:5060;branch=z9hG4bK219989f7
Max-Forwards: 70
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>
Contact: <sip:8881112222@179.25.158.95:5060>
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 12.0.0
Date: Tue, 15 Apr 2014 23:07:29 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Remote-Party-ID: "192.168.1.112" <sip:8881112222@179.25.158.95>;party=calling;privacy=off;screen=no
Content-Type: application/sdp
Content-Length: 288

v=0
o=root 1744881556 1744881556 IN IP4 179.25.158.95
s=Asterisk PBX 12.0.0
c=IN IP4 179.25.158.95
t=0 0
m=audio 18242 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=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

<--- Transmitting SIP response (477 bytes) to UDP:179.25.158.95:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 179.25.158.95:5060;rport;received=179.25.158.95;branch=z9hG4bK219989f7
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>;tag=z9hG4bK219989f7
CSeq: 102 INVITE
WWW-Authenticate: Digest  realm="asterisk",nonce="1397603249/21b158867eafa0f75a16c9ba809b2958",opaque="1dde3bb77d8a625f",algorithm=md5,qop="auth"
Content-Length:  0


<--- Received SIP request (398 bytes) from UDP:179.25.158.95:5060 --->
ACK sip:1@vpsserver.domain.com SIP/2.0
Via: SIP/2.0/UDP 179.25.158.95:5060;branch=z9hG4bK219989f7
Max-Forwards: 70
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>;tag=z9hG4bK219989f7
Contact: <sip:8881112222@179.25.158.95:5060>
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX 12.0.0
Content-Length: 0


<--- Received SIP request (1225 bytes) from UDP:179.25.158.95:5060 --->
INVITE sip:1@vpsserver.domain.com SIP/2.0
Via: SIP/2.0/UDP 179.25.158.95:5060;branch=z9hG4bK609705b6
Max-Forwards: 70
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>
Contact: <sip:8881112222@179.25.158.95:5060>
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
CSeq: 103 INVITE
User-Agent: Asterisk PBX 12.0.0
Authorization: Digest username="myuser", realm="asterisk", algorithm=MD5, uri="sip:1@vpsserver.domain.com", nonce="1397603249/21b158867eafa0f75a16c9ba809b2958", response="111420be36c5d5a0741bce833ed6fff8", opaque="0c72400848d0157c", qop=auth, cnonce="3f3c0a68", nc=00000001
Date: Tue, 15 Apr 2014 23:07:29 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Remote-Party-ID: "192.168.1.112" <sip:8881112222@179.25.158.95>;party=calling;privacy=off;screen=no
Content-Type: application/sdp
Content-Length: 288

v=0
o=root 1744881556 1744881557 IN IP4 179.25.158.95
s=Asterisk PBX 12.0.0
c=IN IP4 179.25.158.95
t=0 0
m=audio 18242 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=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

<--- Transmitting SIP response (477 bytes) to UDP:179.25.158.95:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 179.25.158.95:5060;rport;received=179.25.158.95;branch=z9hG4bK609705b6
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>;tag=z9hG4bK609705b6
CSeq: 103 INVITE
WWW-Authenticate: Digest  realm="asterisk",nonce="1397603249/21b158867eafa0f75a16c9ba809b2958",opaque="6b0f2e9701fe6730",algorithm=md5,qop="auth"
Content-Length:  0


<--- Received SIP request (378 bytes) from UDP:179.25.158.95:5060 --->
ACK sip:1@vpsserver.domain.com SIP/2.0
Via: SIP/2.0/UDP 179.25.158.95:5060;branch=z9hG4bK609705b6
Max-Forwards: 70
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>
Contact: <sip:8881112222@179.25.158.95:5060>
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX 12.0.0
Content-Length: 0


<--- Received SIP request (398 bytes) from UDP:179.25.158.95:5060 --->
ACK sip:1@vpsserver.domain.com SIP/2.0
Via: SIP/2.0/UDP 179.25.158.95:5060;branch=z9hG4bK609705b6
Max-Forwards: 70
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>;tag=z9hG4bK609705b6
Contact: <sip:8881112222@179.25.158.95:5060>
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
CSeq: 103 ACK
User-Agent: Asterisk PBX 12.0.0
Content-Length: 0


<--- Received SIP request (1225 bytes) from UDP:179.25.158.95:5060 --->
INVITE sip:1@vpsserver.domain.com SIP/2.0
Via: SIP/2.0/UDP 179.25.158.95:5060;branch=z9hG4bK0faa701c
Max-Forwards: 70
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>
Contact: <sip:8881112222@179.25.158.95:5060>
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
CSeq: 104 INVITE
User-Agent: Asterisk PBX 12.0.0
Authorization: Digest username="myuser", realm="asterisk", algorithm=MD5, uri="sip:1@vpsserver.domain.com", nonce="1397603249/21b158867eafa0f75a16c9ba809b2958", response="884875f9632d5a9cc669430ccdd499d1", opaque="6b0f2e9701fe6730", qop=auth, cnonce="5f08cac9", nc=00000002
Date: Tue, 15 Apr 2014 23:07:29 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Remote-Party-ID: "192.168.1.112" <sip:8881112222@179.25.158.95>;party=calling;privacy=off;screen=no
Content-Type: application/sdp
Content-Length: 288

v=0
o=root 1744881556 1744881558 IN IP4 179.25.158.95
s=Asterisk PBX 12.0.0
c=IN IP4 179.25.158.95
t=0 0
m=audio 18242 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=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

<--- Transmitting SIP response (477 bytes) to UDP:179.25.158.95:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 179.25.158.95:5060;rport;received=179.25.158.95;branch=z9hG4bK0faa701c
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>;tag=z9hG4bK0faa701c
CSeq: 104 INVITE
WWW-Authenticate: Digest  realm="asterisk",nonce="1397603249/21b158867eafa0f75a16c9ba809b2958",opaque="7f08e47c673ac662",algorithm=md5,qop="auth"
Content-Length:  0


<--- Received SIP request (1225 bytes) from UDP:179.25.158.95:5060 --->
INVITE sip:1@vpsserver.domain.com SIP/2.0
Via: SIP/2.0/UDP 179.25.158.95:5060;branch=z9hG4bK0faa701c
Max-Forwards: 70
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>
Contact: <sip:8881112222@179.25.158.95:5060>
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
CSeq: 104 INVITE
User-Agent: Asterisk PBX 12.0.0
Authorization: Digest username="myuser", realm="asterisk", algorithm=MD5, uri="sip:1@vpsserver.domain.com", nonce="1397603249/21b158867eafa0f75a16c9ba809b2958", response="884875f9632d5a9cc669430ccdd499d1", opaque="6b0f2e9701fe6730", qop=auth, cnonce="5f08cac9", nc=00000002
Date: Tue, 15 Apr 2014 23:07:29 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Remote-Party-ID: "192.168.1.112" <sip:8881112222@179.25.158.95>;party=calling;privacy=off;screen=no
Content-Type: application/sdp
Content-Length: 288

v=0
o=root 1744881556 1744881558 IN IP4 179.25.158.95
s=Asterisk PBX 12.0.0
c=IN IP4 179.25.158.95
t=0 0
m=audio 18242 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=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

<--- Transmitting SIP response (477 bytes) to UDP:179.25.158.95:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 179.25.158.95:5060;rport;received=179.25.158.95;branch=z9hG4bK0faa701c
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>;tag=z9hG4bK0faa701c
CSeq: 104 INVITE
WWW-Authenticate: Digest  realm="asterisk",nonce="1397603250/bedd39ad20e04bab3217c04be2786c6b",opaque="2eb5d14b61cdcea7",algorithm=md5,qop="auth"
Content-Length:  0


<--- Received SIP request (398 bytes) from UDP:179.25.158.95:5060 --->
ACK sip:1@vpsserver.domain.com SIP/2.0
Via: SIP/2.0/UDP 179.25.158.95:5060;branch=z9hG4bK0faa701c
Max-Forwards: 70
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>;tag=z9hG4bK0faa701c
Contact: <sip:8881112222@179.25.158.95:5060>
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
CSeq: 104 ACK
User-Agent: Asterisk PBX 12.0.0
Content-Length: 0


<--- Received SIP request (1225 bytes) from UDP:179.25.158.95:5060 --->
INVITE sip:1@vpsserver.domain.com SIP/2.0
Via: SIP/2.0/UDP 179.25.158.95:5060;branch=z9hG4bK1cf9e77c
Max-Forwards: 70
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>
Contact: <sip:8881112222@179.25.158.95:5060>
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
CSeq: 105 INVITE
User-Agent: Asterisk PBX 12.0.0
Authorization: Digest username="myuser", realm="asterisk", algorithm=MD5, uri="sip:1@vpsserver.domain.com", nonce="1397603249/21b158867eafa0f75a16c9ba809b2958", response="0231c5f62592ec30c20fb3372bffeaa1", opaque="7f08e47c673ac662", qop=auth, cnonce="1448bff9", nc=00000003
Date: Tue, 15 Apr 2014 23:07:29 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Remote-Party-ID: "192.168.1.112" <sip:8881112222@179.25.158.95>;party=calling;privacy=off;screen=no
Content-Type: application/sdp
Content-Length: 288

v=0
o=root 1744881556 1744881559 IN IP4 179.25.158.95
s=Asterisk PBX 12.0.0
c=IN IP4 179.25.158.95
t=0 0
m=audio 18242 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=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

<--- Transmitting SIP response (477 bytes) to UDP:179.25.158.95:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 179.25.158.95:5060;rport;received=179.25.158.95;branch=z9hG4bK1cf9e77c
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>;tag=z9hG4bK1cf9e77c
CSeq: 105 INVITE
WWW-Authenticate: Digest  realm="asterisk",nonce="1397603250/bedd39ad20e04bab3217c04be2786c6b",opaque="0e68a10e57476771",algorithm=md5,qop="auth"
Content-Length:  0


<--- Received SIP request (378 bytes) from UDP:179.25.158.95:5060 --->
ACK sip:1@vpsserver.domain.com SIP/2.0
Via: SIP/2.0/UDP 179.25.158.95:5060;branch=z9hG4bK1cf9e77c
Max-Forwards: 70
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>
Contact: <sip:8881112222@179.25.158.95:5060>
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
CSeq: 104 ACK
User-Agent: Asterisk PBX 12.0.0
Content-Length: 0


<--- Received SIP request (1225 bytes) from UDP:179.25.158.95:5060 --->
INVITE sip:1@vpsserver.domain.com SIP/2.0
Via: SIP/2.0/UDP 179.25.158.95:5060;branch=z9hG4bK1cf9e77c
Max-Forwards: 70
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>
Contact: <sip:8881112222@179.25.158.95:5060>
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
CSeq: 105 INVITE
User-Agent: Asterisk PBX 12.0.0
Authorization: Digest username="myuser", realm="asterisk", algorithm=MD5, uri="sip:1@vpsserver.domain.com", nonce="1397603249/21b158867eafa0f75a16c9ba809b2958", response="0231c5f62592ec30c20fb3372bffeaa1", opaque="7f08e47c673ac662", qop=auth, cnonce="1448bff9", nc=00000003
Date: Tue, 15 Apr 2014 23:07:29 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Remote-Party-ID: "192.168.1.112" <sip:8881112222@179.25.158.95>;party=calling;privacy=off;screen=no
Content-Type: application/sdp
Content-Length: 288

v=0
o=root 1744881556 1744881559 IN IP4 179.25.158.95
s=Asterisk PBX 12.0.0
c=IN IP4 179.25.158.95
t=0 0
m=audio 18242 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=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

<--- Transmitting SIP response (477 bytes) to UDP:179.25.158.95:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 179.25.158.95:5060;rport;received=179.25.158.95;branch=z9hG4bK1cf9e77c
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>;tag=z9hG4bK1cf9e77c
CSeq: 105 INVITE
WWW-Authenticate: Digest  realm="asterisk",nonce="1397603250/bedd39ad20e04bab3217c04be2786c6b",opaque="14f4d96d035f19a0",algorithm=md5,qop="auth"
Content-Length:  0


<--- Received SIP request (398 bytes) from UDP:179.25.158.95:5060 --->
ACK sip:1@vpsserver.domain.com SIP/2.0
Via: SIP/2.0/UDP 179.25.158.95:5060;branch=z9hG4bK1cf9e77c
Max-Forwards: 70
From: "192.168.1.112" <sip:8881112222@179.25.158.95>;tag=as5f2fb97f
To: <sip:1@vpsserver.domain.com>;tag=z9hG4bK1cf9e77c
Contact: <sip:8881112222@179.25.158.95:5060>
Call-ID: 2f20ec2d7c610b9476bdeb9e00d1f44b@179.25.158.95:5060
CSeq: 105 ACK
User-Agent: Asterisk PBX 12.0.0
Content-Length: 0


<--- Received SIP request (519 bytes) from UDP:179.25.158.95:5060 --->
OPTIONS sip:vpsserver.domain.com SIP/2.0
Via: SIP/2.0/UDP 179.25.158.95:5060;branch=z9hG4bK1eddec76
Max-Forwards: 70
From: "asterisk" <sip:asterisk@179.25.158.95>;tag=as04d0c464
To: <sip:vpsserver.domain.com>
Contact: <sip:asterisk@179.25.158.95:5060>
Call-ID: 00f4ecd436e6db0a2b530f721808de0f@179.25.158.95:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 12.0.0
Date: Tue, 15 Apr 2014 23:07:39 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


<--- Transmitting SIP response (468 bytes) to UDP:179.25.158.95:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 179.25.158.95:5060;rport;received=179.25.158.95;branch=z9hG4bK1eddec76
Call-ID: 00f4ecd436e6db0a2b530f721808de0f@179.25.158.95:5060
From: "asterisk" <sip:asterisk@179.25.158.95>;tag=as04d0c464
To: <sip:vpsserver.domain.com>;tag=z9hG4bK1eddec76
CSeq: 102 OPTIONS
WWW-Authenticate: Digest  realm="asterisk",nonce="1397603259/9eea7adb041a6e9277ef64d837b194d1",opaque="0b8497956788770f",algorithm=md5,qop="auth"
Content-Length:  0

Any ideas on how to troubleshoot the 401 at least?

UPDATE: Enabled NOTICEs on the server and I see this every 10 seconds or so

[Apr 16 18:58:28] NOTICE[2138]: res_pjsip/pjsip_distributor.c:246 log_unidentified_request: Request from '"asterisk" <sip:asterisk@179.25.158.95>' failed for '179.25.158.95:5060' (callid: 477ca2fd0db3a5542dcf2afd50673b89@179.25.158.95:5060) - No matching endpoint found
Was it helpful?

Solution

I finally figured it out... to authenticate with a PJSIP server, you need to pass the user on the From header... and that's done with the fromuser setting in sip.conf

So... just this minor tweak did the trick

[vpsserver]
type=friend
host=vpsserver.domain.com
context=inbound
fromuser=myuser
secret=mypass

And that is... without a doubt, the only setting so far that took me more than 5 days

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top