[SR-Users] Printing xavp

Julien Chavanton jchavanton at gmail.com
Tue Jan 21 00:33:53 CET 2020


 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 you know how many elements are present in the stack or you could use
while ($var(i) < x) {
    xavp_params_implode($xavp(route_set[$var(i)]....))
    $var(i) = $var(i) + 1;
}

Quick answer ...


On Mon, Jan 20, 2020 at 2:08 PM Ovidiu Sas <osas at voipembedded.com> 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,
> 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_params_implode("x", "$var(out)");
>
> Is there a way to print everything inside $xavp(x)?
>
> Thanks,
> Ovidiu
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200120/b801cef1/attachment.html>


More information about the sr-users mailing list