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?

--
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States

Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.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