[Home]

Summary:ASTERISK-12367: random appears to be broken
Reporter:danpwi (danpwi)Labels:
Date Opened:2008-07-12 02:11:20Date Closed:2008-07-12 05:19:53
Priority:MinorRegression?No
Status:Closed/CompleteComponents:PBX/pbx_ael
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:As far as I can tell, random() always returns false.  To reproduce:

context ael-randtest {
  123 => {
     one=0; two=0;
     for(x=0; ${x} < 100; x=${x} + 1) {
        random(50)
           one=${one} + 1;
        else
           two=${two} + 1;
     }
     Verbose(0,${one} ${two});
  }
}

and then 'originate Local/123@ael-randtest application noop' from the CLI.  It always outputs '0 100' as opposed to the expected (approx) 50 50.

****** ADDITIONAL INFORMATION ******

Changing RAND(0,99) to RAND(0|99) in pbx_ael.c seems to fix it, but I have no idea if that's the correct solution.
Comments:By: Digium Subversion (svnbot) 2008-07-12 05:18:12

Repository: asterisk
Revision: 130373

U   branches/1.4/pbx/pbx_ael.c

------------------------------------------------------------------------
r130373 | mvanbaak | 2008-07-12 05:18:09 -0500 (Sat, 12 Jul 2008) | 6 lines

in 1.4 the functions still have | as argument seperator.
This commit fixes the use of RAND in the ael random function.

(closes issue ASTERISK-12367)
Reported by: danpwi

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=130373

By: Michiel van Baak (mvanbaak) 2008-07-12 05:19:53

Thank you.

This is indeed the correct fix for 1.4
1.6 and trunk use the , as seperator. 1.4 still uses the |