Hi,

your problem is, that you are using round robin for registration (method 4).
The system creates a nonce value and validates this. Normally, only the system which generated the nonce can validate it (this should apply for the Asterisk, in the Kamailio Authentication you may configure this, http://kamailio.org/docs/modules/1.5.x/auth.html#id2510477). So we have to make sure, that both the original INVITE/REGISTER and the following INVITE/REGISTER reach the same server.

In your case, you should use a different algorithm (Please see http://kamailio.org/docs/modules/1.5.x/dispatcher.html#id2468101).
Probably algorhitm "0" would be best for you (Hash over Call-ID). For your requests you should replace " ds_select_dst("1","4");" with " ds_select_dst("1","0");" and your authentication should work.

Carsten

2010/4/9 Vic Jolin <victor.jolin@gmail.com>
I just noticed that if I have 4 servers set like this

# group  sip addresses of your * units
1 sip:XXX.XXX.XXX.XXX:5060
1 sip:XXX.XXX.XXX.XXX:5060
1 sip:XXX.XXX.XXX.XXX:5060
1 sip:XXX.XXX.XXX.XXX:5060

the registration does not work and I get 401 unauthorized.


My setup is like this

Openser as proxy sends all SIP messages to load balanced asterisk servers
So sip phones should be able to register to the asterisk server

The routing part in kamailio.cfg looks like this

if ( method=="REGISTER" || method=="NOTIFY" || method=="OPTIONS" || method=="ACK" || method=="MESSAGE") {
        fix_nated_contact();
        fix_nated_register();
        ds_select_dst("1","4");
        forward();#uri:host, uri:port);
        exit();

}

if (method=="BYE" || method=="CANCEL") {
        unforce_rtp_proxy();
} else if (method=="INVITE"){
        log("VCTOR: Got an invite\n");
        fix_nated_contact();
        force_rtp_proxy();
        ds_select_dst("1","4");
        forward();#uri:host, uri:port);
        t_on_failure("1");
};

        search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');

t_on_reply("1");


if (!is_method("INVITE|REGISTER|MESSAGE|BYE|NOTIFY|ACK|CANCEL|REFER|SUBSCRIBE|OPTIONS|INFO")) {
xlog("L_INFO", "=== [$rm] Method Not Implement ===========\n");

sl_send_reply("501", "Not implemented here");
return;
};


any thoughts?

_______________________________________________
Kamailio (OpenSER) - Users mailing list
Users@lists.kamailio.org
http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
http://lists.openser-project.org/cgi-bin/mailman/listinfo/users



--
Carsten Bock
Schomburgstr. 80
22767 Hamburg
Germany

Mobile +49 179 2021244
Home +49 40 34927217
Fax +49 40 34927218
mailto:carsten@bock.info