Set() Global variable manipulation

The problem is that I’m trying to manipulate a global variable, but I am not storing the change. The macros work, and it looks like it should be setting the new value, but when the value is retrieved for logic later, it hasn’t been modified. For the record, the callerid(name) is not modified, either.

Here’s the code snippets:

[globals]
 PLAYINTRO=0                               ; used to determine which intro to play.
 FROM_OFFICE=1                             ; Used with PLAY_INTRO
...
[macro-change-cid-name]
 exten => s,1,GotoIf($["${CALLERID(num)}" = "6785551234"]?2:4)
 exten => s,n,Set(${CALLERID(name)} = "Office")
 exten => s,n,Set(GLOBAL(${PLAYINTRO}) = ${FROM_OFFICE})
...
[macro-play-intro]
 exten => s,1,NoOp(${PLAYINTRO})
 exten => s,n,GotoIf(${PLAYINTRO} = 0?3:4)
 exten => s,n,Background(boring_intro)

Obviously I’ve modified the debug, but on line 2, it looks to set the variable correctly, but in the NoOp on line 6, it’s clearly returning the original value of 0.

Thanks for your help!

After upgrading from 1.4.15 to 1.4.18, I noticed something in the improved debug messages – I was trying to set the VALUE of the variable to the new value… I was not trying to set the variable itself to the new value.

Code modified to:

 exten => s,n,GotoIf($["${CALLERID(num)}" = "7705551234"]?20:22)
 exten => s,n,Set(CALLERID(name)="Somebody")
 exten => s,n,Set(GLOBAL(PLAYINTRO)=${FROM_OFFICE})

Both variables are updating as expected. I can NoOp them in another macro to verify this.

I still get bad logic, though:

Regardless of the fact that 1 != 0. If I drop the quotes in the GotoIf statement surrounding the values being compared, I still don’t get working logic.

bracketed gotoif for fix:

exten => s,n,GotoIf($[${PLAYINTRO}=0]?3:4)