<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    <div class="moz-cite-prefix">On 10/9/12 3:59 PM, Andreas Granig
      wrote:<br>
    </div>
    <blockquote cite="mid:50742DDD.1010202@sipwise.com" type="cite">
      <pre wrap="">Hi,

I'm playing around with xavp, but there are some things I can't wrap my
head around.

What basically works is this:

$xavp(a=&gt;foo) = 'foo';
$xavp(a[0]=&gt;bar) = 'bar';

Getting the value like this:

xlog("L_INFO", "a-foo='$xavp(a=&gt;foo)' and a-bar='$xavp(a=&gt;bar)'");
as well as
xlog("L_INFO", "a-foo='$xavp(a[0]=&gt;foo)' and a-bar='$xavp(a[0]=&gt;bar)'");

... works, because when omitting the index, it assumes [0]. I really
like to avoid such implicit assumptions though, to make the config
really clear, so I prefer the second approach.

What doesn't work for me then is explicit assignment of the very first
value, like this:

$xavp(a[0]=&gt;foo) = 'foo';
$xavp(a[0]=&gt;bar) = 'bar';

If I do this, the "a" xavp is never created. Wouldn't it be good
practice to create the xavp on first assignment? That way, I don't have
to take care in the config file whether the xavp is used for the first
time, where I have to omit the index.</pre>
    </blockquote>
    <br>
    xavps are reusing the avps architecture in regards of working as a
    stack. So last added is first in the list.<br>
    <br>
    The problem of creating the structure when providing the index is
    also related to it. What should happen if one does:<br>
    <br>
    <pre wrap="">$xavp(a[5]=&gt;foo) = 'foo';</pre>
    <br>
    Create other 5 xavps named 'a' (indexes 0 to 4)?<br>
    <br>
    It seemed the right approach not to create new structures at invalid
    position, by simply not providing the position. For overwriting a
    value, the index has to be provided.<br>
    <br>
    The xavps system was under rfc at some point:<br>
    <a class="moz-txt-link-freetext" href="http://lists.sip-router.org/pipermail/users/2009-July/024180.html">http://lists.sip-router.org/pipermail/users/2009-July/024180.html</a><br>
    <br>
    Of course, it can be adjusted when something can be better, for the
    moment I don't see a solution to this case, unless a new operator is
    introduced.<br>
    <br>
    <blockquote cite="mid:50742DDD.1010202@sipwise.com" type="cite">
      <pre wrap="">

What I'm also wondering is whether it's possible to directly access
nested xavps, like this:

$xavp(a=&gt;foo) = 'afoo';
$xavp(b=&gt;foo) = 'bfoo';
$xavp(c=&gt;a) = $xavp(a);
$xavp(c=&gt;b) = $xavp(b);
xlog("L_INFO", "a-foo='$xavp(c=&gt;a[0]=&gt;foo)'");
or
xlog("L_INFO", "a-foo='$xavp(c=&gt;a=&gt;foo)'");

Both ways give me "a-foo='&lt;&lt;xavp:0x7f0d387fe178&gt;&gt;'". Is this even
intended? Would be really cool if that's possible!</pre>
    </blockquote>
    Internally it is possible to have as many nested xavps (the value
    for an xavp can be a list of xavps). At this moment, the config file
    syntax has support only for two levels, your example is returning
    the value of c=&gt;a, which is a pointer to another xavp list.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <blockquote cite="mid:50742DDD.1010202@sipwise.com" type="cite">
      <pre wrap="">

Thanks,
Andreas

</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a></pre>
  </body>
</html>