[SR-Users] Syntax of xavp

Andreas Granig agranig at sipwise.com
Tue Oct 9 15:59:57 CEST 2012


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=>foo) = 'foo';
$xavp(a[0]=>bar) = 'bar';

Getting the value like this:

xlog("L_INFO", "a-foo='$xavp(a=>foo)' and a-bar='$xavp(a=>bar)'");
as well as
xlog("L_INFO", "a-foo='$xavp(a[0]=>foo)' and a-bar='$xavp(a[0]=>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]=>foo) = 'foo';
$xavp(a[0]=>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.

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

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

Both ways give me "a-foo='<<xavp:0x7f0d387fe178>>'". Is this even
intended? Would be really cool if that's possible!

Thanks,
Andreas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 897 bytes
Desc: OpenPGP digital signature
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20121009/5a0042d8/attachment.pgp>


More information about the sr-users mailing list