[asterisk-bugs] [JIRA] (ASTERISK-29811) func_logic IF func (acf_if) inconsistent behavior

Ruslan Andronov (JIRA) noreply at issues.asterisk.org
Mon Dec 20 13:52:44 CST 2021


Ruslan Andronov created ASTERISK-29811:
------------------------------------------

             Summary: func_logic IF func (acf_if) inconsistent behavior
                 Key: ASTERISK-29811
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29811
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Functions/func_logic
    Affects Versions: 18.9.0
            Reporter: Ruslan Andronov


IF function strips quotes and slashes only from TRUE argument and FALSE argument of function stays untouched.

h3. Proof
Dialplan:
{noformat}
exten = test,1,GoSub(test_if_func,s,1)

[test_if_func]
exten = s,1,NoOp
 same = n,Set(TRUEARG="abcd" \$)
 same = n,Set(FALSEARG="gijk" \$)
 same = n,Set(TRUERES=${IF($[1=1]?${TRUEARG}:${FALSEARG})})
 same = n,Set(FALSERES=${IF($[1!=1]?${TRUEARG}:${FALSEARG})})
 same = n,NoOp(TRUERES:${TRUERES} FALSERES:${FALSERES})
{noformat}

Log:
{noformat}
    -- Executing [test at from-internal:1] Gosub("PJSIP/6789-00000003", "test_if_func,s,1") in new stack
    -- Executing [s at test_if_func:1] NoOp("PJSIP/6789-00000003", "") in new stack
    -- Executing [s at test_if_func:2] Set("PJSIP/6789-00000003", "TRUEARG="abcd" \$") in new stack
    -- Executing [s at test_if_func:3] Set("PJSIP/6789-00000003", "FALSEARG="gijk" \$") in new stack
    -- Executing [s at test_if_func:4] Set("PJSIP/6789-00000003", "TRUERES=abcd $") in new stack
    -- Executing [s at test_if_func:5] Set("PJSIP/6789-00000003", "FALSERES="gijk" \$") in new stack
    -- Executing [s at test_if_func:6] NoOp("PJSIP/6789-00000003", "TRUERES:abcd $ FALSERES:"gijk" \$") in new stack
{noformat}

it seems that function __ast_app_separate_args contains a bug.

but personally I will prefer that IF function will use AST_NONSTANDARD_RAW_ARGS macro like GotoIf and ExecIf

suggested patch is attached



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list