aboutsummaryrefslogtreecommitdiffstats
path: root/channels
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 /channels
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 'channels')
-rw-r--r--channels/chan_agent.c11
-rw-r--r--channels/chan_h323.c2
-rw-r--r--channels/chan_iax2.c3
-rw-r--r--channels/chan_jingle.c2
-rw-r--r--channels/chan_mgcp.c3
-rw-r--r--channels/chan_misdn.c2
-rw-r--r--channels/chan_oss.c2
-rw-r--r--channels/chan_phone.c2
-rw-r--r--channels/chan_sip.c4
-rw-r--r--channels/chan_skinny.c4
-rw-r--r--channels/chan_vpb.cc2
-rw-r--r--channels/chan_zap.c2
12 files changed, 22 insertions, 17 deletions
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;
}
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index dc498a2d9..ded2afbd5 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -2389,7 +2389,7 @@ static int load_module(void *mod)
}
res = reload_config();
if (res) {
- return 0;
+ return AST_MODULE_LOAD_DECLINE;
} else {
/* Make sure we can register our channel type */
if (ast_channel_register(&oh323_tech)) {
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 60841e0ae..7d90a087a 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -9798,7 +9798,8 @@ static int load_module(void)
ast_manager_register( "IAXpeers", 0, manager_iax2_show_peers, "List IAX Peers" );
ast_manager_register( "IAXnetstats", 0, manager_iax2_show_netstats, "Show IAX Netstats" );
- set_config(config, 0);
+ if(set_config(config, 0) == -1)
+ return AST_MODULE_LOAD_DECLINE;
if (ast_channel_register(&iax2_tech)) {
ast_log(LOG_ERROR, "Unable to register channel class %s\n", "IAX2");
diff --git a/channels/chan_jingle.c b/channels/chan_jingle.c
index a44b42085..c2dc460f7 100644
--- a/channels/chan_jingle.c
+++ b/channels/chan_jingle.c
@@ -1668,7 +1668,7 @@ static int load_module(void)
ASTOBJ_CONTAINER_INIT(&jingles);
if (!jingle_load_config()) {
ast_log(LOG_ERROR, "Unable to read config file %s. Not loading module.\n", JINGLE_CONFIG);
- return 0;
+ return AST_MODULE_LOAD_DECLINE;
}
sched = sched_context_create();
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 05ab81edf..1a27fc8f0 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -4262,7 +4262,8 @@ static int load_module(void)
/* And start the monitor for the first time */
restart_monitor();
- }
+ } else
+ return AST_MODULE_LOAD_DECLINE;
return res;
}
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index 201d38c39..6815056f2 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -4499,7 +4499,7 @@ static int load_module(void)
if (misdn_cfg_init(max_ports)) {
ast_log(LOG_ERROR, "Unable to initialize misdn_config.\n");
- return 0;
+ return AST_MODULE_LOAD_DECLINE;
}
g_config_initialized=1;
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index e40aacb0f..9ff6982c5 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -1551,7 +1551,7 @@ static int load_module(void)
ast_config_destroy(cfg);
} else {
ast_log(LOG_NOTICE, "Unable to load config oss.conf\n");
- return -1;
+ return AST_MODULE_LOAD_DECLINE;
}
if (find_desc(oss_active) == NULL) {
ast_log(LOG_NOTICE, "Device %s not found\n", oss_active);
diff --git a/channels/chan_phone.c b/channels/chan_phone.c
index bb31ebae6..6e658ad3a 100644
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -1353,7 +1353,7 @@ static int load_module(void)
/* We *must* have a config file otherwise stop immediately */
if (!cfg) {
ast_log(LOG_ERROR, "Unable to load config %s\n", config);
- return 0;
+ return AST_MODULE_LOAD_DECLINE;
}
if (ast_mutex_lock(&iflock)) {
/* It's a little silly to lock it, but we mind as well just to be sure */
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index aed8b5828..a5c4d694c 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -16533,8 +16533,8 @@ static int load_module(void)
ast_log(LOG_WARNING, "Unable to create I/O context\n");
}
sip_reloadreason = CHANNEL_MODULE_LOAD;
- reload_config(sip_reloadreason); /* Load the configuration from sip.conf */
-
+ if(reload_config(sip_reloadreason)) /* Load the configuration from sip.conf */
+ return AST_MODULE_LOAD_DECLINE;
/* Make sure we can register our sip channel type */
if (ast_channel_register(&sip_tech)) {
ast_log(LOG_ERROR, "Unable to register channel type 'SIP'\n");
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 97c12455e..1f0ec6b33 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -4377,7 +4377,9 @@ static int load_module(void)
}
/* load and parse config */
res = reload_config();
-
+ if(!res) {
+ return AST_MODULE_LOAD_DECLINE;
+ }
ast_rtp_proto_register(&skinny_rtp);
ast_cli_register(&cli_show_devices);
ast_cli_register(&cli_show_lines);
diff --git a/channels/chan_vpb.cc b/channels/chan_vpb.cc
index 26e1beea0..3d9707a77 100644
--- a/channels/chan_vpb.cc
+++ b/channels/chan_vpb.cc
@@ -2872,7 +2872,7 @@ int load_module()
/* We *must* have a config file otherwise stop immediately */
if (!cfg) {
ast_log(LOG_ERROR, "Unable to load config %s\n", config);
- return -1;
+ return AST_MODULE_LOAD_DECLINE;
}
vpb_seterrormode(VPB_ERROR_CODE);
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 7c860ff50..ad3798646 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -11145,7 +11145,7 @@ static int load_module(void)
res = setup_zap(0);
/* Make sure we can register our Zap channel type */
if (res)
- return -1;
+ return AST_MODULE_LOAD_DECLINE;
if (ast_channel_register(&zap_tech)) {
ast_log(LOG_ERROR, "Unable to register channel class 'Zap'\n");
__unload_module();