Hello Xiaofeng,
In your script, not sure if it is the indented behavior, but when
looping through the loaded AVPs, you are pushing in cache the same key
("domain") for all the values -> this will overwrite any previous value
and you will end up storing only the last value.
The second "while" loop has no sense, as a key (in cache) has only one
value (cannot be multiple).
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com
On 21.09.2016 12:09, xiaofeng wrote:
On Tue, Sep 20, 2016 at 7:25 PM, Bogdan-Andrei Iancu
<[email protected] <mailto:[email protected]>> wrote:
>
> Hello,
>
> The avp_db_query() stores the DB result (multiple rows with multiple
columns) into a set of AVPs (kind of an array). See
> http://www.opensips.org/html/docs/modules/2.2.x/avpops.html#id293973
<http://www.opensips.org/html/docs/modules/2.2.x/avpops.html#id293973>
>
> Using a while loop (see
http://www.opensips.org/Documentation/Script-Statements-2-2#toc3
<http://www.opensips.org/Documentation/Script-Statements-2-2#toc3>),
you can iterate throw all the rows, by checking the if
$(avp(xxx)[$var(idx)]) is NULL or not (where $var(idx) is the variable
in the while loop).
>
> Inside the loop, simply store the row (all the AVPs with that index)
into cache DB .
>
Just a example, if I understand what you mean:
https://gist.github.com/was4444/ef203d871d5ed3b32144d41787862ac0
<https://gist.github.com/was4444/ef203d871d5ed3b32144d41787862ac0>
It seems that we cannot fetch AVPs use `cache_fetch("local",
"attribute", $avp(values))` according to the document
https://www.opensips.org/Documentation/Script-CoreFunctions-2-2#toc4
<https://www.opensips.org/Documentation/Script-CoreFunctions-2-2#toc4>
Regards,
xiaofeng
--
gpg key fingerprint:
2048R/5E63005B
C84F 671F 70B7 7330 4726 5EC8 02BC CBA2 5E63 005B
--
_______________________________________________
Users mailing list
[email protected] <mailto:[email protected]>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
<http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
--
xiaofeng
--
gpg key fingerprint:
2048R/5E63005B
C84F 671F 70B7 7330 4726 5EC8 02BC CBA2 5E63 005B
--
trans-zh_cn mailing list
[email protected]
<mailto:[email protected]>
https://admin.fedoraproject.org/mailman/listinfo/trans-zh_cn
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users