[SR-Users] Printing xavp

Ovidiu Sas osas at voipembedded.com
Tue Jan 21 01:47:14 CET 2020


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

On Mon, Jan 20, 2020 at 6:34 PM Julien Chavanton <jchavanton at gmail.com> wrote:
>
> 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
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users



-- 
VoIP Embedded, Inc.
http://www.voipembedded.com



More information about the sr-users mailing list