http://www.kamailio.org/wiki/cookbooks/5.5.x/core#arithmetic_operations
$RANDOM mod 100 Should give you random ints between 0 and 99. On Wed, May 4, 2022, 03:41 Joel Serrano <[email protected]> wrote: > I did, but I don't see how to limit the range: > > From the docs: Returns a random value from the [0 - 2^31) range. > > Is there a way to limit the range from 1-100 for example? Or maybe the way > is to use $RANDOM and just rely on the first/last 2 digits (essentially a > 00-99 range)? > > > On Tue, May 3, 2022 at 10:40 AM Henning Westerholt <[email protected]> wrote: > >> Hello, >> >> >> >> what about just using this PV: >> https://kamailio.org/docs/modules/5.5.x/modules/cfgutils.html#idm438 >> >> >> >> Cheers, >> >> >> >> Henning >> >> >> >> -- >> >> Henning Westerholt – https://skalatan.de/blog/ >> >> Kamailio services – https://gilawa.com >> >> >> >> *From:* sr-users <[email protected]> *On Behalf Of *Joel >> Serrano >> *Sent:* Tuesday, May 3, 2022 6:20 PM >> *To:* Kamailio (SER) - Users Mailing List <[email protected]> >> *Subject:* [SR-Users] Tips on picking random element from a list >> >> >> >> Hi Everyone, >> >> >> >> I have to implement a flow where outbound calls get their caller-id set >> with a random number from a pool. >> >> >> >> I've been looking around and, as most of the time, there are tons of ways >> to implement something like this... This is a simple implementation, the >> number pool is fixed and will not change (so I could have it hard-coded in >> the config if required). >> >> >> >> My initial approach was: >> >> >> >> 1- Try to keep it simple, with no dependencies, and all done in the >> config script. >> >> 2- If #1 is "ugly", then I'd probably go with some inline code using >> python/lua/etc >> >> 3- If #2 is "ugly", then I'd go with having the info in a DB and just run >> a query >> >> >> >> I think #2 and #3 might be overkill for something so "simple" but I >> haven't had to work too much with randomness in Kamailio, so any >> tips/suggestions on where to store the number list and how to pick one >> randomly would be awesome! >> >> >> >> Thanks!! >> >> Joel. >> >> >> > __________________________________________________________ > Kamailio - Users Mailing List - Non Commercial Discussions > * [email protected] > Important: keep the mailing list in the recipients, do not reply only to > the sender! > Edit mailing list options or unsubscribe: > * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >
__________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions * [email protected] Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe: * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
