The problem was in invalid nonce value as you can see from the debug message

 0(3411) DEBUG: auth [api.c:136]: auth_check_hdr_md5(): auth:pre_auth: Invalid nonce value received (ret 2)


I was debugging for a while and I was also analyzing pcap dump when I realized that kamailioB was forwarding and both replying for the REGISTER message eg. UA answered first for 401 Unauthorized from kamailioB with it's nonce which was of course on both kamailio's invalid (kamailioB does not have UA registered and kamailioA was expecting different nonce). This was happening over and over and it was unable to sync the nonce's so I was getting 401 Unauthorized over and over.


After that i just simply add exit() after the forward(), kamailioB stopped responsing for the REGISTER and everything started to work.


I hope that this response will help in the future someone who forget to exit after forwarding the request :-)

Thanks anyway


On Mon, Mar 7, 2016 at 7:50 AM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:
Hello,

run kamailio with debug=3 in kamailio.cfg, you should see more details about what happens during authorization time.

Cheers,
Daniel


On 06/03/16 19:35, Cockhootec Yahrabee wrote:
Hi everyone,

I am trying to forward registration from one kamailio instance to another one eg.

UA1 <---> kamailioB <------> kamailioA


I am trying to register on `kamailioA` with UA1. I have UA1 registered on kamailioA. I am routing SIP messages by adding this to `request_route` block:

        if (uri != myself)
        {
                forward(otherKamailioIP, 5060);
        }

Where I am using as `otherKamilioIP on kamailioA the kamailioB IP address and vice versa.

I can clearly see in Wireshark, that the SIP messages are routed correctly but I am getting 401 Unauthorized which is sent from kamailioA to kamailioB and then from kamailioB to UA1.


I printed value of `auth_check` following this http://lists.sip-router.org/pipermail/sr-users/2014-November/085851.html and I am getting return code of `-1` which is according to the documentation http://kamailio.org/docs/modules/4.2.x/modules/auth_db.html#auth_db.f.www_authenticate the GENERIC ERROR.

I don't know what to do next. Does anyone encounter this kind of error before?


Thanks in advance



_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Berlin, March 7-9, 2016 - http://www.asipto.com

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users