[asterisk-bugs] [Asterisk 0011957]: Dialplan functions are executed before conditions are evaluated
noreply at bugs.digium.com
noreply at bugs.digium.com
Fri Feb 8 12:36:51 CST 2008
The following issue has been UPDATED.
======================================================================
http://bugs.digium.com/view.php?id=11957
======================================================================
Reported By: blitzrage
Assigned To:
======================================================================
Project: Asterisk
Issue ID: 11957
Category: Applications/app_exec
Reproducibility: always
Severity: minor
Priority: normal
Status: acknowledged
Asterisk Version: 1.4.17
SVN Branch (only for SVN checkouts, not tarball releases): N/A
SVN Revision (number only!):
Disclaimer on File?: N/A
Request Review:
======================================================================
Date Submitted: 02-08-2008 11:29 CST
Last Modified: 02-08-2008 12:36 CST
======================================================================
Summary: Dialplan functions are executed before conditions
are evaluated
Description:
I'm opening this for a bit of discussion as I believe the following
conditions could result in inefficiencies in the dialplan.
I have the following bit of dialplan code:
exten => h,n,Verbose(1,DIALSTATUS = ${DIALSTATUS})
exten => h,n,ExecIf($[${DIALSTATUS} =
ANSWER],Set,TIME_USED=${MATH(${ANSWEREDTIME}/60,f)})
But when I execute it in the dialplan, I end up with this:
-- Executing [h at subPlaceCall:2] Verbose("SIP/4918847473-1565e170",
"1|DIALSTATUS = CANCEL") in new stack
DIALSTATUS = CANCEL
[Feb 8 12:21:51] WARNING[19032]: func_math.c:169 math: '' is not a valid
number
-- Executing [h at subPlaceCall:3] ExecIf("SIP/4918847473-1565e170",
"0|Set|TIME_USED=") in new stack
Which appears to be that the MATH() function is being executed before the
condition is checked. That seems backwards to me in that the condition
should be checked before any action is taken on the arguments provided.
I've seen the same behaviour with the IF() function as well:
exten => h,n,Exec(${IF(${DIALSTATUS} =
ANSWER]?Set(TIME_USED=${MATH(${ANSWEREDTIME}/60,f)}):NoOp())})
Same behaviour happens where MATH() returns an error because
${ANSWEREDTIME} is not populated (and it shouldn't be -- the call was not
answered).
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
02-08-08 12:36 blitzrage Summary It appears that a true
branch is executed even when ExecIf() returns false => Dialplan functions are
executed before conditions are evaluated
======================================================================
More information about the asterisk-bugs
mailing list