explode function

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

explode function

Schneur Rosenberg
Hi, I'm trying to store a list of gateways in memcache, due to NoSQL
nature I can't store a avp with multiple values, so I used the avp
with the [*] which gave me a comma delimited list which I can store,
now I want to create a array of all the values similar to explode() in
php.

The closest thing I can think of is to use {s.select,index,separator}
but that would be very messy, as I would need to use a while loop with
{s.index} until it returns -1 and use the {s.select,index,separator}
to populate the array, I was hoping that there is a easier way, does a
easier way exist?

thank you
S. Rosenberg

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: explode function

Bogdan-Andrei Iancu-2
Hi Schneur,

There is no "explode" like in php - I guess you need to stick to
s.select for the moment (some major changes on handling arrays from
script are planned for the future releases). To have a clean script,
simply make a route[] dedicated to unpack a comma separated list into a
multi-value AVP ;)

Regards,

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

OpenSIPS Bootcamp 2017, Houston, US
   http://opensips.org/training/OpenSIPS_Bootcamp_2017.html

On 06/02/2017 12:55 PM, Schneur Rosenberg wrote:

> Hi, I'm trying to store a list of gateways in memcache, due to NoSQL
> nature I can't store a avp with multiple values, so I used the avp
> with the [*] which gave me a comma delimited list which I can store,
> now I want to create a array of all the values similar to explode() in
> php.
>
> The closest thing I can think of is to use {s.select,index,separator}
> but that would be very messy, as I would need to use a while loop with
> {s.index} until it returns -1 and use the {s.select,index,separator}
> to populate the array, I was hoping that there is a easier way, does a
> easier way exist?
>
> thank you
> S. Rosenberg
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Loading...