[OpenSIPS-Devel] New Transformations Available
Vlad Paiu
vladpaiu at opensips.org
Wed Aug 18 15:27:30 CEST 2010
Hello,
I have committed a new version that allows bitwise operations for string
variables.
It is now possible to do something like this, from the OpenSIPS script :
$var(mask) = "255.255.0.0";
$var(ip) = "192.168.2.134";
$var(net) = $(var(mask){ip.pton}) & $(var(ip){ip.pton});
if ($(var(net){ip.ntop}) == "192.168.0.0")
xlog("IP is in 192.168.0.0/16 network\n");
As for back-porting to 1.6, it will be done, but only after more
testing, when we will be sure that the version is stable.
Regards,
On 08/18/2010 01:20 PM, Thomas Gelf wrote:
> Am 18.08.2010 11:03, schrieb Vlad Paiu:
>
>> The IP transformations currently return the binary format of the IPs in
>> a string format, to keep compatibility with both IPv4 and IPv6.
>>
> Makes absolutely sense :)
>
>
>> The bitwise operators in OpenSIPS currently only work with
>> integers. We are now expanding the bitwise operators to also work with
>> string variables, and a fix will be committed as soon as we finish.
>>
> This has been my doubt :p Bitwise operators working with string
> variables would be great, I'll stay tuned!
>
> Regards,
> Thomas
>
>
--
Paiu Vlad
www.voice-system.ro
More information about the Devel
mailing list