Getting 401 and 403 auth error with Asterisk realtime

Hi -

This question might be really basic for most of you, but as I am new to Asterisk, this is something that can be really helpful to me.

I have be able to setup asterisk realtime and connect it to mysql database.

I have also created 2 sip peers in the database. When I am trying to connect to Asterisk server from X-lite softphone, it is giving my a 401 and 403 auth error.

PS: Both my asterisk server and my sip phone are behind NAT.

Please advise.

401 is normal.

403 indicates you have a bad password or an unmatched user. Please provide the Asterisk verobse logging to see what Asterisk thinks is wrong.