Status code 401 unauthorized


I have configured a asterisk server with 2 sip phones.When i’m calling from one phone to another phone from specified extension number, the call goes normally. When I check my SIP requests and responses for port 5060, First I have a INVITE request from caller phone to which has “401 Unauthorized” response.After that I have a INVITE request from caller phone to which has “100 Trying” response.“401 Unauthorized” always the first response for every call i make.Why is that?

this is the regular way to register! As defined in the RFC :

When a |Registrar| receives a request from a |Client|, the |Registrar| MAY authenticate the originator before the request is processed. If no credentials (in the Authorization header field) are provided in the request, the |Registrar| can challenge the originator to provide credentials by rejecting the request with a 401 (Unauthorized) status code.
The WWW-Authenticate response-header field MUST be included in 401 (Unauthorized) response messages. The field value consists of at least one challenge that indicates the authentication scheme(s) and parameters applicable to the realm.