From c02beb1097eab43bbcc4160c49176b121a5ca2a3 Mon Sep 17 00:00:00 2001 From: Matthew Jordan <mjordan@digium.com> Date: Sat, 6 Dec 2014 17:19:39 +0000 Subject: [PATCH] apps/app_meetme: Apply default values on initial load with no config file When the app_meetme module is loaded without its configuration file, the module settings aren't initialized. In particular, this impacts the use of logging realtime members. This patch guarantees that we always set the default module settings on initial load. Review: https://reviewboard.asterisk.org/r/4242/ ASTERISK-24572 #close Reported by: Nuno Borges patches: 24572.patch uploaded by Nuno Borges (License 6116) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@429027 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_meetme.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 6fa8cb17a7..254f237b5e 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -5571,12 +5571,29 @@ static enum ast_device_state meetmestate(const char *data) return AST_DEVICE_INUSE; } -static void load_config_meetme(void) +static void meetme_set_defaults(void) +{ + /* Scheduling support is off by default */ + rt_schedule = 0; + fuzzystart = 0; + earlyalert = 0; + endalert = 0; + extendby = 0; + + /* Logging of participants defaults to ON for compatibility reasons */ + rt_log_members = 1; +} + +static void load_config_meetme(int reload) { struct ast_config *cfg; struct ast_flags config_flags = { 0 }; const char *val; + if (!reload) { + meetme_set_defaults(); + } + if (!(cfg = ast_config_load(CONFIG_FILE_NAME, config_flags))) { return; } else if (cfg == CONFIG_STATUS_FILEINVALID) { @@ -5584,17 +5601,9 @@ static void load_config_meetme(void) return; } - audio_buffers = DEFAULT_AUDIO_BUFFERS; - - /* Scheduling support is off by default */ - rt_schedule = 0; - fuzzystart = 0; - earlyalert = 0; - endalert = 0; - extendby = 0; - - /* Logging of participants defaults to ON for compatibility reasons */ - rt_log_members = 1; + if (reload) { + meetme_set_defaults(); + } if ((val = ast_variable_retrieve(cfg, "general", "audiobuffers"))) { if ((sscanf(val, "%30d", &audio_buffers) != 1)) { @@ -7801,7 +7810,7 @@ static struct ast_custom_function meetme_info_acf = { static int load_config(int reload) { - load_config_meetme(); + load_config_meetme(reload); return sla_load_config(reload); } -- GitLab