<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
you have another group of actions that can send 401 Unauthorized:<br>
<br>
if (!check_to()) {<br>
sl_send_reply("401", "Unauthorized");<br>
exit;<br>
}<br>
<br>
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.<br>
<br>
If you send here the ngrep of such REGISTER and the reply we can
spot what could be the situation for 401.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
On 9/11/11 9:18 PM, neili ma wrote:
<blockquote
cite="mid:CABPYhvsbDGO1ag3-i4tUZPRbzY4MROnmRjWZs=MNH4QQS38OoQ@mail.gmail.com"
type="cite">Hello sr-users,<br>
<br>
I'm new using kamailio open source, and I would like to ask for
help.<br>
<br>
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. <br>
<br>
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. <br>
<br>
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 <br>
<br>
If someone can help me, I will be gratefull. Thanks in advance.<br>
<br>
####REGISTRAR CODE<br>
<br>
<div class="gmail_quote">route{<br>
<br>
# initial sanity checks -- too long messages<br>
if (msg:len >= 2048 ) {<br>
sl_send_reply("513", "Message too big");<br>
exit;<br>
};<br>
<br>
if (!uri==myself) {<br>
sl_send_reply("400", "Bad destination, only
register messages de$<br>
exit;<br>
};<br>
<br>
# the only valid message for the registrar is the
register message<br>
# other messages are answered with an error message<br>
if (uri==myself) {<br>
<br>
if (method=="REGISTER") {<br>
<br>
sl_send_reply("100", "Trying");<br>
<br>
if (!www_authorize("10.254.239.7", "subscriber"))
{<br>
www_challenge("10.254.239.7", "1");<br>
exit;<br>
};<br>
<br>
if (!check_to()) {<br>
sl_send_reply("401", "Unauthorized");<br>
exit;<br>
};<br>
<br>
consume_credentials();<br>
if(!save("location")) {<br>
sl_reply_error();<br>
};<br>
exit;<br>
} else {<br>
sl_send_reply("403", "Forbidden");<br>
exit;<br>
};<br>
};<br>
}<br>
<br>
#########PROXY CODE<br>
<br>
if (method=="ACK") {<br>
route(1);<br>
exit;<br>
} if (method=="INVITE") {<br>
route(3);<br>
exit;<br>
} else if (method=="REGISTER") {<br>
route(2);<br>
exit;<br>
};<br>
<br>
lookup("aliases");<br>
if (!uri==myself) {<br>
route(1);<br>
};<br>
<br>
route[2] {<br>
#rewrinting the host allows the registrar to know that
the message is de$<br>
<br>
rewritehost("10.254.239.8");<br>
if(!t_relay()) {<br>
sl_reply_error();<br>
};<br>
exit;<br>
}<br>
<br>
<br>
<br>
</div>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla -- <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
Kamailio Advanced Training, Oct 10-13, Berlin: <a class="moz-txt-link-freetext" href="http://asipto.com/u/kat">http://asipto.com/u/kat</a>
<a class="moz-txt-link-freetext" href="http://linkedin.com/in/miconda">http://linkedin.com/in/miconda</a> -- <a class="moz-txt-link-freetext" href="http://twitter.com/miconda">http://twitter.com/miconda</a></pre>
</body>
</html>