我已经配置了一个本地 Asterisk 服务器。有本地用户和一个用于外部呼叫的中继线。
用户可以成功拨打本地和拨出电话。但是,当外部呼叫到达服务器时,它会响应 401 错误(1.1.1.1 代表提供商 IP,2.2.2.2 代表本地服务器)。
邀请:
<--- Received SIP request (1079 bytes) from UDP:1.1.1.1:5060 --->
INVITE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bK2b074f13;rport
Max-Forwards: 70
From: <sip:[email protected]>;tag=as5b4c0767
To: <sip:[email protected]:5060>
Contact: <sip:[email protected]:5060>
Call-ID: [email protected]:5060
CSeq: 105 INVITE
User-Agent: VoIPVTK
Authorization: Digest username="s", realm="asterisk", algorithm=MD5, uri="sip:[email protected]", nonce="1617646804/4c072b7aa1d5799d84d11f1e857387a0", response="7e12bdf0955235437f8d49fee0fc517a", opaque="1d4bee854523cdda", qop=auth, cnonce="3c7da01c", nc=00000003
Date: Mon, 05 Apr 2021 18:20:04 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 226
v=0
o=VoIPVTK 1371915978 1371915981 IN IP4 1.1.1.1
s=VoIPVTK
c=IN IP4 1.1.1.1
t=0 0
m=audio 11250 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
回复:
[Apr 5 21:20:04] NOTICE[72898]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'INVITE' from '<sip:[email protected]>' failed for '1.1.1.1:5060' (callid: [email protected]:5060) - Failed to authenticate
<--- Transmitting SIP response (502 bytes) to UDP:1.1.1.1:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 1.1.1.1:5060;rport=5060;received=1.1.1.1;branch=z9hG4bK2b074f13
Call-ID: [email protected]:5060
From: <sip:[email protected]>;tag=as5b4c0767
To: <sip:[email protected]>;tag=z9hG4bK2b074f13
CSeq: 105 INVITE
WWW-Authenticate: Digest realm="asterisk",nonce="1617646804/4c072b7aa1d5799d84d11f1e857387a0",opaque="52b0860022fc8faa",algorithm=md5,qop="auth"
Server: Asterisk PBX 18.2.0
Content-Length: 0
提供者也发送失败并出现相同错误的 OPTIONS 请求。来自我们服务器的 OPTIONS 请求成功。
似乎提供者未经授权发送数据包,而服务器需要它。
这怎么能解决?