<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi, Darren!<br>
<br>
There is indeed a bug there, but the patch I've attached should fix
it. Can you please apply it and test again? Let me know if this
solves your issue.<br>
<br>
Regards,<br>
<pre class="moz-signature" cols="72">--
Răzvan Crainea
OpenSIPS Developer</pre>
<br>
On 12/16/2011 06:47 AM, Darren DeLitizia wrote:
<blockquote
cite="mid:CAKvB_N7LLzYuc36wPddnLRqaQHjRCWAGLN1FaeUYErLp+kqWEQ@mail.gmail.com"
type="cite">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 moz-do-not-send="true"
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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
</body>
</html>