<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>12 dec 2012 kl. 10:44 skrev Daniel-Constantin Mierla &lt;<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>&gt;:</div><br class="Apple-interchange-newline"><blockquote type="cite">
  
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
  
  <div 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></div></blockquote></div><br><div>A question I came up with yesterday evening:</div><div><br></div><div>I have an AVP with five values (0-4) called "jultomte".</div><div><br></div><div>Is there a way to assign the FULL avp - all five values - to an xavp value?</div><div><br></div><div>Like:</div><div>xavp(xmas=&gt;tree) = $avp(jultomte)[*];</div><div><br></div><div>/O</div></body></html>