<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix"><tt>Hello Alec,<br>
<br>
I'm happy you managed to make it work.<br>
<br>
Regards,<br>
</tt>
<pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
On 11.02.2014 06:18, Alec Doran-Twyford wrote:<br>
</div>
<blockquote
cite="mid:CADnYDZxO=EhCFE2FFMKwgAUazTq8k+1octfvsjdSsB-T8O98sg@mail.gmail.com"
type="cite">
<div dir="ltr">Hi Bogdan,<br>
<br>
Thanks for the help it working a charm now the code look like
this for anyone else who is interested: <br>
<br>
if(check_source_address("0")) {<br>
xlog("IP Allow Routing");<br>
} else {<br>
xlog("authentication required for call from
$si");<br>
if (!is_method("REGISTER")) {<br>
# EC - auth<br>
if (!proxy_authorize("", "subscriber"))
{<br>
xlog("proxy challenge!");<br>
proxy_challenge("", "0"); #
Realm will be autogenerated<br>
exit;<br>
}<br>
if (!db_check_from()) {<br>
xlog("forbidden!");<br>
sl_send_reply("403","Forbidden auth
ID");<br>
exit;<br>
}<br>
consume_credentials();<br>
}<br>
else {<br>
if (!www_authorize("", "subscriber")) {<br>
xlog("www challenge!");<br>
www_challenge("", "0"); # Realm
will be autogenerated<br>
exit;<br>
}<br>
<br>
if (!db_check_from()) {<br>
xlog("forbidden!");<br>
sl_send_reply("403","Forbidden auth
ID");<br>
exit;<br>
}<br>
<br>
if (!save("location")) {<br>
xlog("failed to save
location!");<br>
sl_reply_error();<br>
}<br>
<br>
<br>
xlog("registered - $from");<br>
exit;<br>
}<br>
}<br>
<br>
<br>
and currently add IP like this in to the database<br>
insert into opensips.address (ip, port) VALUES
("192.168.168.55", 5060);<br>
<br>
and then use the command to refresh the current cache of entries<br>
opensipsctl fifo address_reload<br>
<br>
Alec Doran-Twyford<br>
<br>
| Junior Support Enginner for IVSTel<br>
| E-mail: <a moz-do-not-send="true"
href="mailto:a.dorantwyford@ivstel.com">a.dorantwyford@ivstel.com</a>
| Phone: +61 2 9288 8890 |<br>
<br>
</div>
</blockquote>
<br>
</body>
</html>