Question about global variables

If I have a dial plan as follows:

[broadcast]
exten => s,1,DigitTimeout(5)
exten => s,2,ResponseTimeout(5)
exten => s,3,SetVar(AMDSTATUS=0)
exten => s,4,Answer
exten => s,5,Set(STATUS=‘Answer’)
exten => s,6,Goto(broadcast2,s,1)

[broadcast2]
exten => s,1,DigitTimeout(4)
exten => s,2,ResponseTimeout(4)
exten => s,3,GotoIf($["${STATUS}" = “Answer”]?t,9)

Does the variable get passed along to broadcast2 or do I have to set the variable using Set(STATUS=‘Answer’|g)? |g is for global variables, but I only want the variable for this channel only (as I have multiple concurrent channels and I don’t want the variables shared).

Thanks.

Variable is present in diffrent context.
You can always use noop command and check dialplan flow in CLI.
[broadcats2]
exten => s,1,noop(${STATUS})

Hi This is a prickly one and seems to have changed with releases up through 1.2 but any way what you have to do is put a _ or a __ in front, dont set it as a global. Noop is the best way to check its being passsed

here i sthe extract from the wiki

[quote]Inheritance of Channel Variables
Prepending a single _ character to a variables name in SetVar will cause that variable to be inherited by channels created by the main channel. eg. when using Dial(Local/…); once inherited these variables will not be further inherited. Prepending two _ characters will cause them to be inherited indefinitely.

Note that for retrieval purposes these variable names do not include the underscores.

[TestInherit]
exten => 100,1,SetVar(__FOO=5)
exten => 100,2,Dial(Local/test@CheckInherit)
exten => test,1,NoOp(${FOO})

will result in FOO being inherited. Without the underscores, the new local channel would start with a clean slate.
[/quote]

I use this a lot, but you do need to test with noop

So if I put __STATUS it will be inherited in [broadcast2] for that call only but not get used by any other outgoing calls on different channels?

Well thats the theory, It wont be avalible to other channels but use noop to check that its inherited.

Testing it is the best method as it can work differntly depending on dialplan

Ian