[asterisk-users] Re: Generate Random Numbers in dialplan

Steve Murphy murf at parsetree.com
Fri Oct 13 21:30:54 MST 2006


On Fri, 2006-10-13 at 12:52:38 -0400, Jon Weisman <jweisman at ibell.net>
wrote:

>         Hi All,   Anyone know how to generate random numbers in the
>         dial plan? I've tried using the RAND function but it doesnt
>         work. Basically I need to generate a random 5 digit number
>         everytime a particular extension is dialed and then save that
>         into a variable. Any ideas?   Thanks, Jon

Jon--

RAND really does work, but in trunk it's documented to use a comma to
sep min and max, which
is wrong. You have to use the vertical bar (|). Try it, it does work:

AEL snippet:

                Set(junky=${RAND(0|99999)});
                Verbose(Here is a random number: ${junky}.);

murf

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3239 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20061013/fa5247cf/smime.bin


More information about the asterisk-users mailing list