[asterisk-users] Scope of variable

Jim Dickenson dickenson at cfmc.com
Wed Jan 28 13:48:17 CST 2009


I have this extension:

exten => 1322,1,Answer()
exten => 1322,n,Set(CfMC_AMDValue="NotChecked")
exten => 1322,n,GotoIf($["${CfMC_DoAMD}" != "Yes"]?NOAMD)
exten => 1322,n,AMD()
exten => 1322,n,Set(CfMC_AMDValue = ${AMDSTATUS})
exten => 1322,n(NOAMD),Wait(1)
exten => 1322,n,UserEvent(E1322-1,${CfMC_ActionID}=${CHANNEL} &
${CfMC_AgentToUse} & ${CfMC_AMDValue})
exten => 1322,n,Playback(tt-weasels)
exten => 1322,n,Hangup()


When this executes I see these two line on the Asterisk CLI screen:

Set("Local/1321 at cfmc_cdi_info-df3d,1", "CfMC_AMDValue="NotChecked"")
Set("IAX2/sfserver3-16384", "CfMC_AMDValue = MACHINE")

I am not sure why in the same extension it is setting two different
variables named CfMC_AMDValue. This then causes the following problem.

UserEvent("IAX2/sfserver3-16384", "E1322-1|callE1321=IAX2/sfserver3-16384 &
IAX2/sfserver3/915419712512 & tqe & 1001 & NotChecked")

I do not want to set global variables as if I use this extension twice at
the same time there would be a conflict. What is the correct way to handle
this.

This is while running Asterisk 1.4.23
-- 
Jim Dickenson
mailto:dickenson at cfmc.com

CfMC
http://www.cfmc.com/






More information about the asterisk-users mailing list