[asterisk-commits] kmoore: trunk r397471 - /trunk/main/cel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 22 15:29:17 CDT 2013


Author: kmoore
Date: Thu Aug 22 15:29:15 2013
New Revision: 397471

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397471
Log:
Ensure CEL creates a default config if it isn't provided with one

Modified:
    trunk/main/cel.c

Modified: trunk/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/cel.c?view=diff&rev=397471&r1=397470&r2=397471
==============================================================================
--- trunk/main/cel.c (original)
+++ trunk/main/cel.c Thu Aug 22 15:29:15 2013
@@ -1474,7 +1474,21 @@
 	aco_option_register_custom(&cel_cfg_info, "apps", ACO_EXACT, general_options, "", apps_handler, 0);
 	aco_option_register_custom(&cel_cfg_info, "events", ACO_EXACT, general_options, "", events_handler, 0);
 
-	aco_process_config(&cel_cfg_info, 0);
+	if (aco_process_config(&cel_cfg_info, 0)) {
+		RAII_VAR(struct cel_config *, cel_cfg, cel_config_alloc(), ao2_cleanup);
+
+		if (!cel_cfg) {
+			return -1;
+		}
+
+		/* If we couldn't process the configuration and this wasn't a reload,
+		 * create a default config
+		 */
+		if (!aco_set_defaults(&general_option, "general", cel_cfg->general)) {
+			ast_log(LOG_NOTICE, "Failed to process CEL configuration; using defaults\n");
+			ao2_global_obj_replace(cel_configs, cel_cfg);
+		}
+	}
 
 	ast_register_cleanup(ast_cel_engine_term);
 




More information about the asterisk-commits mailing list