Re: [SR-Users] Random number generation kamailio

2016-03-23 Thread Daniel Tryba
On Wed, Mar 23, 2016 at 04:49:09PM +0530, Cibin Paul wrote: > $var(x) = 123456789012; > > $fU = $var(x); > uac_replace_from("$var(x)","”); > > > The above code is assigning cli with 2147483647. Could you please help me on > this Seeing the value 2147483647 should trigger some neurons (it is 2^

Re: [SR-Users] Random number generation kamailio

2016-03-23 Thread Cibin Paul
Perfect. That solved my issue. You are saviour Thanks & Regards Cibin > On 23-Mar-2016, at 4:49 PM, Daniel-Constantin Mierla > wrote: > > The $random gives an integer value, so max length is 10. Actually, vars in > config file can be either integer or string. If you want a larger length yo

Re: [SR-Users] Random number generation kamailio

2016-03-23 Thread Daniel-Constantin Mierla
The $random gives an integer value, so max length is 10. Actually, vars in config file can be either integer or string. If you want a larger length you can build it as tring from two other random values. Like: $var(r1) = $RANDOM; $var(r2) = $RANDOM; $var(largerandom) = "" + $var(r1) + $var(r2);

Re: [SR-Users] Random number generation kamailio

2016-03-23 Thread Cibin Paul
The problem is not with RANDOM. $fU is not taking more than 10 digit number. What could be the reason? $var(x) = 123456789012; $fU = $var(x); uac_replace_from("$var(x)","”); The above code is assigning cli with 2147483647. Could you please help me on this Regards Cibin > On 23-Mar-2016,

Re: [SR-Users] Random number generation kamailio

2016-03-23 Thread Cibin Paul
Daniel, I tried using $RANDOM. It is always giving a random value between 9 digits to 10 digits How can I get a random value between 10 digits to 13 digits. Regards Cibin > On 22-Mar-2016, at 1:19 PM, Cibin Paul wrote: > > Thanks Daniel for the pointer. I will check both modules > > Rega

Re: [SR-Users] Random number generation kamailio

2016-03-22 Thread Cibin Paul
Thanks Daniel for the pointer. I will check both modules Regards Cibin > On 22-Mar-2016, at 1:13 PM, Daniel-Constantin Mierla > wrote: > > > > On 22/03/16 08:40, Cibin Paul wrote: >> Thanks Daniel, >> >> I will try app_lua as you said this being faster compared to $RANDOM. > I didn't sa

Re: [SR-Users] Random number generation kamailio

2016-03-22 Thread Daniel-Constantin Mierla
On 22/03/16 08:40, Cibin Paul wrote: > Thanks Daniel, > > I will try app_lua as you said this being faster compared to $RANDOM. I didn't say that app_lua is faster than $RANDOM -- what I said is that app_lua is also fast. > > Now if I want to modify the caller id number (ANI) , can I assign the

Re: [SR-Users] Random number generation kamailio

2016-03-22 Thread Cibin Paul
Thanks Daniel, I will try app_lua as you said this being faster compared to $RANDOM. Now if I want to modify the caller id number (ANI) , can I assign the newly generated number to the variable $fU? Regards Cibin > On 22-Mar-2016, at 12:50 PM, Daniel-Constantin Mierla > wrote: > > Hello,

Re: [SR-Users] Random number generation kamailio

2016-03-22 Thread Daniel-Constantin Mierla
Hello, besides $RANDOM from cfgutils as pointed already, you can use an embedded interpreter (e.g., app_lua is really fast). If you need some unique values, but not only numbers, see uuid module. Cheers, Daniel On 22/03/16 07:54, Cibin Paul wrote: > Hi, > > How can I generate a random number sa

Re: [SR-Users] Random number generation kamailio

2016-03-22 Thread Cibin Paul
Thanks a lot Alex, Now using this random generated number, can I modify the ANI something like this on INVITE if(!($fU=~"^(\+1|1[1-9][0-9]{10})$")) { $fU = ($RANDOM / 73249615); } Regards Cibin > On 22-Mar-2016, at 12:28 PM, Alex Balashov wrote: > > Cibin, >

Re: [SR-Users] Random number generation kamailio

2016-03-21 Thread Alex Balashov
Cibin, Yes, that is what $RANDOM is for. It returns a 32-bit signed integer (‎range 0 - 2^31), so you can divide it by the appropriate value to get something in the length range you're after. ‎ -- Alex Balashov | Principal | Evariste Systems LLC 1447 Peachtree Street NE, Suite 700 Atlanta, GA 30