[SR-Users] $var binary operation

Jijo realjijo at gmail.com
Thu Feb 13 16:36:29 CET 2014


I'm not getting any syntax error.
I found that we have to use the actual value instead of the bit.

    $var(a) = 9;
   if( $var(a) & 8 ) {
     xlog("L_INFO","var a has third bit set\n");
   }
   if( $var(a) & 1 ) {
     xlog("L_INFO","var a has zero bit set\n");
   }

Output is
<script>: var a has third bit set
<script>: var a has zero bit set

If this is the expected behavior, Please correct the wiki.

Thanks for the response.


On Thu, Feb 13, 2014 at 10:03 AM, Daniel-Constantin Mierla <
miconda at gmail.com> wrote:

>  Hello,
>
> the first with square brackets is obsolete, doesn't work anymore since 3.0
> (wiki has to be updated). The second should work, do you get syntax error?
>
> Cheers,
> Daniel
>
>
> On 13/02/14 15:14, Jijo wrote:
>
> Hi
>
>  I tried the binary operation using $var as per the documentation and its
> seems not working. Can somebody help me to understand it.
>
>  http://kamailio.org/dokuwiki/doku.php/pseudovariables:3.1.x
>
>  $var(a) = 3 + (7&(~2));
>
> if( [ $var(a) & 4 ] ) {
>   xlog("var a has third bit set\n");
> }
>
>
>  The format with square bracket in the conditional statement is showing
> parse error when i load the cfg. So it tried like below and that too not
> working
>
>  $var(a) = 8;
>
> if( $var(a) & 4 ) {
>   xlog("var a has third bit set\n");
> }
>
>  Please let me know if something missing here.?
>
>
>  Thanks
> Jijo
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users at lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
> --
> Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140213/87b1547b/attachment.html>


More information about the sr-users mailing list