Summary:ASTERISK-06647: GosubIf cmd doesn't handle regular expressions like GotoIf, the result is always FALSE
Reporter:Ramon Peek-Fares (ramonpeek)Labels:
Date Opened:2006-03-29 04:34:46.000-0600Date Closed:2006-03-29 13:31:36.000-0600
Versions:Frequency of
Description:I found out that the "GosubIf" command doesn't handle regular expressions like the "GotoIf" command does, with the "GosubIf" command the result is alway FALSE.
As far as I know the "GosubIf" command should be able to handle the same conditions as the "GotoIf" command, right?

****** STEPS TO REPRODUCE ******

I use this little dialplan to test:

exten => 778,1,Set(FOO=Test1234)
exten => 778,n,GotoIf($[${FOO} : Test]?TRUE)
exten => 778,n,HangUp
exten => 778,n(TRUE),NoOp(It's True!)
exten => 778,n,HangUp

exten => 779,1,Set(FOO=Test1234)
exten => 779,n,GosubIf($[${FOO} : Test]?TRUE)
exten => 779,n,HangUp
exten => 779,n(TRUE),NoOp(It's True!)
exten => 779,n,Return
Comments:By: Peng Yong (ppyy) 2006-03-29 08:05:50.000-0600

i check the code and find the judgement of condition in GotoIf and GosubIf are not same.

in GotoIf, If the string is empty or "0", the condition is considered to be false. If it is anything else, the condition is true.

in GosubIf, the condition is considered to be true only when the string is in following string: "yes", "true", "y", "t", "1", "on".

By: Ramon Peek-Fares (ramonpeek) 2006-03-29 09:11:56.000-0600

Do you think there is any special reason why this is done?

I feel the GosubIf function should work just like the GotoIf function and I cannot find any documentation saying else

By: Peng Yong (ppyy) 2006-03-29 09:18:26.000-0600

app_stack.c was written by Corydon76. maybe he know

By: Tilghman Lesher (tilghman) 2006-03-29 13:31:36.000-0600

Fix committed to 1.2, merged to trunk