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>