<div dir="ltr">Dear Sir,<br><br>Kindly check the Whole configuration file:<br><br><a href="http://pastebin.com/d16fe5f36">http://pastebin.com/d16fe5f36</a><br><br>Please let me know if there is something wrong...I&#39;m not be able to make a call and when dialing 00 from a registered or non registered endpoint OpenSIPS run inside the function if(!allow_address(&quot;1&quot;, &quot;$si&quot;, &quot;$sp&quot;)){<br>
<br><br>Regards<br><br><div class="gmail_quote">On Thu, Jan 15, 2009 at 10:07 PM, Brett Nemeroff <span dir="ltr">&lt;<a href="mailto:brett@nemeroff.com">brett@nemeroff.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
What are you using for a mask? Bogdan, what&#39;s the format for that field? Is it typical slash notation? ie: 24 for a class c (255.255.255.0).<div><br></div><div><br><div><br><div class="gmail_quote"><div><div></div><div class="Wj3C7c">
On Thu, Jan 15, 2009 at 9:52 AM, michel freiha <span dir="ltr">&lt;<a href="mailto:michofr@gmail.com" target="_blank">michofr@gmail.com</a>&gt;</span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c"><div dir="ltr">Dear Bogdan,<br><br>I did the following:<br>
<br>if(!allow_address(&quot;0&quot;, &quot;$si&quot;, &quot;$sp&quot;)){<div>
<br>sl_send_reply(&quot;403&quot;, &quot;Forbidden&quot;);<br>xlog(&quot;KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK&quot;);<br></div>
exit;<br>}<br><br>When making a call, the system is not matching the condition in all cases...which means if my IP reside on the address table or not<br><br>Regards<div><div></div><div><br><br><div class="gmail_quote">
On Thu, Jan 15, 2009 at 5:24 PM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Michel,<br>
<br>
seams allow_address() has mandatory params, replace with:<br>
 &nbsp; allow_address(&quot;0&quot;, &quot;$si&quot;, &quot;$sp&quot;)<div><br>
<br>
Regards,<br>
Bogdan<br>
<br>
<br>
michel freiha wrote:<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Dear Bogdan,<div><br>
I have created the address table as you asked me in the previous email then I added the following to the opensips.cfg file:<br>
<br>
route{<br>
<br>
if (!allow_address()) {<br>
sl_send_reply(&quot;403&quot;, &quot;Forbidden&quot;);<br>
xlog(&quot;$si&quot;);<br>
xlog(&quot;KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK&quot;);<br>
};<br>
<br>
I added only IP address to the address table...When trying to restart OpenSIps I got the below error:<br>
<br>
<br></div><div>
Thanks for the help<br>
<br>
Regards<br>
<br>
<br>
<br></div><div><div></div><div>
On Thu, Jan 15, 2009 at 11:51 AM, Bogdan-Andrei Iancu &lt;<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a> &lt;mailto:<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a>&gt;&gt; wrote:<br>



<br>
 &nbsp; &nbsp;Hi Michel,<br>
<br>
 &nbsp; &nbsp;So, the table must look like:<br>
<br>
 &nbsp; &nbsp;CREATE TABLE address (<br>
 &nbsp; &nbsp; &nbsp;id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,<br>
 &nbsp; &nbsp; &nbsp;grp SMALLINT(5) UNSIGNED DEFAULT 0 NOT NULL,<br>
 &nbsp; &nbsp; &nbsp;ip_addr VARCHAR(15) NOT NULL,<br>
 &nbsp; &nbsp; &nbsp;mask TINYINT DEFAULT 32 NOT NULL,<br>
 &nbsp; &nbsp; &nbsp;port SMALLINT(5) UNSIGNED DEFAULT 0 NOT NULL<br>
 &nbsp; &nbsp;) ENGINE=MyISAM;<br>
<br>
<br>
 &nbsp; &nbsp;so, mask is integer after all :). What you should put in db (to<br>
 &nbsp; &nbsp;test) is:<br>
 &nbsp; &nbsp; &nbsp;insert into address (ip_addr) values (&quot;xxx.xxx.xxx.xxx&quot;);<br>
<br>
 &nbsp; &nbsp;and check the allow_address() then.<br>
<br>
 &nbsp; &nbsp;Let me know if there are errors at startup or at runtime.<br>
<br>
<br>
 &nbsp; &nbsp;Regards,<br>
 &nbsp; &nbsp;Bogdan<br>
<br>
 &nbsp; &nbsp;michel freiha wrote:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Dear Bogdan,<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;I tried allow_address() and it returns an error when<br>
 &nbsp; &nbsp; &nbsp; &nbsp;restarting OpenSIPS..Even I tried to change the mask field<br>
 &nbsp; &nbsp; &nbsp; &nbsp;type from tinit to varchar but if I put a value inside it like<br>
 &nbsp; &nbsp; &nbsp; &nbsp;26 and restart OpenSIPS I even get an error<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Regards<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Regards<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;On Thu, Jan 15, 2009 at 11:20 AM, Bogdan-Andrei Iancu<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a> &lt;mailto:<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a>&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;mailto:<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a><br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;mailto:<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a>&gt;&gt;&gt; wrote:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hi Michel,<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Have you tried to use the simple format of the command ?<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Like &nbsp;allow_address() ?<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Also not that after filling in the table, you have either to<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; restart, either to issue the &quot;address_reload&quot; MI command.<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Regards,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Bogdan<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; michel freiha wrote:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dear Sir,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; I&#39;m trying to authenticate users based on their IP<br>
 &nbsp; &nbsp; &nbsp; &nbsp;addresses<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and not based on username and password...I did the<br>
 &nbsp; &nbsp; &nbsp; &nbsp;following<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; in the config file:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1- I added loadmodule &quot;permissions.so&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2- modparam(&quot;permissions&quot;, &quot;db_url&quot;,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;mysql://opensips:123456@MySQL_Database_IP/Database_name&quot;)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3- I added the below function in route function<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!allow_address(&quot;1&quot;, &quot;$si&quot;, &quot;$sp&quot;)) {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sl_send_reply(&quot;403&quot;, &quot;Forbidden&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp; &nbsp; xlog(&quot;KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; };<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4- on the database side I have created the address<br>
 &nbsp; &nbsp; &nbsp; &nbsp;table then<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add an entry with the below values:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; grp=1 &nbsp; ip_address=My Softphone IP address &nbsp;mask=24 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Port=0<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; The problem is that I&#39;m getting Forbidden in case my IP<br>
 &nbsp; &nbsp; &nbsp; &nbsp;exist<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; in address table or not...<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Does someone has any idea about what could be the issue<br>
 &nbsp; &nbsp; &nbsp; &nbsp;here?<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Thanks a lot for the help<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Regards<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp; &nbsp; ------------------------------------------------------------------------<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _______________________________________________<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Users mailing list<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>&gt;&gt;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>
<br>
<br>
<br>
</div></div></blockquote>
<br>
</blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
</div></div><div class="Ih2E3d"><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></div></blockquote></div><br></div></div>
</blockquote></div><br></div>