Hi.
i am currently developing a SIP client in pure java using the JAIN SIP API to reigster, authenticate and send messages to a Asterisk server running on a seperate machine.
I have approached the Registering and authentication process in two steps:
- make a register SIP request
- if response is 401(which it is) retrieve the WWW-AuthenticatonHeader from Asterisk and use the nonse to generate a md5 hash for the response field to be set on a AuthenticationHeader that i am populating.
The md5 will hash the username, password, request type etc and add it to a AuthenticationHeader.
After this, i then send the same request i made previously but with the AuthenticationHeader attached.
This is the example my code is based on:
vkslabs.com/sip-register-request-using-jain-sip/
The issue i am having is that the Asterisk server keeps responding with a 401 status code dispite adding the AuthHeaders with its md5 hashes of the username and password contained so i am wondering if Asterisk server uses a different kind of authentication challenge/method?
How can i access the Logs from Asterisks to see exactly why it rejects my Auth requests? Could it be bad username and password? invalid nonse?
At the moment the server just returns 401 without more information on exactly what is the issue.
Thanks