Asterisk / Freepbx / 挂机后通话不会断开
Asterisk / Freepbx / Call doesn't disconnects after hangup
当我从 SIP 客户端呼叫中继 -> 内部号码并挂断时,它不会断开线路。看来BYE发送到错误的中继线或使用错误的用户名授权。
[2015-02-16 15:51:01] NOTICE[3053]: chan_sip.c:22109 handle_response:
Failed to authenticate on BYE to
';tag=SDdu8i501-snl_004195XX18_NSN_CLIENT'
第一个主干可以用,第二个不行,这是我的配置:
第一个中继线:
type=peer
qualify=yes
nat=yes
username=XXXXXXX
host=bX.sXXXXXl.net
secret=XXXXXXXXXX
fromuser=XXXXXXX
fromdomain=XXXXXXX
dtmfmode=info
disallow=all
context=from-internal
canreinvite=yes
canredirect=yes
allow=alaw&ulaw
insecure=very
第二个中继:
type=peer
qualify=yes
nat=yes
username=XXXXXXX
host=bX.sXXXXXl.net
secret=XXXXXXXXXX
fromuser=XXXXXXX
fromdomain=XXXXXXX
dtmfmode=info
disallow=all
context=from-internal
canreinvite=yes
canredirect=yes
allow=alaw&ulaw
insecure=very
一个电话的tcpdump:
root@lix ~ # tcpdump -nqt -s 0 -A -i eth0 port 5060
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 1189
E.......y..wP_..T.........".INVITE sip:386XXXXXXXX@84.XXX.XXX.192:5060 SIP/2.0
Via: SIP/2.0/UDP 80.XX.XXX.149:5060;branch=z9hG4bKmrqmnl00a8ohig4vr6g0.1
To: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>
From: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 1235 INVITE
Contact: <sip:040XXX513@80.XX.XXX.149:5060;eplid=188.XX.XXX.241:5060;elid=188.XX.XXX.241:5060;evlid=pbx-core:1591;transport=udp>
Accept-Language: en;q=0.0
Allow: REGISTER, INVITE, ACK, BYE, CANCEL, NOTIFY, REFER, UPDATE, PRACK
P-Asserted-Identity: <sip:0038640XXX513@192.168.19.102;user=phone>
Supported: timer
Session-Expires: 360;refresher=uac
Min-SE: 360
Date: Mon, 16 Feb 2015 15:04:52 GMT
Max-Forwards: 67
Content-Type: application/sdp
Content-Length: 363
v=0
o=hiQ9200 4244020150116160452 1181089808 IN IP4 80.95.239.157
s=Phone Call via hiQ9200 SIPCA
c=IN IP4 80.95.239.157
t=0 0
m=audio 54246 RTP/AVP 18 8 0 100
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:8 PCMA/8000
a=fmtp:8 vad=no
a=rtpmap:0 PCMU/8000
a=fmtp:0 vad=no
a=rtpmap:100 telephone-event/8000
a=fmtp:100 0-15
a=sendrecv
a=ptime:20
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 625
E.......y...P_..T........y..ACK sip:386XXXXXXXX@84.XXX.XXX.192:5060 SIP/2.0
Via: SIP/2.0/UDP 80.XX.XXX.149:5060;branch=z9hG4bKtb9h0300c8i1ngckd6g0.1
To: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
From: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 1235 ACK
Contact: <sip:040XXX513@80.XX.XXX.149:5060;eplid=188.XX.XXX.241:5060;elid=188.XX.XXX.241:5060;evlid=pbx-core:1591;transport=udp>
Allow: REGISTER, INVITE, ACK, BYE, CANCEL, NOTIFY, REFER
Date: Mon, 16 Feb 2015 15:04:55 GMT
Max-Forwards: 67
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T........./(SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK77f199c4;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 102 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T......... 3SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK5a06c3e1;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 103 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T......... 3SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK5a06c3e1;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 103 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T.........@.SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK61805162;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 104 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T.........@.SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK61805162;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 104 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T.........@.SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK61805162;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 104 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T..........^SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK3cbc6149;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 105 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T..........^SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK3cbc6149;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 105 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T..........^SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK3cbc6149;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 105 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 363
E.......y...P_..T........s.xSIP/2.0 200 OK
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK07349552;rport=49375
From: <sip:3868330183@bt.xxxxxxxx.net>;tag=as3d51a72f
To: <sip:3868330183@bt.xxxxxxxx.net>;tag=aprq1squpq0-2pase510000s7
Call-ID: 04dbfaef3da62fdd08e43d987d0529a3@84.XXX.XXX.192
CSeq: 126 REGISTER
Contact: <sip:s@84.XXX.XXX.192:5060>;expires=60
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 394
E.......y...P_..T..........wSIP/2.0 200 OK
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK4b188443;rport=49375
From: <sip:3868330113@bt.xxxxxxxx.net>;tag=as2c8ec8f0
To: <sip:3868330113@bt.xxxxxxxx.net>;tag=SD7tiv999-
Call-ID: 6014e3525b8dac626c14802659345f7a@84.XXX.XXX.192
CSeq: 126 REGISTER
Contact: <sip:s@84.XXX.XXX.192:5060>;expires=60;audio
Supported: outbound
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 531
E../....y.. P_..T..........HBYE sip:386XXXXXXXX@84.XXX.XXX.192:5060 SIP/2.0
Via: SIP/2.0/UDP 80.XX.XXX.149:5060;branch=z9hG4bKtb9h0300c8i1ngckd6g0cd00080a3.1
To: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
From: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 1236 BYE
Accept-Language: en;q=0.0
Allow: REGISTER, INVITE, ACK, BYE, CANCEL, NOTIFY, REFER
Date: Mon, 16 Feb 2015 15:05:08 GMT
Max-Forwards: 67
Content-Length: 0
BYE 消息认证不是很少使用的扩展(实际上不需要,因为 BYE 总是有会话 ID 和 ip/port 和以前一样)。
asterisk 中没有这样的功能,因为当时几乎没有软交换机或设备实现了这个功能。
片刻之后,BYE 身份验证作为补丁添加到星号 chan_sip。但是由于在体系结构中不支持所需的结构交叉引用,它已被开发为在对等列表中查找(使用默认身份验证过程)。
asterisk 的验证程序是:asterisk select 第一部分具有相同的 ip/port 组合。所以它select第一个trunk
如果不进行重大 chan_sip 重写,您将无法解决这个问题。如果重要的话,您可以尝试将现代版本与 pjsip 一起使用。
当我从 SIP 客户端呼叫中继 -> 内部号码并挂断时,它不会断开线路。看来BYE发送到错误的中继线或使用错误的用户名授权。
[2015-02-16 15:51:01] NOTICE[3053]: chan_sip.c:22109 handle_response: Failed to authenticate on BYE to ';tag=SDdu8i501-snl_004195XX18_NSN_CLIENT'
第一个主干可以用,第二个不行,这是我的配置:
第一个中继线:
type=peer
qualify=yes
nat=yes
username=XXXXXXX
host=bX.sXXXXXl.net
secret=XXXXXXXXXX
fromuser=XXXXXXX
fromdomain=XXXXXXX
dtmfmode=info
disallow=all
context=from-internal
canreinvite=yes
canredirect=yes
allow=alaw&ulaw
insecure=very
第二个中继:
type=peer
qualify=yes
nat=yes
username=XXXXXXX
host=bX.sXXXXXl.net
secret=XXXXXXXXXX
fromuser=XXXXXXX
fromdomain=XXXXXXX
dtmfmode=info
disallow=all
context=from-internal
canreinvite=yes
canredirect=yes
allow=alaw&ulaw
insecure=very
一个电话的tcpdump:
root@lix ~ # tcpdump -nqt -s 0 -A -i eth0 port 5060
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 1189
E.......y..wP_..T.........".INVITE sip:386XXXXXXXX@84.XXX.XXX.192:5060 SIP/2.0
Via: SIP/2.0/UDP 80.XX.XXX.149:5060;branch=z9hG4bKmrqmnl00a8ohig4vr6g0.1
To: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>
From: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 1235 INVITE
Contact: <sip:040XXX513@80.XX.XXX.149:5060;eplid=188.XX.XXX.241:5060;elid=188.XX.XXX.241:5060;evlid=pbx-core:1591;transport=udp>
Accept-Language: en;q=0.0
Allow: REGISTER, INVITE, ACK, BYE, CANCEL, NOTIFY, REFER, UPDATE, PRACK
P-Asserted-Identity: <sip:0038640XXX513@192.168.19.102;user=phone>
Supported: timer
Session-Expires: 360;refresher=uac
Min-SE: 360
Date: Mon, 16 Feb 2015 15:04:52 GMT
Max-Forwards: 67
Content-Type: application/sdp
Content-Length: 363
v=0
o=hiQ9200 4244020150116160452 1181089808 IN IP4 80.95.239.157
s=Phone Call via hiQ9200 SIPCA
c=IN IP4 80.95.239.157
t=0 0
m=audio 54246 RTP/AVP 18 8 0 100
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:8 PCMA/8000
a=fmtp:8 vad=no
a=rtpmap:0 PCMU/8000
a=fmtp:0 vad=no
a=rtpmap:100 telephone-event/8000
a=fmtp:100 0-15
a=sendrecv
a=ptime:20
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 625
E.......y...P_..T........y..ACK sip:386XXXXXXXX@84.XXX.XXX.192:5060 SIP/2.0
Via: SIP/2.0/UDP 80.XX.XXX.149:5060;branch=z9hG4bKtb9h0300c8i1ngckd6g0.1
To: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
From: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 1235 ACK
Contact: <sip:040XXX513@80.XX.XXX.149:5060;eplid=188.XX.XXX.241:5060;elid=188.XX.XXX.241:5060;evlid=pbx-core:1591;transport=udp>
Allow: REGISTER, INVITE, ACK, BYE, CANCEL, NOTIFY, REFER
Date: Mon, 16 Feb 2015 15:04:55 GMT
Max-Forwards: 67
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T........./(SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK77f199c4;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 102 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T......... 3SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK5a06c3e1;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 103 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T......... 3SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK5a06c3e1;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 103 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T.........@.SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK61805162;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 104 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T.........@.SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK61805162;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 104 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T.........@.SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK61805162;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 104 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T..........^SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK3cbc6149;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 105 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T..........^SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK3cbc6149;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 105 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 509
E.......y...P_..T..........^SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK3cbc6149;rport=49375
From: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
To: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 105 BYE
WWW-Authenticate: Digest realm="bt.xxxxxxxx.net", nonce="774148580-b3756059388ed16573d45f15fb506022", algorithm=MD5, qop="auth"
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 363
E.......y...P_..T........s.xSIP/2.0 200 OK
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK07349552;rport=49375
From: <sip:3868330183@bt.xxxxxxxx.net>;tag=as3d51a72f
To: <sip:3868330183@bt.xxxxxxxx.net>;tag=aprq1squpq0-2pase510000s7
Call-ID: 04dbfaef3da62fdd08e43d987d0529a3@84.XXX.XXX.192
CSeq: 126 REGISTER
Contact: <sip:s@84.XXX.XXX.192:5060>;expires=60
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 394
E.......y...P_..T..........wSIP/2.0 200 OK
Via: SIP/2.0/UDP 84.XXX.XXX.192:5060;received=146.212.15.165;branch=z9hG4bK4b188443;rport=49375
From: <sip:3868330113@bt.xxxxxxxx.net>;tag=as2c8ec8f0
To: <sip:3868330113@bt.xxxxxxxx.net>;tag=SD7tiv999-
Call-ID: 6014e3525b8dac626c14802659345f7a@84.XXX.XXX.192
CSeq: 126 REGISTER
Contact: <sip:s@84.XXX.XXX.192:5060>;expires=60;audio
Supported: outbound
Content-Length: 0
IP 80.XX.XXX.149.5060 > 84.XXX.XXX.192.5060: UDP, length 531
E../....y.. P_..T..........HBYE sip:386XXXXXXXX@84.XXX.XXX.192:5060 SIP/2.0
Via: SIP/2.0/UDP 80.XX.XXX.149:5060;branch=z9hG4bKtb9h0300c8i1ngckd6g0cd00080a3.1
To: <sip:386XXXXXXXX@bt.xxxxxxxx.net:29040>;tag=as4bbef921
From: <sip:040XXX513@bt.xxxxxxxx.net;user=phone;CPC=Ordinary>;tag=SDtl8c501-snl_0041961844_NSN_CLIENT
Call-ID: SDtl8c501-794b0bfaea6e05f8b7ab019950a6b3c5-06a1450
CSeq: 1236 BYE
Accept-Language: en;q=0.0
Allow: REGISTER, INVITE, ACK, BYE, CANCEL, NOTIFY, REFER
Date: Mon, 16 Feb 2015 15:05:08 GMT
Max-Forwards: 67
Content-Length: 0
BYE 消息认证不是很少使用的扩展(实际上不需要,因为 BYE 总是有会话 ID 和 ip/port 和以前一样)。
asterisk 中没有这样的功能,因为当时几乎没有软交换机或设备实现了这个功能。
片刻之后,BYE 身份验证作为补丁添加到星号 chan_sip。但是由于在体系结构中不支持所需的结构交叉引用,它已被开发为在对等列表中查找(使用默认身份验证过程)。
asterisk 的验证程序是:asterisk select 第一部分具有相同的 ip/port 组合。所以它select第一个trunk
如果不进行重大 chan_sip 重写,您将无法解决这个问题。如果重要的话,您可以尝试将现代版本与 pjsip 一起使用。