Nice tricks!
thank you,
:tele
On Wed, 2006-11-15 at 13:59 +0200, Daniel-Constantin Mierla wrote:
Hello,
you can use recursive routes to get the iteration.
route { ... avp_db_query("QUERY","$avp(result)"); route(1); .... }
route[1] { if(!is_avp_set("$avp(result)")) return; # do what you need to do with the first avp .... # delete the first avp avp_delete("$avp(result)"); route(1); }
If you need the AVPs after such processing you will have to make a backup before. An iterator would be something interested and is now included in the to-do list.
A simpler way for certain situations, like adding all AVPs to a header is to use $avp(result[*]) which will return comma separated list of the values for that AVP.
Cheers, Daniel On 11/14/06 11:24, tele wrote:
Hi all,
In the pseudo variables docs page:
$avp(id[N]) - represents the value of N-th AVP identified by 'id'.
This means if i do an avp_db_query that return N avps i can access to the value of avps with $avp(id[N]).
But if i don't know how many record are returned from the query how can i iterate over an array of avps ?
I've something like:
avp_db_query("SELECT n.number,n.type,n.translated FROM numerations AS n, users AS u, associations AS a WHERE a.numeration_id = n.id AND a.user_id = u.id AND u.lid = '$tU'","$avp(cli);$avp(type);$avp(translated)")
so i can access to the record with $avp(cli[0]) $avp(cli[1]) etc..
i want to append all contact returned to the destination uri and with the record $avp(translated) "true" i want to do some processing. but if i can't iterate over array of avps it's difficult.
thanks,
:tele
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users