[OpenSIPS-Users] Fwd: How to save avp-values to singal attribute name in cache_store?
Bogdan-Andrei Iancu
bogdan at opensips.org
Wed Sep 21 15:02:55 CEST 2016
When you add the values in local cache, for each value you have to set a
different key. Instead of :
cache_store("local", "domain", "$(avp(domains)[$var(id)])");
do
cache_store("local", "domain_$var(id)", "$(avp(domains)[$var(id)])");
By doing that, you add one key for each domain value.
Then you can iterate and fetch from cache the domain_$var(id) until
nothing is returned anymore.
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com
On 21.09.2016 15:00, xiaofeng wrote:
> Hi, Bogdan,
>
> > 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.
>
> Yes, I want all values bind to the same key. And that's the problem, I
> think.
>
> >
> > The second "while" loop has no sense, as a key (in cache) has only
> one value (cannot be multiple).
>
> Regards,
>
> xiaofeng
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org <mailto: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/20160921/733d4a77/attachment.htm>
More information about the Users
mailing list