The backstory is that I am trying to debug an issue I am having with FreePBX currently. The channel variable REC_STATUS
is set to RECORDING
when it shouldn't be.
After quite a bit of troubleshooting and no sign of anything in the dialplan that could be causing this, I decided to insert a NoOp(${REC_STATUS})
as the first line of dialplan code to be executed for a new incoming call. Guess what? REC_STATUS
is already set to RECORDING
as of the first line of dialplan execution for these new calls.
My question is this: how is this channel variable already set before the dialplan starts executing?
It turns out that there's a way to set global variables in Asterisk, and when you go to request a variable for a channel, the global value will be shown if the variable has not been set otherwise on the channel.
I resolved my issue by executing the following on the dialplan once:
Set(GLOBAL(REC_STATUS)=)
Using any of these options did not work: