aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authormogorman <mogorman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-08-31 21:00:20 +0000
committermogorman <mogorman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-08-31 21:00:20 +0000
commit73925ee14a02afb50f6c0aea3cc4e54f99493440 (patch)
tree5eac7fd790352b502dbbc4fc21ae517fe7c388ad /apps
parent43c75db33e757e08cdec37b1713a0e275d9a039b (diff)
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
Diffstat (limited to 'apps')
-rw-r--r--apps/app_alarmreceiver.c9
-rw-r--r--apps/app_festival.c6
-rw-r--r--apps/app_followme.c3
-rw-r--r--apps/app_osplookup.c7
-rw-r--r--apps/app_queue.c16
-rw-r--r--apps/app_rpt.c11
6 files changed, 34 insertions, 18 deletions
diff --git a/apps/app_alarmreceiver.c b/apps/app_alarmreceiver.c
index 5b745d0ab..41f715e8e 100644
--- a/apps/app_alarmreceiver.c
+++ b/apps/app_alarmreceiver.c
@@ -743,6 +743,7 @@ static int load_config(void)
if(option_verbose >= 4)
ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: No config file\n");
+ return 0;
}
else{
@@ -809,7 +810,7 @@ static int load_config(void)
}
ast_config_destroy(cfg);
}
- return 0;
+ return 1;
}
@@ -831,8 +832,10 @@ static int unload_module(void)
static int load_module(void)
{
- load_config();
- return ast_register_application(app, alarmreceiver_exec, synopsis, descrip);
+ if(load_config())
+ return ast_register_application(app, alarmreceiver_exec, synopsis, descrip);
+ else
+ return AST_MODULE_LOAD_DECLINE;
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Alarm Receiver for Asterisk");
diff --git a/apps/app_festival.c b/apps/app_festival.c
index f6e1d7503..d365b2410 100644
--- a/apps/app_festival.c
+++ b/apps/app_festival.c
@@ -533,6 +533,12 @@ static int unload_module(void)
static int load_module(void)
{
+ struct ast_config *cfg = ast_config_load(FESTIVAL_CONFIG);
+ if (!cfg) {
+ ast_log(LOG_WARNING, "No such configuration file %s\n", FESTIVAL_CONFIG);
+ return AST_MODULE_LOAD_DECLINE;
+ }
+ ast_config_destroy(cfg);
return ast_register_application(app, festival_exec, synopsis, descrip);
}
diff --git a/apps/app_followme.c b/apps/app_followme.c
index 24f134d85..47bea4099 100644
--- a/apps/app_followme.c
+++ b/apps/app_followme.c
@@ -1098,7 +1098,8 @@ static int unload_module(void)
static int load_module(void)
{
- reload_followme();
+ if(!reload_followme())
+ return AST_MODULE_LOAD_DECLINE;
return ast_register_application(app, app_exec, synopsis, descrip);
}
diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c
index c700e81ce..e5fcf9a51 100644
--- a/apps/app_osplookup.c
+++ b/apps/app_osplookup.c
@@ -1431,10 +1431,11 @@ static int osp_load(void)
ast_config_destroy(cfg);
} else {
ast_log(LOG_WARNING, "OSP: Unable to find configuration. OSP support disabled\n");
+ return 0;
}
ast_log(LOG_DEBUG, "OSP: osp_initialized '%d'\n", osp_initialized);
- return 0;
+ return 1;
}
static int osp_unload(void)
@@ -1606,7 +1607,9 @@ static int load_module(void)
{
int res;
- osp_load();
+ if(!osp_load())
+ return AST_MODULE_LOAD_DECLINE;
+
res = ast_cli_register(&osp_cli);
res |= ast_register_application(app1, ospauth_exec, synopsis1, descrip1);
res |= ast_register_application(app2, osplookup_exec, synopsis2, descrip2);
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 448e8ca74..878c67a4a 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -3642,7 +3642,7 @@ static struct ast_custom_function queuememberlist_function = {
.read = queue_function_queuememberlist,
};
-static void reload_queues(void)
+static int reload_queues(void)
{
struct call_queue *q;
struct ast_config *cfg;
@@ -3656,7 +3656,7 @@ static void reload_queues(void)
if (!(cfg = ast_config_load("queues.conf"))) {
ast_log(LOG_NOTICE, "No call queueing config file (queues.conf), so no call queues\n");
- return;
+ return 0;
}
memset(interface, 0, sizeof(interface));
AST_LIST_LOCK(&queues);
@@ -3794,6 +3794,7 @@ static void reload_queues(void)
}
AST_LIST_TRAVERSE_SAFE_END;
AST_LIST_UNLOCK(&queues);
+ return 1;
}
static int __queues_show(struct mansession *s, int manager, int fd, int argc, char **argv, int queue_show)
@@ -4359,7 +4360,10 @@ static int unload_module(void)
static int load_module(void)
{
int res;
-
+ if(!reload_queues())
+ return AST_MODULE_LOAD_DECLINE;
+ if (queue_persistent_members)
+ reload_queue_members();
res = ast_register_application(app, queue_exec, synopsis, descrip);
res |= ast_cli_register(&cli_show_queue);
res |= ast_cli_register(&cli_show_queues);
@@ -4381,12 +4385,6 @@ static int load_module(void)
res |= ast_custom_function_register(&queuewaitingcount_function);
res |= ast_devstate_add(statechange_queue, NULL);
- if (!res) {
- reload_queues();
- if (queue_persistent_members)
- reload_queue_members();
- }
-
return res;
}
diff --git a/apps/app_rpt.c b/apps/app_rpt.c
index e1da544c9..858525a58 100644
--- a/apps/app_rpt.c
+++ b/apps/app_rpt.c
@@ -7150,7 +7150,7 @@ char tmpstr[300];
}
-static void *rpt_master(void *ignore)
+static void *rpt_master(void *config)
{
int i,n;
pthread_attr_t attr;
@@ -7160,7 +7160,7 @@ char *this,*val;
/* go thru all the specified repeaters */
this = NULL;
n = 0;
- rpt_vars[n].cfg = ast_config_load("rpt.conf");
+ rpt_vars[n].cfg = config;
cfg = rpt_vars[n].cfg;
if (!cfg) {
ast_log(LOG_NOTICE, "Unable to open radio repeater configuration rpt.conf. Radio Repeater disabled.\n");
@@ -8030,7 +8030,12 @@ static int unload_module(void)
static int load_module(void)
{
- ast_pthread_create(&rpt_master_thread,NULL,rpt_master,NULL);
+ struct ast_config *cfg = ast_config_load("rpt.conf");
+ if (!cfg) {
+ ast_log(LOG_WARNING, "No such configuration file rpt.conf\n");
+ return AST_MODULE_LOAD_DECLINE;
+ }
+ ast_pthread_create(&rpt_master_thread,NULL,rpt_master,cfg);
/* Register cli extensions */
ast_cli_register(&cli_debug);