[OpenSIPS-Users] Fwd: How to save avp-values to singal attribute name in cache_store?

xiaofeng wasphin at gmail.com
Wed Sep 21 11:09:55 CEST 2016


On Tue, Sep 20, 2016 at 7:25 PM, Bogdan-Andrei Iancu <bogdan at opensips.org>
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
>
> Using a while loop (see 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

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


Regards,

xiaofeng

--
gpg key fingerprint:
2048R/5E63005B
C84F 671F 70B7 7330 4726  5EC8 02BC CBA2 5E63 005B
--
_______________________________________________
Users mailing list
Users at lists.opensips.org
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
trans-zh_cn at lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/trans-zh_cn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20160921/97f92ff9/attachment-0001.htm>


More information about the Users mailing list