[OpenSIPS-Users] is this valid naming for avps - $avp($var(i))
Razvan Crainea
razvancrainea at opensips.org
Fri Dec 16 14:37:45 CET 2011
Hi, Darren!
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.
Regards,
--
Ra(zvan Crainea
OpenSIPS Developer
On 12/16/2011 06:47 AM, Darren DeLitizia wrote:
> Is this valid naming for avp's - $avp($var(i))
>
> 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
>
> Tx
> DD
>
> exec_avp("/usr/bin/php /usr/local/etc/opensips/name_of_script.php
> ips");#gets list of ips and other carrier info
> if (is_avp_set("$avp(1)")) {
> $var(x) = $avp(1); #$avp(1) is the amount of rows returned so I
> know how many to loop through
> $var(x) = $(var(x){s.int <http://s.int>}) + 1;
> avp_delete("$avp(1)");
> $avp(i) = 2;
> while($avp(i) <= $var(x)) {
> xlog("TEST -- $avp(i)\n");
> xlog("TEST -- $avp($avp(i))\n"); #
> $avp(ip) = $(avp($var(i)){s.select,0,;});
> $avp(carrier_ids) = $(avp($var(i)){s.select,1,;});
> $avp(route_types) = $(avp($var(i)){s.select,2,;});
> $avp(carrier_names) = $(avp($var(i)){s.select,0,;});
> cache_store("local", "ips_carrier_ids_$avp(ip)",
> "$avp(carrier_ids)");#
> cache_store("local", "ips_carrier_names_$avp(ip)",
> "$avp(carrier_names)");#
> cache_store("local", "ips_carrier_types_$avp(ip)",
> "$avp(route_types)");#
> avp_delete("$avp($var(i))");
> $avp(i) = $avp(i) + 1;
> }
> }
> }
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20111216/ced801b0/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pvar_avp_name.patch
Type: text/x-patch
Size: 689 bytes
Desc: not available
URL: <http://lists.opensips.org/pipermail/users/attachments/20111216/ced801b0/attachment.bin>
More information about the Users
mailing list