<div>Thanks! </div><br><div>Looks ok. (Despite the fact it's looking like write-only statement : ) </div><div>Idea was, that I want to avoid creating additional tables or schema of ACL. Means if I can use already built-in mechanism/tables/schema - than why to implement own. Code reuse, all this.</div><br><div class="gmail_quote_attribution">On Nov 7 2019, at 10:56 am, Daniel Tryba <d.tryba@pocos.nl> wrote:</div><blockquote><div><div>On Wed, Nov 06, 2019 at 07:15:42PM +0100, Igor Olhovskiy wrote:</div><blockquote><br><div>Hm... Maybe there is other module to achieve such functions?</div><div>Best if it would be with cache :)</div><div>But if no - regex also fine.</div></blockquote><br><div>But if it works it works! I don't think there is a specific module to do</div><div>this but it is easy to implement yourself. What I don't like personally</div><div>about your solution is the use of the permission tables, you need</div><div>atleast 1 per user (unless users have the same ip).</div><br><div>Personally I do this by direct database queries in usr_preferences on</div><div>INVITEs and REGISTERs. You could use any database (depending on how you</div><div>store the ACL) and cache it in a htable.</div><br><div>My solution is mysql specific (inet_aton) and forces users to have</div><div>atleast 1 CIDR notated subnet:</div><br><div>if(!avp_db_query("select value from usr_preferences where username='$au' and attribute='acl' and</div><div>inet_aton(substring_index(value,'/',1))&(1 << 32) - 1 & ~((1 << (32 -</div><div>substring_index(value,'/',-1))) - 1)=inet_aton('$si')&(1 << 32) -</div><div>1 & ~((1 << (32 - substring_index(value,'/',-1))) - 1)"))</div><div>{</div><div>t_reply("404","Go away");</div><div>exit;</div><div>}</div><br><div>_______________________________________________</div><div>Kamailio (SER) - Users Mailing List</div><div>sr-users@lists.kamailio.org</div><div>https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</div></div></blockquote>