[SR-Users] Fwd: configuration

neili ma neilimaye at gmail.com
Sun Sep 11 21:18:04 CEST 2011


Hello sr-users,

I'm new using kamailio open source, and I would like to ask for help.

My version is 3.1.4 and I am trying to configure 3 servers, one with proxy,
one with registrar and one with location server.

My problem is when I try to send a register message it returns an error "401
Unauthorized", I know the error is in the fuction
www_authorize("10.254.239.7", "subscriber") but I don't know how to solve
it, for me it seems correct the parameters.

Below I have attatched the proxy and registrar relevant route code for my
problem, and the IPs for proxy an registrar are:
10.254.239.7-----------10.254.239.8

If someone can help me, I will be gratefull. Thanks in advance.

####REGISTRAR CODE

route{

       # initial sanity checks -- too long messages
       if (msg:len >=  2048 ) {
               sl_send_reply("513", "Message too big");
               exit;
       };

       if (!uri==myself) {
               sl_send_reply("400", "Bad destination, only register messages
de$
               exit;
       };

       # the only valid message for the registrar is the register message
       # other messages are answered with an error message
       if (uri==myself) {

               if (method=="REGISTER") {

                       sl_send_reply("100", "Trying");

               if (!www_authorize("10.254.239.7", "subscriber")) {
                       www_challenge("10.254.239.7", "1");
                       exit;
               };

               if (!check_to()) {
                       sl_send_reply("401", "Unauthorized");
                       exit;
               };

                consume_credentials();
                       if(!save("location")) {
                               sl_reply_error();
                       };
                       exit;
               } else {
                       sl_send_reply("403", "Forbidden");
                       exit;
               };
       };
}

#########PROXY CODE

               if (method=="ACK") {
                route(1);
                exit;
                } if (method=="INVITE") {
                route(3);
                exit;
                } else if (method=="REGISTER") {
                route(2);
                exit;
                 };

               lookup("aliases");
               if (!uri==myself) {
                       route(1);
               };

route[2] {
       #rewrinting the host allows the registrar to know that the message is
de$

       rewritehost("10.254.239.8");
       if(!t_relay()) {
               sl_reply_error();
       };
       exit;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20110911/df9752eb/attachment.htm>


More information about the sr-users mailing list