Hi everyone,

for some reason I cannot get even the simplest for loop to work with
OpenPBX, RC3 or SVN trunk. The same code works fine with Asterisk
1.2.X. Any ideas what's wrong? Obviously the variable x is not being
incremented as expected, but why? I tried a different variable name
but it makes no difference.

AEL code:

for(x=0; ${x} < 3; x=${x} + 1) {
  NoOp(${x});
  Playback(welcome);
};

Translated code:

  's' =>            1. Set(x=$[0])                                [pbx_ael]
                    2. GotoIf($[ ${x} < 3]?3:7)                   [pbx_ael]
                    3. NoOp(${x})                                 [pbx_ael]
                    4. Playback(welcome)                          [pbx_ael]
                    5. Set( x=$[${x} + 1])                        [pbx_ael]
                    6. Goto(2)                                    [pbx_ael]
                    7. NoOp(Finish for-test-549)                  [pbx_ael]

Runtime output:

    -- Executing Set("SIP/luki1-53f3", "x=0") in new stack
    -- Executing GotoIf("SIP/luki1-53f3", "1?3:7") in new stack
    -- Goto (macro-test,s,3)
    -- Executing NoOp("SIP/luki1-53f3", "0") in new stack
    -- Executing Playback("SIP/luki1-53f3", "welcome") in new stack
    -- Playing 'welcome' (language 'en')
    -- Executing Set("SIP/luki1-53f3", " x=1") in new stack
    -- Executing Goto("SIP/luki1-53f3", "2") in new stack
    -- Goto (macro-test,s,2)
    -- Executing GotoIf("SIP/luki1-53f3", "1?3:7") in new stack
    -- Goto (macro-test,s,3)
    -- Executing NoOp("SIP/luki1-53f3", "0") in new stack
    -- Executing Playback("SIP/luki1-53f3", "welcome") in new stack
    -- Playing 'welcome' (language 'en')
    -- Executing Set("SIP/luki1-53f3", " x=1") in new stack
    -- Executing Goto("SIP/luki1-53f3", "2") in new stack
    -- Goto (macro-test,s,2)
    -- Executing GotoIf("SIP/luki1-53f3", "1?3:7") in new stack
    -- Goto (macro-test,s,3)
    -- Executing NoOp("SIP/luki1-53f3", "0") in new stack
    -- Executing Playback("SIP/luki1-53f3", "welcome") in new stack
    -- Playing 'welcome' (language 'en')
    -- Executing Set("SIP/luki1-53f3", " x=1") in new stack
    -- Executing Goto("SIP/luki1-53f3", "2") in new stack
    -- Goto (macro-test,s,2)
    -- Executing GotoIf("SIP/luki1-53f3", "1?3:7") in new stack
    -- Goto (macro-test,s,3)
    -- Executing NoOp("SIP/luki1-53f3", "0") in new stack
    -- Executing Playback("SIP/luki1-53f3", "welcome") in new stack
    -- Playing 'welcome' (language 'en')
...

--Luki
_______________________________________________
Openpbx-users mailing list
[email protected]
http://lists.openpbx.org/mailman/listinfo/openpbx-users

Reply via email to