On 08/11/14 02:53, Alex Balashov wrote:
> It would be great if there were some way to count the depth of a stack
> of XAVPs, e.g.
>
>   $xavp(root=>num) = 1;
>   $xavp(root[0]=>num) = 2;
>   $xavp(root[0]=>num) = 3;
>   ...
>   $var(depth) = $(xavp(root=>num){avp.count});
>
> Right now, the only way to do this that I know of is something like:
>
>   $var(i) = 0;
>
>   while(defined $xavp(root[$var(i)]=>num))
>      $var(i) = $var(i) + 1;
>
>   $var(i) = $var(i) - 1;
>
> Is there a secret I don't know about?
>
There is a variable that counts avps, respectively $cng($avp(x)) -- it
can be extended for other variables, it needs a bit of c coding.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Nov 24-27, Berlin - http://www.asipto.com


_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to