[Home]

Summary:ASTERISK-12485: STAT() inside IF() doesn't work
Reporter:pj (pj)Labels:
Date Opened:2008-07-30 06:34:59Date Closed:2008-07-30 17:04:39
Priority:MinorRegression?No
Status:Closed/CompleteComponents:PBX/pbx_ael
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:${STAT(e,/tmp/test.txt)}
returns 1 if called from NoOP, but when is inside IF, it returns zero,
when ael is compiled, you can see weird thing, that STAT has separator 'pipe' when is in NoOP, but has 'comma' when is inside IF()
this issue has workaround: if use 'pipe' instead of 'comma' in ael dialplan, but it's inconsistent what is said in STAT() help
svn trunk doesn't have this issue.

simple ael dialplan test:

 995 => {
       NoOP(test file ${STAT(e,/tmp/test.txt)});
       if (${STAT(e,/tmp/test.txt)})
        NoOP(file exist);
       else
        NoOP(does not exist);
       Congestion;
 }


compiled:
 '995' =>          1. NoOP(test file ${STAT(e|/tmp/test.txt)})   [pbx_ael]
                   2. GotoIf($[${STAT(e,/tmp/test.txt)}]?3:5)    [pbx_ael]
                   3. NoOP(file exist)                           [pbx_ael]
                   4. Goto(6)                                    [pbx_ael]
                   5. NoOP(does not exist)                       [pbx_ael]
                   6. NoOp(Finish if-zamestnanci-169)            [pbx_ael]
                   7. Congestion()                               [pbx_ael]



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


   -- Executing [995@zamestnanci:1] NoOp("SIP/193.179.38.20-081d90f8", "test file 1") in new stack
   -- Executing [995@zamestnanci:2] GotoIf("SIP/193.179.38.20-081d90f8", "0?3:5") in new stack
   -- Goto (zamestnanci,995,5)
   -- Executing [995@zamestnanci:5] NoOp("SIP/193.179.38.20-081d90f8", "does not exist") in new stack
   -- Executing [995@zamestnanci:6] NoOp("SIP/193.179.38.20-081d90f8", "Finish if-zamestnanci-169") in new stack
Comments:By: pj (pj) 2008-07-30 06:36:40

similar issue in bugreport ASTERISK-1297051

By: Digium Subversion (svnbot) 2008-07-30 16:53:59

Repository: asterisk
Revision: 134652

U   branches/1.4/pbx/pbx_ael.c

------------------------------------------------------------------------
r134652 | murf | 2008-07-30 16:53:58 -0500 (Wed, 30 Jul 2008) | 19 lines

(closes issue ASTERISK-12485)
Reported by: pj

(closes issue ASTERISK-12358)
Reported by: pj

This patch substitutes commas in the expr
supplied to the if () statement, as in
if ( expr ) ...

This solves both the bugs above, and makes
the source symmetric with switch statements,
which were earlier reported to need this sort
of treatment.

I tested this using the examples, both for
the compiler and at run time. Looks good.


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

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