Summary: | ASTERISK-05183: if...else executes both branches | ||
Reporter: | Alex Zhilyakov (azhilyakov) | Labels: | |
Date Opened: | 2005-09-28 21:04:30 | Date Closed: | 2011-06-07 14:03:05 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | PBX/pbx_ael |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ||
Description: | Hello, I'm running Asterisk 1.2-beta1 on Solaris 10. I have the following AEL script: context default { s => { Wait(1); Answer(); if (1) { NoOp(okey1); } else { NoOp(error1); }; if (0) { NoOp(error2); } else { NoOp(okey2); }; HangUp(); }; }; It debugs to the following: -- Executing Wait("SIP/64.152.60.6-00147598", "1") in new stack -- Executing Answer("SIP/64.152.60.6-00147598", "") in new stack Sep 29 01:55:56 DEBUG[1513]: pbx.c:1528 pbx_substitute_variables_helper_full: Expression is '1' -- Executing GotoIf("SIP/64.152.60.6-00147598", "1?4:6") in new stack -- Goto (default,s,4) -- Executing NoOp("SIP/64.152.60.6-00147598", "okey1") in new stack -- Executing GotoIf("SIP/64.152.60.6-00147598", "7") in new stack Sep 29 01:55:56 DEBUG[1513]: pbx.c:5827 pbx_builtin_gotoif: Not taking any branch -- Executing NoOp("SIP/64.152.60.6-00147598", "error1") in new stack -- Executing NoOp("SIP/64.152.60.6-00147598", "Finish if-s-3") in new stack Sep 29 01:55:56 DEBUG[1513]: pbx.c:1528 pbx_substitute_variables_helper_full: Expression is '0' -- Executing GotoIf("SIP/64.152.60.6-00147598", "0?9:11") in new stack -- Goto (default,s,11) -- Executing NoOp("SIP/64.152.60.6-00147598", "okey2") in new stack -- Executing NoOp("SIP/64.152.60.6-00147598", "Finish if-s-8") in new stack -- Executing Hangup("SIP/64.152.60.6-00147598", "") in new stack == Spawn extension (default, s, 13) exited non-zero on 'SIP/64.152.60.6-00147598' Expected behaviour: yield "okey1", then yield "okey2" Problem: debug shows script yielding "okey1", "error1", "okey2" instead. -Alex | ||
Comments: | By: Michael Jerris (mikej) 2005-09-28 21:07:52 I beleive this is fixed in cvshead. Can you please test and double check. By: Russell Bryant (russell) 2005-09-28 21:32:38 Using the context given in the bug with CVS HEAD, you get: [ Context 'aelblah' created by 'pbx_ael' ] 's' => 1. Wait(1) [pbx_ael] 2. Answer() [pbx_ael] 3. GotoIf($[ 1 ]?4:6) [pbx_ael] 4. NoOp(okey1) [pbx_ael] 5. Goto(7) [pbx_ael] 6. NoOp(error1) [pbx_ael] 7. NoOp(Finish if-s-3) [pbx_ael] 8. GotoIf($[ 0 ]?9:11) [pbx_ael] 9. NoOp(error2) [pbx_ael] 10. Goto(12) [pbx_ael] 11. NoOp(okey2) [pbx_ael] 12. NoOp(Finish if-s-8) [pbx_ael] 13. HangUp() [pbx_ael] So, it looks like this is fine in CVS-HEAD. It will be working as expected in the next beta release. Thanks for the report! |