if( ( $(avp(sourceip_mask){ip.pton}) & $(avp(sourceip){ip.pton}) ) == (
$(avp(sourceip_mask){ip.pton}) & $(si{ip.pton}) ) )
{
     xlog("L_INFO", " ip $si belongs to $au\n");
}
else
{
     xlog("L_INFO", " ip $si does not belong to $au\n");
     sl_send_reply("403", "Forbidden");
     exit;
}

Why you do not use directly the net address? Why do you need to do ($(avp(sourceip_mask){ip.pton}) & $(avp(sourceip){ip.pton})) each time if the result is always the same? Put the result in your db instead of sourceip.

if( ($(avp(sourceip_mask){ip.pton}) & $(si{ip.pton}) ) == $avp(sourceip_net) ) ...



Il 01/02/2014 18.15, Edwin ha scritto:
I tried () also, but this resulted in an error too ):

For the [] part i followed the docs:
http://www.opensips.org/Documentation/Script-Operators
Arithmetic expressions can be used in condition expressions via test
operator ' [ ... ] '.

But I'm not the expert here, any help is appreciated!



--
View this message in context: 
http://opensips-open-sip-server.1449251.n2.nabble.com/check-if-ip-address-belongs-to-ip-and-subnet-subscriber-tp7589375p7589400.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to