Global Variables

Hi,

A couple of queries I have regarding global variables.
If I set a global variable at the top of extensions.conf which acts as a default for callers entering the system.

[globals]
clearglobalvars=yes
CIDTYPE=client

Then change the variable in the dialplan;

[incoming]
exten => s,1,Goto(call-phone,s,1)

[call-phone]
exten => s,1,NoOp(${CIDTYPE})
          same => n,Set(CIDTYPE=friend)
          same => n,NoOp(${CIDTYPE})
          same => n,DIAL(DAHDI/1,15,m)
          same => n,Hangup()

The variable gets changed successfully.
My understanding is that now the global variable has been changed, it will stay changed until either 1) system restart/reload 2) I use another Set function to change it.

However, using this simple dialplan, when another call comes in the CIDTYPE is set to client again, just before it gets changed by the Set command. Shouldn’t the CIDTYPE stay as friend until I change it - or the system is reloaded???

Basically my intension was to set some default global variables which will handle 90% of calls. My dialplan is more complex than this, but this is simple enough to demonstrate my confusion.

Thanks
Danny

Howdy,

From extensions.conf.sample:


; The "Globals" category contains global variables that can be referenced
; in the dialplan with the GLOBAL dialplan function:
; ${GLOBAL(VARIABLE)}
; ${${GLOBAL(VARIABLE)}} or ${text${GLOBAL(VARIABLE)}} or any hybrid
; Unix/Linux environmental variables can be reached with the ENV dialplan
; function: ${ENV(VARIABLE)}