[PJSIP] 401 Failed to authenticate on REGISTER

I tried troubleshooting it all the way but couldn’t find a fix. I understand that 401 is not an error but some request for re-sending the details. I’m using jsSIP and basic WebRTC configuration given on Asterisk Wiki. Please guide.

WebSocket connection from '157.46.160.198:60471' for protocol 'sip' accepted using version '13'
<--- Received SIP request (585 bytes) from WSS:157.46.160.198:60471 --->
REGISTER sip:therydcompany.in SIP/2.0
Via: SIP/2.0/WSS q2j82pn416u4.invalid;branch=z9hG4bK1543576
Max-Forwards: 69
To: <sip:webrtc_client@therydcompany.in>
From: <sip:webrtc_client@therydcompany.in>;tag=6bo1p8h2mv
Call-ID: sc2jqotberjlio4jm02cl4
CSeq: 1 REGISTER
Contact: <sip:mnvcolsf@q2j82pn416u4.invalid;transport=ws>;+sip.ice;reg-id=1;+sip.instance="<urn:uuid:68cac9d0-8263-44ce-833b-327dd834164b>";expires=600
Expires: 600
Allow: INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY
Supported: path,gruu,outbound
User-Agent: JsSIP 3.4.2
Content-Length: 0


<--- Transmitting SIP response (491 bytes) to WSS:157.46.160.198:60471 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/WSS q2j82pn416u4.invalid;rport=60471;received=157.46.160.198;branch=z9hG4bK1543576
Call-ID: sc2jqotberjlio4jm02cl4
From: <sip:webrtc_client@therydcompany.in>;tag=6bo1p8h2mv
To: <sip:webrtc_client@therydcompany.in>;tag=z9hG4bK1543576
CSeq: 1 REGISTER
WWW-Authenticate: Digest realm="asterisk",nonce="1596294224/1ea6cffc52cbf7ed1ddcc876b0376411",opaque="6099a1b87ea03a1c",algorithm=md5,qop="auth"
Server: Asterisk PBX 17.6.0
Content-Length:  0


<--- Received SIP request (864 bytes) from WSS:157.46.160.198:60471 --->
REGISTER sip:therydcompany.in SIP/2.0
Via: SIP/2.0/WSS q2j82pn416u4.invalid;branch=z9hG4bK100790
Max-Forwards: 69
To: <sip:webrtc_client@therydcompany.in>
From: <sip:webrtc_client@therydcompany.in>;tag=6bo1p8h2mv
Call-ID: sc2jqotberjlio4jm02cl4
CSeq: 2 REGISTER
Authorization: Digest algorithm=MD5, username="webrtc_client", realm="asterisk", nonce="1596294224/1ea6cffc52cbf7ed1ddcc876b0376411", uri="sip:therydcompany.in", response="33a3b196812169d7eadd5b3ed00c11c3", opaque="6099a1b87ea03a1c", qop=auth, cnonce="l51k1us6ldv5", nc=00000001
Contact: <sip:mnvcolsf@q2j82pn416u4.invalid;transport=ws>;+sip.ice;reg-id=1;+sip.instance="<urn:uuid:68cac9d0-8263-44ce-833b-327dd834164b>";expires=600
Expires: 600
Allow: INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY
Supported: path,gruu,outbound
User-Agent: JsSIP 3.4.2
Content-Length: 0


[Aug  1 15:03:44] NOTICE[28342]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'REGISTER' from '<sip:webrtc_client@therydcompany.in>' failed for '157.46.160.198:60471' (callid: sc2jqotberjlio4jm02cl4) - Failed to authenticate
<--- Transmitting SIP response (489 bytes) to WSS:157.46.160.198:60471 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/WSS q2j82pn416u4.invalid;rport=60471;received=157.46.160.198;branch=z9hG4bK100790
Call-ID: sc2jqotberjlio4jm02cl4
From: <sip:webrtc_client@therydcompany.in>;tag=6bo1p8h2mv
To: <sip:webrtc_client@therydcompany.in>;tag=z9hG4bK100790
CSeq: 2 REGISTER
WWW-Authenticate: Digest realm="asterisk",nonce="1596294224/1ea6cffc52cbf7ed1ddcc876b0376411",opaque="053ad0eb6d57806f",algorithm=md5,qop="auth"
Server: Asterisk PBX 17.6.0
Content-Length:  0

The second REGISTER request should contain the auth credentials

Is this not the auth credentials? I’m confused.
It was working fine with sip tho. Tried moving to pjsip and it doesn’t register anymore.

I was using Asterisk version 17. I downgraded to 16 and registration is working fine without any errors. Thank you!

Yes it is, but for some reason was declining the auth info

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.