Summary:ASTERISK-09143: Global variables defined in extensions.ael not reloaded when doing a reload, other parts of dialplan are.
Reporter:hedge77 (hedge77)Labels:
Date Opened:2007-03-29 14:04:47Date Closed:2007-03-29 20:21:07
Versions:Frequency of
Description:In extensions.ael:

globals {
       TRUNKMSD=0;                 // should be 1, changed to 0 for testing.
       SALESEXT=SIP/122&SIP/124;   // phones to ring for sales


When asterisk is first started they show up fine (checked with CLI core show globals).  After issuing a reload command from the CLI or manager interface the variables are no longer defined (core show globals returns 0 vars).  All other parts of the dialplan are loaded fine.

Issuing an 'ael reload' command reloads the variables correctly.


In case it matters, my configuration is laid out like:

  extensions.conf => only the [general] section is used here
  extensions.ael => defines globals, #includes other .ael files
     net.ael => includes net-menus.ael
     hq.ael => includes hq-menus.ael
Comments:By: hedge77 (hedge77) 2007-03-29 14:44:06

I have upgraded to 1.4.2 and it is still there.

By: Steve Murphy (murf) 2007-03-29 17:34:36


Hmmm! I'm having trouble reproducing this. My globals looks like this:


and, after the initial load, I can see these with 'core show globals".

Then, I do a "reload", and I re-log into asterisk and do 'core show globals',
and I see the same vars just fine.

An "ael reload" shows the same results.

Are you doing something differently than I outlined just above?


By: hedge77 (hedge77) 2007-03-29 18:11:17

i'm not leaving after the reload (so i'm not re-logging in) but I just tried it and it still doesn't work for me.

I even changed out my formatting to the same as yours and took my comments out in case it was a parsing problem.

I also just tried a bare extensions.ael file with only a simple globals section and nothing else and got the same results.

By: hedge77 (hedge77) 2007-03-29 18:19:17

I had clearglobalvars = yes in the [general] section of extensions.conf.  I changed it to no and the vars aren't cleared after a reload.

This still probably isn't the 'proper' behavior though since globals in extensions.conf would be reloaded properly.

By: Steve Murphy (murf) 2007-03-29 19:35:33


Ahhhhh, and there lies the complexity, methinks: with clearglobalvars = yes, the globals are cleared when you do 'extensions reload', but not refilled because they are in the AEL side. the 'ael reload' replenishes the list. But, why wouldn't just 'reload' replenish them?  I think I know... the modules are loaded in some random order; and it just so happens that nearly always, this means that extensions.conf is loaded AFTER extensions.ael. Thus the load of ael will replenish the list, and then the following load of extensions.conf will erase them, and not replenish them.

There is little to do about this, for the moment, but a) document it a little in the extensions.conf example file, and b) put the same list of globals in both extensions.conf, and extensions.ael for safety. I know, I know, this is ugly.
The other option is to not set clearglobalvars. Especially if you aren't changing the values of the global vars.

By: Steve Murphy (murf) 2007-03-29 20:21:06

To help keep confusion to a minimum, a paragraph was added to the configs/extensions.conf.example in 1.4 (r59452) and trunk (r59453).
; one of its included files, will remain set to the previous value.
+; NOTE: A complication sets in, if you put your global variables into
+; the AEL file, instead of the extensions.conf file. With clearglobalvars
+; set, a 'reload' will often leave the globals vars cleared, because it
+; is not unusual to have extensions.conf (which will have no globals)
+; load after the extensions.ael file (where the global vars are stored).
+; So, with 'reload' in this particular situation, first the AEL file will
+; clear and then set all the global vars, then, later, when the extensions.conf
+; file is loaded, the global vars are all cleared, and then not set, because
+; they are not stored in the extensions.conf file.