[OpenSIPS-Users] Anyway to count the numbers of entires in a AVP?

2010-06-19 Thread Brad Bendy
Hi list, Ive got a AVP that gets a value from a memcached store, it's a set of integers separated by commas , ex: 4,34,1,10 Is there a way to return the number of entries? In this case id like to have a 4 returned. I cannot get {param.count} to work, but im not sure if it works like this or mayb

Re: [OpenSIPS-Users] Anyway to count the numbers of entires in a AVP?

2010-06-19 Thread Brett Nemeroff
Brad, param.count is for URI parameters and can't be used for any old format. If your string was in URI param format, I think it would then work: http://www.opensips.org/Resources/DocsCoreTran16#toc36 I haven't used this transformation, but it appears you'd take the params off a URI and then use t

Re: [OpenSIPS-Users] Anyway to count the numbers of entires in a AVP?

2010-06-19 Thread Brad Bendy
Brett, I figured as much, but I thought I would try anyways. I think adding the "count" to the front the string is going to be easiest method and use the select functions, much more simpler! Thanks for the advice. On Sat, 2010-06-19 at 20:41 -0500, Brett Nemeroff wrote: > Brad, > param.count is

Re: [OpenSIPS-Users] Anyway to count the numbers of entires in a AVP?

2010-06-21 Thread Bogdan-Andrei Iancu
Hi Brad, I guess you are looking for the set_count() function: http://www.opensips.org/html/docs/modules/1.6.x/cfgutils.html#id228574 Regards, Bogdan -- Bogdan-Andrei Iancu OpenSIPS Bootcamp 20 - 24 September 2010, Frankfurt, Germany www.voice-system.ro Brad Bendy wrote: > Brett, >

Re: [OpenSIPS-Users] Anyway to count the numbers of entires in a AVP?

2010-06-21 Thread Brett Nemeroff
Bogdan, Brad's AVP is a single AVP with CSV. He'd like to count the elements in the CSV. Some string array functions would be nice. :D -Brett On Mon, Jun 21, 2010 at 6:46 AM, Bogdan-Andrei Iancu wrote: > Hi Brad, > > I guess you are looking for the set_count() function: > > http://www.opensip

Re: [OpenSIPS-Users] Anyway to count the numbers of entires in a AVP?

2010-06-21 Thread Bogdan-Andrei Iancu
Ah, I see :) maybe we can make an new "csv" transformation Regards, Bogdan Brett Nemeroff wrote: > Bogdan, > Brad's AVP is a single AVP with CSV. He'd like to count the elements > in the CSV. > > Some string array functions would be nice. :D > -Brett > > > On Mon, Jun 21, 2010 at 6:46 A

Re: [OpenSIPS-Users] Anyway to count the numbers of entires in a AVP?

2010-06-21 Thread Brett Nemeroff
That'd be fantastic $avp(s:values) = "8,5,6,9,2,4,5"; $var(value_count) = $(avp(s:values){s.csv.count(\,)}); $var(value_third)=$(avp(s:values){s.csv.select(\,,3)}); $avp(s:value_array) = $(avp(s:values){s.csv.split(\,)}); # Makes: # $avp(s:value_array)[0]=8; # $avp(s:value_array)[1]=5; # ... $avp(s

Re: [OpenSIPS-Users] Anyway to count the numbers of entires in a AVP?

2010-06-21 Thread Bogdan-Andrei Iancu
btw, we have full support for using json string (a more complex way of packing information that a simple CSV) - see http://www.opensips.org/html/docs/modules/1.6.x/json.html . Also, if you do not want to deal with dynamic CSV tables, you can use even now the select transformation to extract eac

Re: [OpenSIPS-Users] Anyway to count the numbers of entires in a AVP?

2010-06-21 Thread Brad Bendy
String function would be nice, but with Brett's suggested work around I got it working, might even be faster then if we had string functions? I think as more people want to make custom LCR implementations and various things these type of functions will come up more im sure. I think with the additi

Re: [OpenSIPS-Users] Anyway to count the numbers of entires in a AVP?

2010-06-21 Thread Brett Nemeroff
You give away too much. :P -Brett On Mon, Jun 21, 2010 at 9:22 AM, Brad Bendy wrote: > String function would be nice, but with Brett's suggested work around I > got it working, might even be faster then if we had string functions? > > I think as more people want to make custom LCR implementatio

Re: [OpenSIPS-Users] Anyway to count the numbers of entires in a AVP?

2010-06-24 Thread Bogdan-Andrei Iancu
Hi Brad, Brad Bendy wrote: > String function would be nice, but with Brett's suggested work around > I got it working, might even be faster then if we had string functions? > > I think as more people want to make custom LCR implementations and > various things these type of functions will come u