[OpenSIPS-Users] check if ip address belongs to ip and subnet subscriber

Vlad Paiu vladpaiu at opensips.org
Mon Feb 3 14:56:24 CET 2014


Hello,

First of all, you can't do $(avp(sourceip_mask){ip.pton}) since ip 
transformations only work against on IP addresses, and from what I see 
in your previous script examples, $avp(sourceip_mask) was something like 
24, when instead you should be trying 255.255.255.0 .

Also, do you really need to also check netmasks, or wouldn't
      if ($si == $avp(sourceip_net))

work for you ?

Best Regards,

Vlad Paiu
OpenSIPS Developer
http://www.opensips-solutions.com

On 02.02.2014 00:03, Edwin wrote:
> Stefano,
>
> In fact you have a point. And probably I will put the network address in the
> database.
>
> But still, I hate it when I don't understand why a logical comparison
> doesn't work like I expect it to do.
>
> In this case the output of $(avp(sourceip_mask){ip.pton}) & $(si{ip.pton})
> should be the same as $avp(sourceip_net) and it gives a error.
>
> So, or it is a 'bug' or I do it wrong (sometimes the docs are a little bit
> to summier...)
>
> Is it possible to put == between to ip.xxx statements?
>
>
>
> --
> View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/check-if-ip-address-belongs-to-ip-and-subnet-subscriber-tp7589375p7589402.html
> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users




More information about the Users mailing list