diff --git a/configs/samples/extensions.conf.sample b/configs/samples/extensions.conf.sample index cd4cec5fd1..d50859c5a0 100644 --- a/configs/samples/extensions.conf.sample +++ b/configs/samples/extensions.conf.sample @@ -13,6 +13,10 @@ ; [general] ; +; Customize the log level when the extensions are loaded: It enables you to have a different level for live calls and reload. +; +; extensions_adding_log_level = 6 +; ; If static is set to no, or omitted, then the pbx_config will rewrite ; this file when extensions are modified. Remember that all comments ; made in the file will be lost when that happens. diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h index 770a1a9843..78dfdfb354 100644 --- a/include/asterisk/pbx.h +++ b/include/asterisk/pbx.h @@ -1402,6 +1402,9 @@ int pbx_set_extenpatternmatchnew(int newval); */ void pbx_set_overrideswitch(const char *newval); +/*! Set the verbose level when adding extensions */ +void pbx_set_extensionsaddingverbosity(int newval); + /*! * \note This function will handle locking the channel as needed. */ diff --git a/main/pbx.c b/main/pbx.c index b4089abd71..6ea4d1e174 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -721,6 +721,7 @@ static unsigned int hashtab_hash_labels(const void *obj) static int autofallthrough = 1; static int extenpatternmatchnew = 0; static char *overrideswitch = NULL; +static int extensionsaddingverbosity = 3; /*! \brief Subscription for device state change events */ static struct stasis_subscription *device_state_sub; @@ -4697,6 +4698,11 @@ void pbx_set_overrideswitch(const char *newval) } } +void pbx_set_extensionsaddingverbosity(int newval) +{ + extensionsaddingverbosity = newval; +} + /*! * \brief lookup for a context with a given name, * \retval found context or NULL if not found. @@ -7427,10 +7433,10 @@ static int ast_add_extension2_lockopt(struct ast_context *con, } if (tmp->matchcid == AST_EXT_MATCHCID_ON) { - ast_verb(3, "Added extension '%s' priority %d (CID match '%s') to %s\n", + ast_verb(extensionsaddingverbosity, "Added extension '%s' priority %d (CID match '%s') to %s\n", tmp->name, tmp->priority, tmp->cidmatch_display, con->name); } else { - ast_verb(3, "Added extension '%s' priority %d to %s\n", + ast_verb(extensionsaddingverbosity, "Added extension '%s' priority %d to %s\n", tmp->name, tmp->priority, con->name); } diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index c4a0e6c286..66648c8035 100644 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -1656,6 +1656,8 @@ static int pbx_load_config(const char *config_file) const char *cxt; const char *aft; const char *newpm, *ovsw; + const char *extverb; + unsigned int extverb_uint; struct ast_flags config_flags = { 0 }; char lastextension[256]; cfg = ast_config_load(config_file, config_flags); @@ -1681,6 +1683,10 @@ static int pbx_load_config(const char *config_file) } } + if ((extverb = ast_variable_retrieve(cfg, "general", "extensions_adding_log_level")) && sscanf(extverb, "%2d", &extverb_uint) == 1) { + pbx_set_extensionsaddingverbosity((int)extverb_uint); + } + ast_copy_string(userscontext, ast_variable_retrieve(cfg, "general", "userscontext") ?: "default", sizeof(userscontext)); for (v = ast_variable_browse(cfg, "globals"); v; v = v->next) { @@ -2046,7 +2052,7 @@ static int pbx_load_module(void) ast_mutex_unlock(&reload_lock); return AST_MODULE_LOAD_DECLINE; } - + pbx_load_users(); ast_merge_contexts_and_delete(&local_contexts, local_table, registrar);