首页 文章

Asterisk NAT SIP 2.0 Unathorized 401奇怪的场景

提问于
浏览
1

首先,我已经看过类似的问题,例如:

https://serverfault.com/questions/392979/asterisk-sip-2-0-401-unauthorizedhttps://serverfault.com/questions/574166/asterisk-401-unauthorized-when-trying-to-register-sip-clients

但他们不适用于我的情况或解决方案不解决我的问题 .

我坐在 site A 上有一个星号1.8的盒子 . Site A has a public static IP and a local class c 网络192.168.1.X,星号在NAT后面 . 有些手机在同一个本地网络上,而其他手机则在 site B . Site B has another public static IP and a local class c network 192.168.2.X.因此,网站B上的手机也在nat之后 .

奇怪的是,网站B上的某些手机可以注册,而其他手机则无法注册 . 最有趣的例子是一个grandstream gxp 2100.这款手机有3个帐户,配置如下:

[1000]
deny=0.0.0.0/0.0.0.0
secret=xxxxxx
dtmfmode=rfc2833
canreinvite=no
context=from-internal
host=dynamic
trustrpid=yes
sendrpid=no
type=friend
nat=yes
port=5060
qualify=3000
qualifyfreq=60
transport=udp
encryption=no
callgroup=
pickupgroup=
dial=SIP/1000
mailbox=1000@device
permit=0.0.0.0/0.0.0.0
callerid=TONY - Lab Line 1 <1000>
callcounter=yes
faxdetect=no
cc_monitor_policy=generic

[3000]
deny=0.0.0.0/0.0.0.0
secret=xxxxxxx
dtmfmode=rfc2833
canreinvite=no
context=from-internal
host=dynamic
trustrpid=yes
sendrpid=no
type=friend
nat=yes
port=5060
qualify=3000
qualifyfreq=60
transport=udp
encryption=no
callgroup=
pickupgroup=
dial=SIP/3000
mailbox=3000@device


[9000]
deny=0.0.0.0/0.0.0.0
secret=xxxxxxxxxxx
dtmfmode=rfc2833
canreinvite=no
context=from-internal
host=dynamic
trustrpid=yes
sendrpid=no
type=friend
nat=yes
port=5060
qualify=3000
qualifyfreq=60
transport=udp
encryption=no
callgroup=
pickupgroup=
dial=SIP/9000
mailbox=9000@device

只有帐户1000和3000能够注册,而帐户9000遇到以下错误:

<--- SIP read from UDP:95.254.61.X:5064 --->
REGISTER sip:95.231.94.6 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.190:5064;branch=z9hG4bK1380984150;rport
From: <sip:9000@95.231.94.6>;tag=1294836145
To: <sip:9000@95.231.94.6>
Call-ID: 844020207-5064-1@BJC.BGI.C.BJA
CSeq: 2672 REGISTER
Contact: <sip:9000@192.168.2.190:5064>;reg-id=3;+sip.instance="<urn:uuid:00000000-0000-1000-8000-000B8251202A>"
X-Grandstream-PBX: true
Max-Forwards: 70
User-Agent: Grandstream GXP2100 1.0.5.23
Supported: path
Expires: 3600
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Length: 0

<------------->
--- (14 headers 0 lines) ---
Sending to 95.254.61.X:5064 (NAT)

<--- Transmitting (NAT) to 95.254.61.X:5064 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.2.190:5064;branch=z9hG4bK1380984150;received=95.254.61.248;rport=5064
From: <sip:9000@95.231.94.6>;tag=1294836145
To: <sip:9000@95.231.94.6>;tag=as54ceb003
Call-ID: 844020207-5064-1@BJC.BGI.C.BJA
CSeq: 2672 REGISTER
Server: FPBX-2.10.1(1.8.21.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="47737672"
Content-Length: 0


<------------>

What do you think is causing this issue? 提前感谢您的支持和帮助!

1 回答

  • 1

    这是星号的正常行为

    Asterisk用NEW nonce数据包回答为UNATHORIZED . 之后,客户端再次使用该随机数计算md5sum .

    非常喜欢你的情况客户端由于某种原因没有收到该数据包(不正确的nat设置,防火墙等)

相关问题