Glad to see that pv_isset can be used, I will use this one more, it seems
more consistent than some other alternatives !
On Tue, Jan 21, 2020 at 7:35 AM Ovidiu Sas wrote:
> Here's something that works:
> $xavp(x=>a) = "1";
> $xavp(x[0]=>b) = "2";
> $xavp(x=>a) = "10";
> $xavp(x[0
Based on that function you can add a simplified one to print the format
you like.
Daniel
On 21.01.20 16:08, Ovidiu Sas wrote:
> This is to verbose and hard to read.
> I was looking for something more configurable from the script.
>
> -ovidiu
>
> On Tue, Jan 21, 2020 at 7:34 AM Daniel-Constantin M
Here's something that works:
$xavp(x=>a) = "1";
$xavp(x[0]=>b) = "2";
$xavp(x=>a) = "10";
$xavp(x[0]=>b) = "20";
$xavp(x=>a) = "100";
$xavp(x[0]=>b) = "200";
$var(i) = 0;
while (pv_isset("$xavp(x[$var(i)])")) {
xlog("L_INFO", "[$mi] xavp_copy $var(i)\n");
This is to verbose and hard to read.
I was looking for something more configurable from the script.
-ovidiu
On Tue, Jan 21, 2020 at 7:34 AM Daniel-Constantin Mierla
wrote:
>
> Hello,
>
> if you are looking to print the content to syslog for troubleshooting,
> then there is pv_xapv_print().
>
> C
Hello,
if you are looking to print the content to syslog for troubleshooting,
then there is pv_xapv_print().
Cheers,
Daniel
On 20.01.20 23:07, Ovidiu Sas wrote:
> What's the best way to print the entire content of an xavp?
> The xavp_params_implode() doesn't print the entire stack of an xavp,
>
This code as it is is useless, unless we print the content or do something
before making the copy but can provide a way to to duplicate/reorder stacks.
Maybe looping over
if (defined $xavp(x[$var(i)]))
Is sufficient, no need to pv_unset
___
Kamailio
Only available in dev yes ... you could cherry-pick the 2 commits.
I think this code should work to copy an full stack of xavps without
knowing how many there is.
if (defined $xavp(x[0]))
$avp_copy("x", 0, "y");
while (pv_unset("$xavp(x)")) {
if(!defined $xavp(x)) {
break;
}
My previous answer was not very helpful, lets try again (not tested)
Your example :
The following code produces "c=d;e=f;"
$xavp(x=>e) = "f";
$xavp(x[0]=>c) = "d";
$xavp(x[1]=>e) = "z";
$xavp(x[1]=>c) = "y";
xavp_params_implode("x", "$var(out)");
Since you know what are the
xavp_copy() is available only in dev.
How can you copy an entire xavp, not just an element, without knowing
the size of the stack?
This doesn't work:
$var(i) = 0;
while (pv_isset("$xavp(x[$var(i)])")) {
xavp_copy("x", "$var(i)", "y");
$var(i) = $var(i) + 1;
}
-ovidiu
Hi,
To print all the elements in the stack, you will have to do a while loop.
(You can make a copy using xavp_copy, it may come in handy in some cases)
while (pv_unset("$xavp(name)")) {
// xavp_params_implode
if(!defined $xavp(name)) {
break;
}
}
Or if y
What's the best way to print the entire content of an xavp?
The xavp_params_implode() doesn't print the entire stack of an xavp,
only the top layer:
The following code produces "c=d;e=f;"
$xavp(x=>e) = "f";
$xavp(x[0]=>c) = "d";
$xavp(x[1]=>e) = "z";
$xavp(x[1]=>c) = "y";
xavp_
11 matches
Mail list logo