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?
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
On 11/10/2014 04:27 AM, Daniel-Constantin Mierla wrote:
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.
Hi Daniel,
You mean to say that this operates on AVPs but not XAVPs, correct?