From 73925ee14a02afb50f6c0aea3cc4e54f99493440 Mon Sep 17 00:00:00 2001 From: mogorman Date: Thu, 31 Aug 2006 21:00:20 +0000 Subject: everything that loads a config that needs a config file to run now reports AST_MODULE_LOAD_DECLINE when loading if config file is not there, also fixed an error in res_config_pgsql where it had a non static function when it should. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@41633 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_agent.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'channels/chan_agent.c') diff --git a/channels/chan_agent.c b/channels/chan_agent.c index 4eeffe99c..2db3faf18 100644 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -1113,7 +1113,7 @@ static int read_agent_config(void) AST_LIST_TRAVERSE_SAFE_END AST_LIST_UNLOCK(&agents); ast_config_destroy(cfg); - return 0; + return 1; } static int check_availability(struct agent_pvt *newlyavailable, int needlock) @@ -2547,6 +2547,11 @@ static int load_module(void) ast_log(LOG_ERROR, "Unable to register channel class 'Agent'\n"); return -1; } + /* Read in the config */ + if (!read_agent_config()) + return AST_MODULE_LOAD_DECLINE; + if (persistent_agents) + reload_agents(); /* Dialplan applications */ ast_register_application(app, login_exec, synopsis, descrip); ast_register_application(app2, callback_exec, synopsis2, descrip2); @@ -2565,10 +2570,6 @@ static int load_module(void) /* Dialplan Functions */ ast_custom_function_register(&agent_function); - /* Read in the config */ - read_agent_config(); - if (persistent_agents) - reload_agents(); return 0; } -- cgit v1.2.3