My (buggy :-) VOIP provider does not like REGISTER request to have 
authentication digest from
previous registration and responds with "401 Unauthorized" response with a new 
"nonce" field.
Asterisk sends new REGISTER with a digest based on the new "nonce" field but 
gets 401 again 
(and new nonce field :-) The only way to re-register is to send REGISTER 
request without any
authentication digest, get 407 back (with new nonce field) and register with 
this "nonce". 
To get asterisk working with the provider I made the following patch to 
chan_sip:

--- chan_sip.c.orig     2006-09-20 16:40:39.000000000 -0400
+++ chan_sip.c  2006-10-06 18:12:37.000000000 -0400
@@ -11575,6 +11575,7 @@ static int handle_response_register(stru
 
        switch (resp) {
        case 401:       /* Unauthorized */
+               ast_string_field_free(r, nonce);
                if ((p->authtries == MAX_AUTHTRIES) || do_register_auth(p, req, 
"WWW-Authenticate", "Authorization")) {
                        ast_log(LOG_NOTICE, "Failed to authenticate on REGISTER 
to '[EMAIL PROTECTED]' (Tries %d)\n", p->registry->username, 
p->registry->hostname, p->authtries);
                        ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);    

Is it a right way? Or is it better to implement per-peer configuration option 
like "reuse_digest=yes/no"?
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Reply via email to