Hello
I’m working with Asterisk 1.4, and noticed that the value of a global variable is empty when jumping to another context through a local channel:
[globals]
CID=
[from_fxo]
exten => s,1,Wait(2)
exten => s,n,Set(CID=${CALLERID(num)})
exten => s,n,Hangup
exten => h,1,NoOp(In h CID is ${CID})
exten => h,n,Dial(Local/start@callback)
[callback]
;WHY IS CID EMPTY?
exten => start,1,NoOp(In callback CID is ${CID})
I re-read the relevant chapters of the third edition of “Asterisk: The Definitive Guide ”, but didn’t find an explanation.
Does someone know why the global variable above is empty in the [callback] context, and if there’s a solution?
Thank you.
david55
February 23, 2011, 11:37am
2
You have shadowed the global variable with a local variable of the same name. You need to set the global variable.
Thanks David. I thought including the variable in [globals] was enough: What is the right way to set the value of a global variable so that it carries to another context?
david55
February 24, 2011, 12:34pm
4
core show function GLOBAL
Thanks for the info. This is the first time I use a variable across two contexts, so didn’t know I had to use a specific function:
wiki.asterisk.org/wiki/display/ … les+Basics