我有两台Asterisk服务器,希望在其中一台上使用chan_sip,在另一台上用pjsip连接它们。一个在家里跑步,另一个在VPS跑步。第一个是客户端(具有动态ip),第二个是服务器。
客户端使用sip和服务器pjsip。
这是客户端的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
这是服务器的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
当我检查客户端,执行sip show registry
时,我得到
Host dnsmgr Username Refresh State Reg.Time
vpsserver:5060 N myuser 104 Registered Tue, 15 Apr 2014 22:57:34
我想这意味着一切都很好……在客户端,我的分机上有。conf
exten => 66,1,Dial(SIP/1@vpsserver)
在服务器的扩展上。conf(在可信上下文中)我有
exten => 1,1,Playback(hello-world)
到目前为止还不错。。。但当我在客户端Asterisk上拨打66时,我在服务器上看到以下SIP对话框。。。唯一奇怪的是,我看到了一些From:192.168.1.112(这是我家Asterisk的内部IP…外部主机对我使用的所有提供商都很好,所以我怀疑这是个问题)
<--- 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
至少对如何排除401的故障有什么想法吗?
更新:在服务器上启用NOTICE,我每隔10秒左右就会看到一次
[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
我终于想通了。。。要使用PJSIP服务器进行身份验证,您需要在From标头上传递用户。。。这是通过sip.conf 中的fromuser
设置完成的
所以。。。就是通过这个小小的调整
[vpsserver]
type=friend
host=vpsserver.domain.com
context=inbound
fromuser=myuser
secret=mypass
那就是……毫无疑问,到目前为止,唯一一个花了我5天以上时间的设置