summaryrefslogtreecommitdiff
path: root/main/cel.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2013-08-22 20:29:15 +0000
committerKinsey Moore <kmoore@digium.com>2013-08-22 20:29:15 +0000
commit24683444ac07743e202c6f6cae0364ee4057df4c (patch)
tree7124ad1c275dae61c3a7f7f4ee522a1df40c861d /main/cel.c
parent8300c9aaafe4426944f5d3a4987fcf6a771fbe51 (diff)
Ensure CEL creates a default config if it isn't provided with one
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397471 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/cel.c')
-rw-r--r--main/cel.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/main/cel.c b/main/cel.c
index 1b2dc3914..e063fab9b 100644
--- a/main/cel.c
+++ b/main/cel.c
@@ -1474,7 +1474,21 @@ int ast_cel_engine_init(void)
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);