当我尝试从简单,通过思科路由器,在同一个网络上,Asterisk 日志显示尝试的连接:
<------------->
[Mar 23 20:01:34] VERBOSE[4067] chan_sip.c: [Mar 23 20:01:34] --- (8 headers 0 lines) ---
[Mar 23 20:01:34] NOTICE[4067] chan_sip.c: Outbound Registration: Expiry for nat5.babytel.ca is 55 sec (Scheduling reregistration in 40 s)
[Mar 23 20:01:34] VERBOSE[4067] chan_sip.c: [Mar 23 20:01:34] Really destroying SIP dialog '[email protected]' Method: REGISTER
[Mar 23 20:02:01] VERBOSE[20423] manager.c: [Mar 23 20:02:01] == Manager 'sendcron' logged on from 127.0.0.1
[Mar 23 20:02:01] VERBOSE[20423] manager.c: [Mar 23 20:02:01] == Manager 'sendcron' logged off from 127.0.0.1
[Mar 23 20:02:06] VERBOSE[20436] manager.c: [Mar 23 20:02:06] == Manager 'sendcron' logged on from 127.0.0.1
[Mar 23 20:02:06] VERBOSE[20436] manager.c: [Mar 23 20:02:06] == Manager 'sendcron' logged off from 127.0.0.1
[Mar 23 20:02:10] VERBOSE[4067] chan_sip.c: [Mar 23 20:02:10]
<--- SIP read from UDP:192.168.0.15:39462 --->
REGISTER sip:192.168.0.99 SIP/2.0
v: SIP/2.0/UDP 99.99.99.99:39462;rport;branch=z9hG4bKPjiUEFUHN08Wvs9xG2Q9tzRMOxFYJ323dO
Route: <sip:192.168.0.99;transport=udp;lr>
Max-Forwards: 70
f: <sip:[email protected]>;tag=HVPwJ.kg.9MW6PypcpObrVPGC3l3B-Uh
t: <sip:[email protected]>
i: QIsF0rZ0wYvzKC9S2P0rWhnYGsQ9FQbI
CSeq: 56288 REGISTER
User-Agent: CSipSimple_v1-16/r2457
m: <sip:[email protected]:39462;ob>;+sip.ice
Expires: 900
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
l: 0
<------------->
[Mar 23 20:02:10] VERBOSE[4067] chan_sip.c: [Mar 23 20:02:10] --- (13 headers 0 lines) ---
[Mar 23 20:02:10] VERBOSE[4067] chan_sip.c: [Mar 23 20:02:10] Sending to 192.168.0.15:39462 (NAT)
[Mar 23 20:02:10] VERBOSE[4067] chan_sip.c: [Mar 23 20:02:10]
<--- Transmitting (NAT) to 192.168.0.15:39462 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 99.99.99.99:39462;branch=z9hG4bKPjiUEFUHN08Wvs9xG2Q9tzRMOxFYJ323dO;received=192.168.0.15;rport=39462
From: <sip:[email protected]>;tag=HVPwJ.kg.9MW6PypcpObrVPGC3l3B-Uh
To: <sip:[email protected]>;tag=as0986faf4
Call-ID: QIsF0rZ0wYvzKC9S2P0rWhnYGsQ9FQbI
CSeq: 56288 REGISTER
Server: Asterisk PBX 1.8.29.0-vici
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="10600450"
Content-Length: 0
CSipSimple 本身无法连接到本地 Asterisk 服务器。
因为Jitsi 显示类似错误,它似乎不是特定于客户端的。因为 Mac 上的 Jitsi 和 Android 手机上的 CSipSimple 都可以拨打语音电话,所以在我看来,这完全可以排除路由器上的防火墙是导致这种情况的原因。
与此同时,我已经禁用了服务器上的防火墙,以消除这个潜在问题,但不可否认,这可能没有必要。
当 Asterisk 回复时,401 Unauthorized
我怎么知道为什么连接未经授权?
这完整日志太大了,无法在此处发布。虽然sip set debug on
没有提供任何输出,但该命令的输出是这里,尽管那是与 Jitsi 合作。
答案1
401 Unauthorized 不是一个错误:这是 SIP 身份验证机制的工作方式(请参阅这回答)
以下行:
[Mar 23 20:02:10] NOTICE[4067] chan_sip.c: Registration from '<sip:[email protected]>' failed for '192.168.0.15:39462' - Wrong password
似乎很清楚:您的 SIP 客户端中的密码错误,身份验证失败。sip.conf 中的 SIP 密码由对等定义中的“secret”参数指定(201)。