[OpenSIPS-Users] Iterating the result of exec_avp

Leonardo leonardo.loures at gmail.com
Mon Jun 25 23:13:16 CEST 2012


I'm having some trouble trying to iterate the result of exec_avp. The piece
of code I'm trying to use is the following:

startup_route {
    xlog("L_INFO", "Entering startup_route...");

    exec_avp("ls -la /test/");
    $avp(i) = 1;
    while(is_avp_set("$avp($avp(i))")) {
        xlog("L_INFO", "$avp($avp(i))");
        $avp(i) = $avp(i) + 1;
    }

    xlog("L_INFO", "Exiting startup_route...");
}

Do you guys see anything wrong in my code? I was just trying to use the fact
that the result of exec_avp is stored in variables $avp(1), $avp(2),
$avp(3), and so on... and access these variables with another variable,
$avp(i), by using "$avp($avp(i))" and incrementing $avp(i) for each
iteration.

But for some reason, the result of my code is a mess: 99 lines of random
files, which are in fact inside /test.

Am I doing anything wrong?

Thanks in advance,
Leonardo

--
View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Iterating-the-result-of-exec-avp-tp7580527.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.



More information about the Users mailing list