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

2016-09-22 Thread xiaofeng
On Thu, Sep 22, 2016 at 1:08 AM,  wrote:
>
> You could probably also built a JSON array from looping through the avp
and store that as the value in the cache store.

Does that mean I need the json module? I didn't include the json module,
maybe I can try it the next time.

Regards,

xiaofeng

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


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

2016-09-21 Thread jarrod
You could probably also built a JSON array from looping through the avp and 
store that as the value in the cache store.

> On Sep 21, 2016, at 8:18 AM, xiaofeng  wrote:
> 
> 
> On Wed, Sep 21, 2016 at 9:02 PM, Bogdan-Andrei Iancu  > wrote:
> >
> > 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.
> >
> 
> Ah, yes, that should work, thanks, Bogdan.
> 
> Regards,
> 
> xiaofeng
> 
> ___
> Users mailing list
> Users@lists.opensips.org 
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users 
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


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

2016-09-20 Thread Bogdan-Andrei Iancu

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 .


Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 18.09.2016 12:15, xiaofeng wrote:

Hi there,

I want to save several avp_db_query-values to one attribute use 
cache_store at startup, how to do that?


Thanks.

--
xiaofeng

--
gpg key fingerprint:
2048R/5E63005B
C84F 671F 70B7 7330 4726  5EC8 02BC CBA2 5E63 005B
--
trans-zh_cn mailing list
trans-zh...@lists.fedoraproject.org 


https://admin.fedoraproject.org/mailman/listinfo/trans-zh_cn


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users