-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Hi,
I wanted to let you know that I'm experiencing some issues with your code when registering to a VOIP server. In order to get the system to register correctly, I had to modify a part of the code inside SIP -> Builder, adding the following code:
DigestResponseShort: (username, password, realm, nonce, method, uri) => { const ha1 = crypto.createHash("md5").update(${username}:${realm}:${password}).digest("hex"); const ha2 = crypto.createHash("md5").update(${method}:${uri}).digest("hex"); const response = crypto.createHash("md5").update(${ha1}:${nonce}:${ha2}).digest("hex"); return response; }
Then, I used it inside SIPMessageObject:
if (challenge_data) { var cnonce = Builder.generateBranch(); if (proxy_auth) { const response = Builder.DigestResponse( props.username, props.password, challenge_data.realm, challenge_data.nonce, res.method, res.requestUri, challenge_data.qop, cnonce, '00000001' ); res.headers['Proxy-Authorization'] = Digest username="${props.username}", realm="${challenge_data.realm}", nonce="${challenge_data.nonce}", uri="${res.requestUri}", response="${response}", qop="${challenge_data.qop}", cnonce="${cnonce}", nc="00000001", algorithm="MD5"; } else { const response = Builder.DigestResponseShort( props.username, props.password, challenge_data.realm, challenge_data.nonce, "REGISTER", ${res.requestUri}); res.headers['Authorization'] =Digest username="${props.username}", realm="${challenge_data.realm}", nonce="${challenge_data.nonce}", uri="${res.requestUri}", response="${response}", algorithm="MD5"; } }