[SR-Users] Fwd: configuration

Daniel-Constantin Mierla miconda at gmail.com
Tue Sep 13 09:04:51 CEST 2011


Hello,

On 9/12/11 4:14 PM, neili ma wrote:
> Hello,
>
> Thanks a lot for your advice, I found and solved the problem thanks to 
> the debugger, actually the problem was with
>
> modparam("auth_db", 
> "db_url","mysql://openser:openserrw@localhost/openser")
>
> I just had to change localhost to my locationserver IP and the problem 
> was solved :), thanks again.

good that you find it. Don't forget to cc the mailing list always so 
people reading the thread (archive later) see the conclusion -- it can 
help many others running on same situation.

Cheers,
Daniel

>
> Sincerely,
> Neili
>
>
> 2011/9/12 Daniel-Constantin Mierla <miconda at gmail.com 
> <mailto:miconda at gmail.com>>
>
>     Hello,
>
>     you have another group of actions that can send 401 Unauthorized:
>
>
>                    if (!check_to()) {
>                            sl_send_reply("401", "Unauthorized");
>                            exit;
>                    }
>
>     You can either run with debug=4 and watch the syslog to see some
>     hints in messages where it fires this 401, or use debugger module
>     with cfgtrace option set and you see the execution path of the
>     config in the logs.
>
>     If you send here the ngrep of such REGISTER and the reply we can
>     spot what could be the situation for 401.
>
>     Cheers,
>     Daniel
>
>
>     On 9/11/11 9:18 PM, neili ma wrote:
>>     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;
>>     }
>>
>>
>>
>>
>>
>>
>>     _______________________________________________
>>     SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>     sr-users at lists.sip-router.org  <mailto:sr-users at lists.sip-router.org>
>>     http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>     -- 
>     Daniel-Constantin Mierla --http://www.asipto.com
>     Kamailio Advanced Training, Oct 10-13, Berlin:http://asipto.com/u/kat
>     http://linkedin.com/in/miconda  -- http://twitter.com/miconda
>
>

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
http://linkedin.com/in/miconda -- http://twitter.com/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20110913/5c6a84f6/attachment-0001.htm>


More information about the sr-users mailing list