[Home]

Summary:ASTERISK-22620: GotoIf in 'h' extension works incorrectly
Reporter:newborn (newborn838)Labels:
Date Opened:2013-10-01 10:23:07Date Closed:2013-11-01 10:29:25
Priority:MajorRegression?
Status:Closed/CompleteComponents:Applications/app_dial
Versions:1.8.23.1 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:i'm comparing two values - TIMER and ALERT_TIMEOUT in 'h' extension.

GotoIf works only if second value is equal 1.
Otherwise does not works.
{noformat}
   Set(TIMER=${CDR(duration)})
   NoOp(${ALERT_TIMEOUT})
   GotoIf($["${TIMER}">="${ALERT_TIMEOUT}"]?alert:cont)
{noformat}


result is:

{noformat}
   -- Executing [h@calltest-lync_group_check:2] Set("SIP/lyncserv01-00000002", "TIMER=10") in new stack
   -- Executing [h@calltest-lync_group_check:3] NoOp("SIP/lyncserv01-00000002", "9") in new stack
   -- Executing [h@calltest-lync_group_check:4] GotoIf("SIP/lyncserv01-00000002", "0?alert:cont") in new stack
{noformat}


As you can see, 10 is greater than 9, the app `thinks` not.

in case if ALERT_TIMEOUT=1:

{noformat}
   -- Executing [h@calltest-lync_group_check:2] Set("SIP/lyncserv01-00000003", "TIMER=11") in new stack
   -- Executing [h@calltest-lync_group_check:3] NoOp("SIP/lyncserv01-00000003", "1") in new stack
   -- Executing [h@calltest-lync_group_check:4] GotoIf("SIP/lyncserv01-00000003", "1?alert:cont") in new stack
{noformat}

it's a major bug.
Comments:By: Michael L. Young (elguero) 2013-10-03 15:53:29.592-0500

How about removing the quotes around the variables?

{noformat}
GotoIf($[${TIMER}>=${ALERT_TIMEOUT}]?alert:cont)
{noformat}

By: David Woolley (davidw) 2013-10-31 06:29:32.886-0500

I'd agree with the theory that is a user error as the result of forcing a sting comparison using quotation marks.  In any case, there is nothing special about the h extension in relation to expression evaluation, and the problem is being caused by that, not the goto.

By: Matt Jordan (mjordan) 2013-11-01 10:29:25.900-0500

Closing out as Not a Bug, as this appears to be a configuration issue. If you have additional problems with configuring the dialplan, please feel free to raise your question on the asterisk-users mailing list or the #asterisk IRC channel.