[asterisk-users] AEL2 Looping

Douglas Garstang dgarstang at oneeighty.com
Fri Jul 28 13:56:42 MST 2006


I was just experimenting with AEL2, and tried to use a for loop as per the example.
Here's what I have.

context new_pbx_betty_start {

    _X. => { 
        for (x=0; ${x} < 3; x=${x} + 1) { 
            Verbose(x is ${x} !); 
        }                  
    }; 

}

Here's the output.

The var x never gets incremented! Is this a bug?
The while loops seem to work ok.

x is 0 !
    -- Executing Set("SIP/3254101-db4b", " x=1") in new stack
    -- Executing Goto("SIP/3254101-db4b", "2") in new stack
    -- Goto (new_pbx_betty_start,36521478,2)
    -- Executing GotoIf("SIP/3254101-db4b", "1?3:6") in new stack
    -- Goto (new_pbx_betty_start,36521478,3)
    -- Executing Verbose("SIP/3254101-db4b", "x is 0 !") in new stack
x is 0 !
    -- Executing Set("SIP/3254101-db4b", " x=1") in new stack
    -- Executing Goto("SIP/3254101-db4b", "2") in new stack
    -- Goto (new_pbx_betty_start,36521478,2)
    -- Executing GotoIf("SIP/3254101-db4b", "1?3:6") in new stack
    -- Goto (new_pbx_betty_start,36521478,3)
    -- Executing Verbose("SIP/3254101-db4b", "x is 0 !") in new stack
x is 0 !
    -- Executing Set("SIP/3254101-db4b", " x=1") in new stack
    -- Executing Goto("SIP/3254101-db4b", "2") in new stack
    -- Goto (new_pbx_betty_start,36521478,2)
    -- Executing GotoIf("SIP/3254101-db4b", "1?3:6") in new stack
    -- Goto (new_pbx_betty_start,36521478,3)
    -- Executing Verbose("SIP/3254101-db4b", "x is 0 !") in new stack
x is 0 !
    -- Executing Set("SIP/3254101-db4b", " x=1") in new stack
    -- Executing Goto("SIP/3254101-db4b", "2") in new stack
    -- Goto (new_pbx_betty_start,36521478,2)
    -- Executing GotoIf("SIP/3254101-db4b", "1?3:6") in new stack
    -- Goto (new_pbx_betty_start,36521478,3)
    -- Executing Verbose("SIP/3254101-db4b", "x is 0 !") in new stack
x is 0 !
    -- Executing Set("SIP/3254101-db4b", " x=1") in new stack
    -- Executing Goto("SIP/3254101-db4b", "2") in new stack
    -- Goto (new_pbx_betty_start,36521478,2)
    -- Executing GotoIf("SIP/3254101-db4b", "1?3:6") in new stack
    -- Goto (new_pbx_betty_start,36521478,3)
    -- Executing Verbose("SIP/3254101-db4b", "x is 0 !") in new stack



x is 0 !



More information about the asterisk-users mailing list