Is this valid naming for avp's - $avp($var(i))<br><br>I am trying to loop through exec_avp results as I will never know how many rows are being returned. It is in a startup route and I am using a while statement to loop through. It is not recognizing naming. $avp($avp(i)) always returns NULL while something like $avp(2) will return the data<br>
<br>Tx<br>DD<br><br> exec_avp("/usr/bin/php /usr/local/etc/opensips/name_of_script.php ips");#gets list of ips and other carrier info<br> if (is_avp_set("$avp(1)")) {<br> $var(x) = $avp(1); #$avp(1) is the amount of rows returned so I know how many to loop through<br>
$var(x) = $(var(x){<a href="http://s.int">s.int</a>}) + 1;<br> avp_delete("$avp(1)");<br> $avp(i) = 2;<br> while($avp(i) <= $var(x)) {<br> xlog("TEST -- $avp(i)\n");<br> xlog("TEST -- $avp($avp(i))\n"); # <br>
$avp(ip) = $(avp($var(i)){s.select,0,;}); <br> $avp(carrier_ids) = $(avp($var(i)){s.select,1,;});<br> $avp(route_types) = $(avp($var(i)){s.select,2,;});<br> $avp(carrier_names) = $(avp($var(i)){s.select,0,;});<br>
cache_store("local", "ips_carrier_ids_$avp(ip)", "$avp(carrier_ids)");#<br> cache_store("local", "ips_carrier_names_$avp(ip)", "$avp(carrier_names)");#<br>
cache_store("local", "ips_carrier_types_$avp(ip)", "$avp(route_types)");#<br> avp_delete("$avp($var(i))");<br> $avp(i) = $avp(i) + 1;<br> }<br> }<br>}<br><br>