mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 11:42:27 +00:00
Ensure that Asterisk still starts up when cel.conf is missing
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391689 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
34
main/cel.c
34
main/cel.c
@@ -477,10 +477,6 @@ static char *handle_cli_status(struct ast_cli_entry *e, int cmd, struct ast_cli_
|
|||||||
struct ast_event_sub *sub;
|
struct ast_event_sub *sub;
|
||||||
RAII_VAR(struct cel_config *, cfg, ao2_global_obj_ref(cel_configs), ao2_cleanup);
|
RAII_VAR(struct cel_config *, cfg, ao2_global_obj_ref(cel_configs), ao2_cleanup);
|
||||||
|
|
||||||
if (!cfg || !cfg->general) {
|
|
||||||
return CLI_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case CLI_INIT:
|
case CLI_INIT:
|
||||||
e->command = "cel show status";
|
e->command = "cel show status";
|
||||||
@@ -500,6 +496,10 @@ static char *handle_cli_status(struct ast_cli_entry *e, int cmd, struct ast_cli_
|
|||||||
|
|
||||||
ast_cli(a->fd, "CEL Logging: %s\n", ast_cel_check_enabled() ? "Enabled" : "Disabled");
|
ast_cli(a->fd, "CEL Logging: %s\n", ast_cel_check_enabled() ? "Enabled" : "Disabled");
|
||||||
|
|
||||||
|
if (!cfg || !cfg->general) {
|
||||||
|
return CLI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
if (!cfg->general->enable) {
|
if (!cfg->general->enable) {
|
||||||
return CLI_SUCCESS;
|
return CLI_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -611,7 +611,7 @@ static int apps_handler(const struct aco_option *opt, struct ast_variable *var,
|
|||||||
|
|
||||||
static int do_reload(void)
|
static int do_reload(void)
|
||||||
{
|
{
|
||||||
if (aco_process_config(&cel_cfg_info, 1)) {
|
if (aco_process_config(&cel_cfg_info, 1) == ACO_PROCESS_ERROR) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1444,19 +1444,6 @@ int ast_cel_engine_init(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aco_info_init(&cel_cfg_info)) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
aco_option_register(&cel_cfg_info, "enable", ACO_EXACT, general_options, "no", OPT_BOOL_T, 1, FLDSET(struct cel_general_config, enable));
|
|
||||||
aco_option_register(&cel_cfg_info, "dateformat", ACO_EXACT, general_options, "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct cel_general_config, date_format));
|
|
||||||
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);
|
|
||||||
|
|
||||||
if (aco_process_config(&cel_cfg_info, 0)) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ast_cli_register(&cli_status)) {
|
if (ast_cli_register(&cli_status)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -1530,6 +1517,17 @@ int ast_cel_engine_init(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (aco_info_init(&cel_cfg_info)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
aco_option_register(&cel_cfg_info, "enable", ACO_EXACT, general_options, "no", OPT_BOOL_T, 1, FLDSET(struct cel_general_config, enable));
|
||||||
|
aco_option_register(&cel_cfg_info, "dateformat", ACO_EXACT, general_options, "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct cel_general_config, date_format));
|
||||||
|
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);
|
||||||
|
|
||||||
ast_register_cleanup(ast_cel_engine_term);
|
ast_register_cleanup(ast_cel_engine_term);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user