M Suhayl
M Suhayl

Reputation: 27

Asterisk GOTOIf Command not hitting branch correctly

This is the code in my .conf file for asterisk freepbx I know for sure blocked is true

same => n,Noop(${Blocked})
same => n,GotoIf($["${Blocked}"=="TRUE"]?blah-ivr-v5-difficulties,s,1)
same => n,Noop("The code reaches here and doesnt hit the context at the top but its value is true")

This is the logs from asterisk saying Blocked is true

[2021-10-28 11:53:08] VERBOSE[11267][C-001e313b] pbx.c: Executing [s@blah-ivr-v5-pinreset-2:11] NoOp("SIP/blah-00245082", "true") in new stack

[2021-10-28 11:53:08] VERBOSE[11267][C-001e313b] pbx.c: Executing [s@blah-ivr-v5-pinreset-2:12] GotoIf("SIP/blah-00245082", "0?blah-ivr-v5-difficulties,s,1") in new stack

Any Idea why its not branching correctly?

Upvotes: 2

Views: 203

Answers (1)

arheops
arheops

Reputation: 15259

Unfortanly asterisk know nothing about machine learning etc and does not think that

"true" == "TRUE"

In this case both are strings and strings with capitals not the same as lower strings(see UTF-8 table).

Even more, asterisk's boolean value is 1(integer)

https://unicode-table.com/en/

http://www.asteriskdocs.org/en/2nd_Edition/asterisk-book-html-chunk/asterisk-APP-B-89.html

https://wiki.asterisk.org/wiki/display/AST/Manipulating+Variables+Basics

Upvotes: 1

Related Questions