mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
allow global variables to be reset on reload (defaults to off) (bug #4385)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5825 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -34,7 +34,16 @@ writeprotect=no
|
|||||||
; (this is the original behavior of Asterisk 1.0 and earlier).
|
; (this is the original behavior of Asterisk 1.0 and earlier).
|
||||||
;
|
;
|
||||||
autofallthrough=yes
|
autofallthrough=yes
|
||||||
|
;
|
||||||
|
; If clearglobalvars is set, global variables will be cleared
|
||||||
|
; and reparsed on an extensions reload, or Asterisk reload.
|
||||||
|
;
|
||||||
|
; If clearglobalvars is not set, then global variables will persist
|
||||||
|
; through reloads, and even if deleted from the extensions.conf or
|
||||||
|
; one if its included files, will remain set to the previous value.
|
||||||
|
;
|
||||||
|
clearglobalvars=no
|
||||||
|
;
|
||||||
; You can include other config files, use the #include command (without the ';')
|
; You can include other config files, use the #include command (without the ';')
|
||||||
; Note that this is different from the "include" command that includes contexts within
|
; Note that this is different from the "include" command that includes contexts within
|
||||||
; other contexts. The #include command works in all asterisk configuration files.
|
; other contexts. The #include command works in all asterisk configuration files.
|
||||||
|
@@ -44,6 +44,7 @@ static char *registrar = "pbx_config";
|
|||||||
static int static_config = 0;
|
static int static_config = 0;
|
||||||
static int write_protect_config = 1;
|
static int write_protect_config = 1;
|
||||||
static int autofallthrough_config = 0;
|
static int autofallthrough_config = 0;
|
||||||
|
static int clearglobalvars_config = 0;
|
||||||
|
|
||||||
AST_MUTEX_DEFINE_STATIC(save_dialplan_lock);
|
AST_MUTEX_DEFINE_STATIC(save_dialplan_lock);
|
||||||
|
|
||||||
@@ -97,7 +98,8 @@ static char context_remove_ignorepat_help[] =
|
|||||||
|
|
||||||
static char reload_extensions_help[] =
|
static char reload_extensions_help[] =
|
||||||
"Usage: reload extensions.conf without reloading any other modules\n"
|
"Usage: reload extensions.conf without reloading any other modules\n"
|
||||||
" This command does not delete global variables\n"
|
" This command does not delete global variables unless\n"
|
||||||
|
" clearglobalvars is set to yes in extensions.conf\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Example: extensions reload\n";
|
"Example: extensions reload\n";
|
||||||
|
|
||||||
@@ -1636,6 +1638,9 @@ static int pbx_load_module(void)
|
|||||||
autofallthrough_config = ast_true(ast_variable_retrieve(cfg, "general",
|
autofallthrough_config = ast_true(ast_variable_retrieve(cfg, "general",
|
||||||
"autofallthrough"));
|
"autofallthrough"));
|
||||||
|
|
||||||
|
clearglobalvars_config = ast_true(ast_variable_retrieve(cfg, "general",
|
||||||
|
"clearglobalvars"));
|
||||||
|
|
||||||
v = ast_variable_browse(cfg, "globals");
|
v = ast_variable_browse(cfg, "globals");
|
||||||
while(v) {
|
while(v) {
|
||||||
memset(realvalue, 0, sizeof(realvalue));
|
memset(realvalue, 0, sizeof(realvalue));
|
||||||
@@ -1816,10 +1821,8 @@ int load_module(void)
|
|||||||
int reload(void)
|
int reload(void)
|
||||||
{
|
{
|
||||||
ast_context_destroy(NULL, registrar);
|
ast_context_destroy(NULL, registrar);
|
||||||
/* For martin's global variables, don't clear them on reload */
|
if (clearglobalvars_config)
|
||||||
#if 0
|
pbx_builtin_clear_globals();
|
||||||
pbx_builtin_clear_globals();
|
|
||||||
#endif
|
|
||||||
pbx_load_module();
|
pbx_load_module();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user