[svn-commits] tilghman: trunk r79747 - in /trunk: ./ apps/ cdr/ channels/ channels/misdn/ c...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Aug 16 16:09:47 CDT 2007


Author: tilghman
Date: Thu Aug 16 16:09:46 2007
New Revision: 79747

URL: http://svn.digium.com/view/asterisk?view=rev&rev=79747
Log:
Don't reload a configuration file if nothing has changed.

Modified:
    trunk/   (props changed)
    trunk/apps/app_alarmreceiver.c
    trunk/apps/app_amd.c
    trunk/apps/app_directory.c
    trunk/apps/app_festival.c
    trunk/apps/app_followme.c
    trunk/apps/app_meetme.c
    trunk/apps/app_minivm.c
    trunk/apps/app_osplookup.c
    trunk/apps/app_playback.c
    trunk/apps/app_privacy.c
    trunk/apps/app_queue.c
    trunk/apps/app_rpt.c
    trunk/apps/app_voicemail.c
    trunk/cdr/cdr_adaptive_odbc.c
    trunk/cdr/cdr_csv.c
    trunk/cdr/cdr_custom.c
    trunk/cdr/cdr_manager.c
    trunk/cdr/cdr_odbc.c
    trunk/cdr/cdr_pgsql.c
    trunk/cdr/cdr_radius.c
    trunk/cdr/cdr_sqlite3_custom.c
    trunk/cdr/cdr_tds.c
    trunk/channels/chan_agent.c
    trunk/channels/chan_alsa.c
    trunk/channels/chan_gtalk.c
    trunk/channels/chan_h323.c
    trunk/channels/chan_iax2.c
    trunk/channels/chan_jingle.c
    trunk/channels/chan_mgcp.c
    trunk/channels/chan_misdn.c
    trunk/channels/chan_oss.c
    trunk/channels/chan_phone.c
    trunk/channels/chan_sip.c
    trunk/channels/chan_skinny.c
    trunk/channels/chan_vpb.cc
    trunk/channels/chan_zap.c
    trunk/channels/iax2-provision.c
    trunk/channels/iax2-provision.h
    trunk/channels/misdn/chan_misdn_config.h
    trunk/channels/misdn_config.c
    trunk/codecs/codec_adpcm.c
    trunk/codecs/codec_alaw.c
    trunk/codecs/codec_g722.c
    trunk/codecs/codec_g726.c
    trunk/codecs/codec_gsm.c
    trunk/codecs/codec_lpc10.c
    trunk/codecs/codec_speex.c
    trunk/codecs/codec_ulaw.c
    trunk/codecs/codec_zap.c
    trunk/funcs/func_odbc.c
    trunk/include/asterisk/config.h
    trunk/main/asterisk.c
    trunk/main/cdr.c
    trunk/main/config.c
    trunk/main/dnsmgr.c
    trunk/main/enum.c
    trunk/main/http.c
    trunk/main/loader.c
    trunk/main/logger.c
    trunk/main/manager.c
    trunk/main/rtp.c
    trunk/main/udptl.c
    trunk/pbx/pbx_config.c
    trunk/pbx/pbx_dundi.c
    trunk/res/res_adsi.c
    trunk/res/res_config_odbc.c
    trunk/res/res_config_pgsql.c
    trunk/res/res_config_sqlite.c
    trunk/res/res_features.c
    trunk/res/res_indications.c
    trunk/res/res_jabber.c
    trunk/res/res_musiconhold.c
    trunk/res/res_odbc.c
    trunk/res/res_smdi.c
    trunk/res/res_snmp.c

Propchange: trunk/
------------------------------------------------------------------------------
    automerge = *

Propchange: trunk/
------------------------------------------------------------------------------
    automerge-email = tilghman at digium.com

Propchange: trunk/
------------------------------------------------------------------------------
    svnmerge-integrated = /trunk:1-79743

Modified: trunk/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_alarmreceiver.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/apps/app_alarmreceiver.c (original)
+++ trunk/apps/app_alarmreceiver.c Thu Aug 16 16:09:46 2007
@@ -714,10 +714,11 @@
 {
 	struct ast_config *cfg;
 	const char *p;
+	struct ast_flags config_flags = { 0 };
 
 	/* Read in the config file */
 
-	cfg = ast_config_load(ALMRCV_CONFIG);
+	cfg = ast_config_load(ALMRCV_CONFIG, config_flags);
                                                                                                                                   
 	if(!cfg){
 	

Modified: trunk/apps/app_amd.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_amd.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/apps/app_amd.c (original)
+++ trunk/apps/app_amd.c Thu Aug 16 16:09:46 2007
@@ -317,16 +317,18 @@
 	return 0;
 }
 
-static void load_config(void)
+static void load_config(int reload)
 {
 	struct ast_config *cfg = NULL;
 	char *cat = NULL;
 	struct ast_variable *var = NULL;
-
-	if (!(cfg = ast_config_load("amd.conf"))) {
+	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
+
+	if (!(cfg = ast_config_load("amd.conf", config_flags))) {
 		ast_log(LOG_ERROR, "Configuration file amd.conf missing.\n");
 		return;
-	}
+	} else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+		return;
 
 	cat = ast_category_browse(cfg, NULL);
 
@@ -377,13 +379,13 @@
 
 static int load_module(void)
 {
-	load_config();
+	load_config(0);
 	return ast_register_application(app, amd_exec, synopsis, descrip);
 }
 
 static int reload(void)
 {
-	load_config();
+	load_config(1);
 	return 0;
 }
 

Modified: trunk/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_directory.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/apps/app_directory.c (original)
+++ trunk/apps/app_directory.c Thu Aug 16 16:09:46 2007
@@ -364,9 +364,10 @@
 	const char *fullname;
 	const char *hidefromdir;
 	char tmp[100];
+	struct ast_flags config_flags = { 0 };
 
 	/* Load flat file config. */
-	cfg = ast_config_load(VOICEMAIL_CONFIG);
+	cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags);
 
 	if (!cfg) {
 		/* Loading config failed. */
@@ -597,6 +598,7 @@
 	int fromappvm = 0;
 	const char *dirintro;
 	char *parse;
+	struct ast_flags config_flags = { 0 };
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(vmcontext);
 		AST_APP_ARG(dialcontext);
@@ -630,7 +632,7 @@
 		return -1;
 	}
 	
-	ucfg = ast_config_load("users.conf");
+	ucfg = ast_config_load("users.conf", config_flags);
 
 	dirintro = ast_variable_retrieve(cfg, args.vmcontext, "directoryintro");
 	if (ast_strlen_zero(dirintro))
@@ -674,7 +676,8 @@
 static int load_module(void)
 {
 #ifdef ODBC_STORAGE
-	struct ast_config *cfg = ast_config_load(VOICEMAIL_CONFIG);
+	struct ast_flags config_flags = { 0 };
+	struct ast_config *cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags);
 	const char *tmp;
 
 	if (cfg) {

Modified: trunk/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_festival.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/apps/app_festival.c (original)
+++ trunk/apps/app_festival.c Thu Aug 16 16:09:46 2007
@@ -306,6 +306,7 @@
 	char *data;	
 	struct ast_config *cfg;
 	char *newfestivalcommand;
+	struct ast_flags config_flags = { 0 };
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(text);
 		AST_APP_ARG(interrupt);
@@ -316,7 +317,7 @@
 		return -1;
 	}
 
-	cfg = ast_config_load(FESTIVAL_CONFIG);
+	cfg = ast_config_load(FESTIVAL_CONFIG, config_flags);
 	if (!cfg) {
 		ast_log(LOG_WARNING, "No such configuration file %s\n", FESTIVAL_CONFIG);
 		return -1;
@@ -520,7 +521,8 @@
 
 static int load_module(void)
 {
-	struct ast_config *cfg = ast_config_load(FESTIVAL_CONFIG);
+	struct ast_flags config_flags = { 0 };
+	struct ast_config *cfg = ast_config_load(FESTIVAL_CONFIG, config_flags);
 	if (!cfg) {
 		ast_log(LOG_WARNING, "No such configuration file %s\n", FESTIVAL_CONFIG);
 		return AST_MODULE_LOAD_DECLINE;

Modified: trunk/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_followme.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/apps/app_followme.c (original)
+++ trunk/apps/app_followme.c Thu Aug 16 16:09:46 2007
@@ -275,7 +275,7 @@
 }
 
 /*! \brief Reload followme application module */
-static int reload_followme(void)
+static int reload_followme(int reload)
 {
 	struct call_followme *f;
 	struct ast_config *cfg;
@@ -289,11 +289,13 @@
 	const char *takecallstr;
 	const char *declinecallstr;
 	const char *tmpstr;
-
-	if (!(cfg = ast_config_load("followme.conf"))) {
+	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
+
+	if (!(cfg = ast_config_load("followme.conf", config_flags))) {
 		ast_log(LOG_WARNING, "No follow me config file (followme.conf), so no follow me\n");
 		return 0;
-	}
+	} else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+		return 0;
 
 	AST_RWLIST_WRLOCK(&followmes);
 
@@ -1051,7 +1053,7 @@
 
 static int load_module(void)
 {
-	if(!reload_followme())
+	if(!reload_followme(0))
 		return AST_MODULE_LOAD_DECLINE;
 
 	return ast_register_application(app, app_exec, synopsis, descrip);
@@ -1059,7 +1061,7 @@
 
 static int reload(void)
 {
-	reload_followme();
+	reload_followme(1);
 
 	return 0;	
 }

Modified: trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_meetme.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Thu Aug 16 16:09:46 2007
@@ -2407,6 +2407,7 @@
 {
 	struct ast_config *cfg;
 	struct ast_variable *var;
+	struct ast_flags config_flags = { 0 };
 	struct ast_conference *cnf;
 	char *parse;
 	AST_DECLARE_APP_ARGS(args,
@@ -2444,7 +2445,7 @@
 			}
 		} else {
 			/* Check the config */
-			cfg = ast_config_load(CONFIG_FILE_NAME);
+			cfg = ast_config_load(CONFIG_FILE_NAME, config_flags);
 			if (!cfg) {
 				ast_log(LOG_WARNING, "No %s file :(\n", CONFIG_FILE_NAME);
 				return NULL;
@@ -2551,7 +2552,7 @@
 	int allowretry = 0;
 	int retrycnt = 0;
 	struct ast_conference *cnf = NULL;
-	struct ast_flags confflags = {0};
+	struct ast_flags confflags = {0}, config_flags = { 0 };
 	int dynamic = 0;
 	int empty = 0, empty_no_pin = 0;
 	int always_prompt = 0;
@@ -2609,7 +2610,7 @@
 
 			/* We only need to load the config file for static and empty_no_pin (otherwise we don't care) */
 			if ((empty_no_pin) || (!dynamic)) {
-				cfg = ast_config_load(CONFIG_FILE_NAME);
+				cfg = ast_config_load(CONFIG_FILE_NAME, config_flags);
 				if (cfg) {
 					var = ast_variable_browse(cfg, "rooms");
 					while (var) {
@@ -3174,11 +3175,12 @@
 static void load_config_meetme(void)
 {
 	struct ast_config *cfg;
+	struct ast_flags config_flags = { 0 };
 	const char *val;
 
 	audio_buffers = DEFAULT_AUDIO_BUFFERS;
 
-	if (!(cfg = ast_config_load(CONFIG_FILE_NAME)))
+	if (!(cfg = ast_config_load(CONFIG_FILE_NAME, config_flags)))
 		return;
 
 	if ((val = ast_variable_retrieve(cfg, "general", "audiobuffers"))) {
@@ -4894,6 +4896,7 @@
 static int sla_load_config(int reload)
 {
 	struct ast_config *cfg;
+	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
 	const char *cat = NULL;
 	int res = 0;
 	const char *val;
@@ -4903,8 +4906,10 @@
 		ast_cond_init(&sla.cond, NULL);
 	}
 
-	if (!(cfg = ast_config_load(SLA_CONFIG_FILE)))
+	if (!(cfg = ast_config_load(SLA_CONFIG_FILE, config_flags)))
 		return 0; /* Treat no config as normal */
+	else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+		return 0;
 
 	if ((val = ast_variable_retrieve(cfg, "general", "attemptcallerid")))
 		sla.attempt_callerid = ast_true(val);

Modified: trunk/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_minivm.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/apps/app_minivm.c (original)
+++ trunk/apps/app_minivm.c Thu Aug 16 16:09:46 2007
@@ -2349,7 +2349,7 @@
 }
 
 /*! \brief Load minivoicemail configuration */
-static int load_config(void)
+static int load_config(int reload)
 {
 	struct ast_config *cfg;
 	struct ast_variable *var;
@@ -2357,8 +2357,12 @@
 	const char *chanvar;
 	int error = 0;
 	struct minivm_template *template;
-
-	cfg = ast_config_load(VOICEMAIL_CONFIG);
+	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
+
+	cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags);
+	if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+		return 0;
+
 	ast_mutex_lock(&minivmlock);
 
 	/* Destroy lists to reconfigure */
@@ -3039,7 +3043,7 @@
 	if (res)
 		return(res);
 
-	if ((res = load_config()))
+	if ((res = load_config(0)))
 		return(res);
 
 	ast_cli_register_multiple(cli_minivm, sizeof(cli_minivm)/sizeof(cli_minivm[0]));
@@ -3053,7 +3057,7 @@
 /*! \brief Reload mini voicemail module */
 static int reload(void)
 {
-	return(load_config());
+	return(load_config(1));
 }
 
 /*! \brief Reload cofiguration */

Modified: trunk/apps/app_osplookup.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_osplookup.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/apps/app_osplookup.c (original)
+++ trunk/apps/app_osplookup.c Thu Aug 16 16:09:46 2007
@@ -1773,15 +1773,22 @@
 
 /* OSP Module APIs */
 
-static int osp_load(void)
+static int osp_unload(void);
+static int osp_load(int reload)
 {
 	const char* t;
 	unsigned int v;
 	struct ast_config* cfg;
+	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
 	int error = OSPC_ERR_NO_ERROR;
 
-	cfg = ast_config_load(OSP_CONFIG_FILE);
+	if ((cfg = ast_config_load(OSP_CONFIG_FILE, config_flags)) == CONFIG_STATUS_FILEUNCHANGED)
+		return 0;
+
 	if (cfg) {
+		if (reload)
+			osp_unload();
+
 		t = ast_variable_retrieve(cfg, OSP_GENERAL_CAT, "accelerate");
 		if (t && ast_true(t)) {
 			if ((error = OSPPInit(1)) != OSPC_ERR_NO_ERROR) {
@@ -2000,7 +2007,7 @@
 {
 	int res;
 
-	if(!osp_load())
+	if (!osp_load(0))
 		return AST_MODULE_LOAD_DECLINE;
 
 	ast_cli_register_multiple(cli_osp, sizeof(cli_osp) / sizeof(struct ast_cli_entry));
@@ -2028,8 +2035,7 @@
 
 static int reload(void)
 {
-	osp_unload();
-	osp_load();
+	osp_load(1);
 
 	return 0;
 }

Modified: trunk/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_playback.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/apps/app_playback.c (original)
+++ trunk/apps/app_playback.c Thu Aug 16 16:09:46 2007
@@ -470,12 +470,17 @@
 static int reload(void)
 {
 	struct ast_variable *v;
+	struct ast_flags config_flags = { CONFIG_FLAG_FILEUNCHANGED };
+	struct ast_config *newcfg;
+
+	if ((newcfg = ast_config_load("say.conf", config_flags)) == CONFIG_STATUS_FILEUNCHANGED)
+		return 0;
 
 	if (say_cfg) {
 		ast_config_destroy(say_cfg);
 		ast_log(LOG_NOTICE, "Reloading say.conf\n");
-	}
-	say_cfg = ast_config_load("say.conf");
+		say_cfg = newcfg;
+	}
 
 	if (say_cfg) {
 		for (v = ast_variable_browse(say_cfg, "general"); v ; v = v->next) {
@@ -510,8 +515,9 @@
 static int load_module(void)
 {
 	struct ast_variable *v;
-
-	say_cfg = ast_config_load("say.conf");
+	struct ast_flags config_flags = { 0 };
+
+	say_cfg = ast_config_load("say.conf", config_flags);
 	if (say_cfg) {
 		for (v = ast_variable_browse(say_cfg, "general"); v ; v = v->next) {
     			if (ast_extension_match(v->name, "mode")) {

Modified: trunk/apps/app_privacy.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_privacy.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/apps/app_privacy.c (original)
+++ trunk/apps/app_privacy.c Thu Aug 16 16:09:46 2007
@@ -83,6 +83,7 @@
 	char phone[30];
 	struct ast_config *cfg = NULL;
 	char *parse = NULL;
+	struct ast_flags config_flags = { 0 };
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(maxretries);
 		AST_APP_ARG(minlength);
@@ -122,7 +123,7 @@
 		if (!x)
 		{
 			/*Read in the config file*/
-			cfg = ast_config_load(PRIV_CONFIG);
+			cfg = ast_config_load(PRIV_CONFIG, config_flags);
 		
 			if (cfg && (s = ast_variable_retrieve(cfg, "general", "maxretries"))) {
 				if (sscanf(s, "%d", &x) == 1) 

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Thu Aug 16 16:09:46 2007
@@ -3947,7 +3947,7 @@
 	.read = queue_function_queuememberlist,
 };
 
-static int reload_queues(void)
+static int reload_queues(int reload)
 {
 	struct call_queue *q;
 	struct ast_config *cfg;
@@ -3960,16 +3960,18 @@
 	char *interface;
 	char *membername;
 	int penalty;
+	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(interface);
 		AST_APP_ARG(penalty);
 		AST_APP_ARG(membername);
 	);
 	
-	if (!(cfg = ast_config_load("queues.conf"))) {
+	if (!(cfg = ast_config_load("queues.conf", config_flags))) {
 		ast_log(LOG_NOTICE, "No call queueing config file (queues.conf), so no call queues\n");
 		return 0;
-	}
+	} else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+		return 0;
 	AST_LIST_LOCK(&queues);
 	use_weight=0;
 	/* Mark all queues as dead for the moment */
@@ -4766,7 +4768,7 @@
 	int res;
 	struct ast_context *con;
 
-	if (!reload_queues())
+	if (!reload_queues(0))
 		return AST_MODULE_LOAD_DECLINE;
 
 	con = ast_context_find("app_queue_gosub_virtual_context");
@@ -4810,7 +4812,7 @@
 
 static int reload(void)
 {
-	reload_queues();
+	reload_queues(1);
 	return 0;
 }
 

Modified: trunk/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_rpt.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/apps/app_rpt.c (original)
+++ trunk/apps/app_rpt.c Thu Aug 16 16:09:46 2007
@@ -918,6 +918,7 @@
 	int	j;
 	struct ast_variable *vp, *var;
 	struct ast_config *cfg;
+	struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE };
 #ifdef	__RPT_NOTCH
 	AST_DECLARE_APP_ARGS(strs,
 		AST_APP_ARG(str)[100];
@@ -929,7 +930,7 @@
 	ast_mutex_lock(&rpt_vars[n].lock);
 	if (rpt_vars[n].cfg)
 		ast_config_destroy(rpt_vars[n].cfg);
-	cfg = ast_config_load("rpt.conf");
+	cfg = ast_config_load("rpt.conf", config_flags);
 	if (!cfg) {
 		ast_mutex_unlock(&rpt_vars[n].lock);
 		ast_log(LOG_NOTICE, "Unable to open radio repeater configuration rpt.conf.  Radio Repeater disabled.\n");
@@ -7437,7 +7438,8 @@
 
 static int load_module(void)
 {
-	struct ast_config *cfg = ast_config_load("rpt.conf");
+	struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE };
+	struct ast_config *cfg = ast_config_load("rpt.conf", config_flags);
 	if (!cfg) {
 		ast_log(LOG_WARNING, "No such configuration file rpt.conf\n");
 		return AST_MODULE_LOAD_DECLINE;

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Thu Aug 16 16:09:46 2007
@@ -260,7 +260,7 @@
 	AST_APP_OPTION_ARG('a', OPT_AUTOPLAY, OPT_ARG_PLAYFOLDER),
 });
 
-static int load_config(void);
+static int load_config(int reload);
 
 /*! \page vmlang Voicemail Language Syntaxes Supported
 
@@ -911,12 +911,13 @@
 	struct ast_category *cat=NULL;
 	char *category=NULL, *value=NULL, *new=NULL;
 	const char *tmp=NULL;
+	struct ast_flags config_flags = { CONFIG_FLAG_WITHCOMMENTS };
 					
 	if (!change_password_realtime(vmu, newpassword))
 		return;
 
 	/* check voicemail.conf */
-	if ((cfg = ast_config_load_with_comments(VOICEMAIL_CONFIG))) {
+	if ((cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags))) {
 		while ((category = ast_category_browse(cfg, category))) {
 			if (!strcasecmp(category, vmu->context)) {
 				if (!(tmp = ast_variable_retrieve(cfg, category, vmu->mailbox))) {
@@ -946,7 +947,7 @@
 	var = NULL;
 	/* check users.conf and update the password stored for the mailbox*/
 	/* if no vmsecret entry exists create one. */
-	if ((cfg = ast_config_load_with_comments("users.conf"))) {
+	if ((cfg = ast_config_load("users.conf", config_flags))) {
 		ast_debug(4, "we are looking for %s\n", vmu->mailbox);
 		while ((category = ast_category_browse(cfg, category))) {
 			ast_debug(4, "users.conf: %s\n", category);
@@ -1427,6 +1428,7 @@
 	const char *category = "";
 	struct ast_config *cfg=NULL;
 	struct odbc_obj *obj;
+	struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE };
 
 	delete_file(dir, msgnum);
 	obj = ast_odbc_request_obj(odbc_database, 0);
@@ -1443,7 +1445,7 @@
 		else
 			ast_copy_string(fn, dir, sizeof(fn));
 		snprintf(full_fn, sizeof(full_fn), "%s.txt", fn);
-		cfg = ast_config_load(full_fn);
+		cfg = ast_config_load(full_fn, config_flags);
 		snprintf(full_fn, sizeof(full_fn), "%s.%s", fn, fmt);
 		fd = open(full_fn, O_RDWR);
 		if (fd < 0) {
@@ -3975,6 +3977,7 @@
 	int cmd = 0;
 	int retries = 0;
 	signed char zero_gain = 0;
+	struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE };
 
 	while ((cmd >= 0) && (cmd != 't') && (cmd != '*')) {
 		if (cmd)
@@ -3995,7 +3998,7 @@
 			*duration = 0;
 
 			/* if we can't read the message metadata, stop now */
-			if (!(msg_cfg = ast_config_load(textfile))) {
+			if (!(msg_cfg = ast_config_load(textfile, config_flags))) {
 				cmd = 0;
 				break;
 			}
@@ -4733,6 +4736,7 @@
 	char filename[256], *cid;
 	const char *origtime, *context, *category, *duration;
 	struct ast_config *msg_cfg;
+	struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE };
 
 	vms->starting = 0; 
 	make_file(vms->fn, sizeof(vms->fn), vms->curdir, vms->curmsg);
@@ -4782,7 +4786,7 @@
 	make_file(vms->fn2, sizeof(vms->fn2), vms->curdir, vms->curmsg);
 	snprintf(filename, sizeof(filename), "%s.txt", vms->fn2);
 	RETRIEVE(vms->curdir, vms->curmsg, vmu->mailbox, vmu->context);
-	msg_cfg = ast_config_load(filename);
+	msg_cfg = ast_config_load(filename, config_flags);
 	if (!msg_cfg) {
 		ast_log(LOG_WARNING, "No message attribute file?!! (%s)\n", filename);
 		return 0;
@@ -7850,7 +7854,7 @@
 	return RESULT_SUCCESS;
 }
 
-static int load_config(void)
+static int load_config(int reload)
 {
 	struct ast_vm_user *cur;
 	struct vm_zone *zcur;
@@ -7863,6 +7867,17 @@
 	char *q, *stringp;
 	int x;
 	int tmpadsi[4];
+	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
+
+	if ((cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags)) == CONFIG_STATUS_FILEUNCHANGED) {
+		if ((ucfg = ast_config_load("users.conf", config_flags)) == CONFIG_STATUS_FILEUNCHANGED)
+			return 0;
+		ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
+		cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags);
+	} else {
+		ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
+		ucfg = ast_config_load("users.conf", config_flags);
+	}
 
 	/* set audio control prompts */
 	strcpy(listen_control_forward_key,DEFAULT_LISTEN_CONTROL_FORWARD_KEY);
@@ -7871,8 +7886,6 @@
 	strcpy(listen_control_restart_key,DEFAULT_LISTEN_CONTROL_RESTART_KEY);
 	strcpy(listen_control_stop_key,DEFAULT_LISTEN_CONTROL_STOP_KEY);
 	
-	cfg = ast_config_load(VOICEMAIL_CONFIG);
-
 	AST_LIST_LOCK(&users);
 	while ((cur = AST_LIST_REMOVE_HEAD(&users, list))) {
 		ast_set_flag(cur, VM_ALLOCED);
@@ -8259,7 +8272,7 @@
 		if ((val = ast_variable_retrieve(cfg, "general", "pollmailboxes")))
 			poll_mailboxes = ast_true(val);
 
-		if ((ucfg = ast_config_load("users.conf"))) {	
+		if (ucfg) {	
 			for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) {
 				if (!ast_true(ast_config_option(ucfg, cat, "hasvoicemail")))
 					continue;
@@ -8427,13 +8440,15 @@
 	} else {
 		AST_LIST_UNLOCK(&users);
 		ast_log(LOG_WARNING, "Failed to load configuration file.\n");
+		if (ucfg)
+			ast_config_destroy(ucfg);
 		return 0;
 	}
 }
 
 static int reload(void)
 {
-	return load_config();
+	return load_config(1);
 }
 
 static int unload_module(void)
@@ -8464,7 +8479,7 @@
 	/* compute the location of the voicemail spool directory */
 	snprintf(VM_SPOOL_DIR, sizeof(VM_SPOOL_DIR), "%s/voicemail/", ast_config_AST_SPOOL_DIR);
 
-	if ((res = load_config()))
+	if ((res = load_config(0)))
 		return res;
 
 	res = ast_register_application(app, vm_exec, synopsis_vm, descrip_vm);
@@ -8555,6 +8570,7 @@
 	const char *origtime, *context;
 	char *cid, *name, *num;
 	int retries = 0;
+	struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE };
 
 	vms->starting = 0; 
 #ifdef IMAP_STORAGE
@@ -8605,7 +8621,7 @@
 	make_file(vms->fn2, sizeof(vms->fn2), vms->curdir, vms->curmsg);
 	snprintf(filename,sizeof(filename), "%s.txt", vms->fn2);
 	RETRIEVE(vms->curdir, vms->curmsg, vmu->mailbox, vmu->context);
-	msg_cfg = ast_config_load(filename);
+	msg_cfg = ast_config_load(filename, config_flags);
 	DISPOSE(vms->curdir, vms->curmsg);
 	if (!msg_cfg) {
 		ast_log(LOG_WARNING, "No message attribute file?!! (%s)\n", filename);

Modified: trunk/cdr/cdr_adaptive_odbc.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_adaptive_odbc.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/cdr/cdr_adaptive_odbc.c (original)
+++ trunk/cdr/cdr_adaptive_odbc.c Thu Aug 16 16:09:46 2007
@@ -95,8 +95,9 @@
 	SQLLEN sqlptr;
 	int res = 0;
 	SQLHSTMT stmt = NULL;
-
-	cfg = ast_config_load(CONFIG);
+	struct ast_flags config_flags = { 0 }; /* Part of our config comes from the database */
+
+	cfg = ast_config_load(CONFIG, config_flags);
 	if (!cfg) {
 		ast_log(LOG_WARNING, "Unable to load " CONFIG ".  No adaptive ODBC CDRs.\n");
 		return -1;

Modified: trunk/cdr/cdr_csv.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_csv.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/cdr/cdr_csv.c (original)
+++ trunk/cdr/cdr_csv.c Thu Aug 16 16:09:46 2007
@@ -95,22 +95,24 @@
 static FILE *mf = NULL;
 
 
-static int load_config(void)
+static int load_config(int reload)
 {
 	struct ast_config *cfg;
 	struct ast_variable *var;
 	const char *tmp;
+	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
 
 	usegmtime = 0;
 	loguniqueid = 0;
 	loguserfield = 0;
 	
-	cfg = ast_config_load(config);
+	cfg = ast_config_load(config, config_flags);
 	
 	if (!cfg) {
 		ast_log(LOG_WARNING, "unable to load config: %s\n", config);
 		return 0;
-	} 
+	} else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+		return 0;
 	
 	var = ast_variable_browse(cfg, "csv");
 	if (!var) {
@@ -316,7 +318,7 @@
 {
 	int res;
 	
-	if(!load_config())
+	if(!load_config(0))
 		return AST_MODULE_LOAD_DECLINE;
 
 	res = ast_cdr_register(name, ast_module_info->description, csv_log);
@@ -330,7 +332,7 @@
 
 static int reload(void)
 {
-	load_config();
+	load_config(1);
 
 	return 0;
 }

Modified: trunk/cdr/cdr_custom.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_custom.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/cdr/cdr_custom.c (original)
+++ trunk/cdr/cdr_custom.c Thu Aug 16 16:09:46 2007
@@ -68,12 +68,16 @@
 {
 	struct ast_config *cfg;
 	struct ast_variable *var;
+	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
 	int res = -1;
+
+	if ((cfg = ast_config_load("cdr_custom.conf", config_flags)) == CONFIG_STATUS_FILEUNCHANGED)
+		return 0;
 
 	strcpy(format, "");
 	strcpy(master, "");
 	ast_mutex_lock(&lock);
-	if((cfg = ast_config_load("cdr_custom.conf"))) {
+	if (cfg) {
 		var = ast_variable_browse(cfg, "mappings");
 		while(var) {
 			if (!ast_strlen_zero(var->name) && !ast_strlen_zero(var->value)) {

Modified: trunk/cdr/cdr_manager.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_manager.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/cdr/cdr_manager.c (original)
+++ trunk/cdr/cdr_manager.c Thu Aug 16 16:09:46 2007
@@ -52,15 +52,22 @@
 static int enablecdr = 0;
 struct ast_str *customfields;
 
-static int load_config(void)
+static int load_config(int reload)
 {
 	char *cat = NULL;
 	struct ast_config *cfg;
 	struct ast_variable *v;
-	
+	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
+
+	cfg = ast_config_load(CONF_FILE, config_flags);
+	if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+		return 0;
+
+	if (reload && customfields) {
+		ast_free(customfields);
+	}
 	customfields = NULL;
 
-	cfg = ast_config_load(CONF_FILE);
 	if (!cfg) {
 		/* Standard configuration */
 		ast_log(LOG_WARNING, "Failed to load configuration file. Module not activated.\n");
@@ -174,7 +181,7 @@
 	int res;
 
 	/* Configuration file */
-	if (!load_config())
+	if (!load_config(0))
 		return AST_MODULE_LOAD_DECLINE;
 	
 	res = ast_cdr_register(name, "Asterisk Manager Interface CDR Backend", manager_log);
@@ -187,12 +194,7 @@
 
 static int reload(void)
 {
-	if (customfields) {
-		ast_free(customfields);
-	}
-	
-	load_config();
-	return 0;
+	return load_config(1);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Asterisk Manager Interface CDR Backend",

Modified: trunk/cdr/cdr_odbc.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_odbc.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/cdr/cdr_odbc.c (original)
+++ trunk/cdr/cdr_odbc.c Thu Aug 16 16:09:46 2007
@@ -226,124 +226,124 @@
 	return 0;
 }
 
-static int odbc_load_module(void)
+static int odbc_load_module(int reload)
 {
 	int res = 0;
 	struct ast_config *cfg;
 	struct ast_variable *var;
 	const char *tmp;
+	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
 
 	ast_mutex_lock(&odbc_lock);
 
-	cfg = ast_config_load(config);
-	if (!cfg) {
-		ast_log(LOG_WARNING, "cdr_odbc: Unable to load config for ODBC CDR's: %s\n", config);
-		res = AST_MODULE_LOAD_DECLINE;
-		goto out;
-	}
+	do {
+		cfg = ast_config_load(config, config_flags);
+		if (!cfg) {
+			ast_log(LOG_WARNING, "cdr_odbc: Unable to load config for ODBC CDR's: %s\n", config);
+			res = AST_MODULE_LOAD_DECLINE;
+			break;
+		} else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+			break;
 	
-	var = ast_variable_browse(cfg, "global");
-	if (!var) {
-		/* nothing configured */
-		goto out;
-	}
-
-	tmp = ast_variable_retrieve(cfg,"global","dsn");
-	if (tmp == NULL) {
-		ast_log(LOG_WARNING,"cdr_odbc: dsn not specified.  Assuming asteriskdb\n");
-		tmp = "asteriskdb";
-	}
-	dsn = strdup(tmp);
-	if (dsn == NULL) {
-		ast_log(LOG_ERROR,"cdr_odbc: Out of memory error.\n");
-		res = -1;
-		goto out;
-	}
-
-	tmp = ast_variable_retrieve(cfg,"global","dispositionstring");
-	if (tmp) {
-		dispositionstring = ast_true(tmp);
-	} else {
-		dispositionstring = 0;
-	}
-		
-	tmp = ast_variable_retrieve(cfg,"global","username");
-	if (tmp) {
-		username = strdup(tmp);
-		if (username == NULL) {
-			ast_log(LOG_ERROR,"cdr_odbc: Out of memory error.\n");
+		var = ast_variable_browse(cfg, "global");
+		if (!var) {
+			/* nothing configured */
+			break;
+		}
+
+		if ((tmp = ast_variable_retrieve(cfg, "global", "dsn")) == NULL) {
+			ast_log(LOG_WARNING, "cdr_odbc: dsn not specified.  Assuming asteriskdb\n");
+			tmp = "asteriskdb";
+		}
+		if (dsn)
+			ast_free(dsn);
+		dsn = ast_strdup(tmp);
+		if (dsn == NULL) {
 			res = -1;
-			goto out;
-		}
-	}
-
-	tmp = ast_variable_retrieve(cfg,"global","password");
-	if (tmp) {
-		password = strdup(tmp);
-		if (password == NULL) {
-			ast_log(LOG_ERROR,"cdr_odbc: Out of memory error.\n");
+			break;
+		}
+
+		if ((tmp = ast_variable_retrieve(cfg, "global", "dispositionstring")))
+			dispositionstring = ast_true(tmp);
+		else
+			dispositionstring = 0;
+
+		if ((tmp = ast_variable_retrieve(cfg, "global", "username"))) {
+			if (username)
+				ast_free(username);
+			username = ast_strdup(tmp);
+			if (username == NULL) {
+				res = -1;
+				break;
+			}
+		}
+
+		if ((tmp = ast_variable_retrieve(cfg, "global", "password"))) {
+			if (password)
+				ast_free(password);
+			password = ast_strdup(tmp);
+			if (password == NULL) {
+				res = -1;
+				break;
+			}
+		}
+
+		if ((tmp = ast_variable_retrieve(cfg, "global", "loguniqueid"))) {
+			loguniqueid = ast_true(tmp);
+			if (loguniqueid) {
+				ast_debug(1, "cdr_odbc: Logging uniqueid\n");
+			} else {
+				ast_debug(1, "cdr_odbc: Not logging uniqueid\n");
+			}
+		} else {
+			ast_debug(1, "cdr_odbc: Not logging uniqueid\n");
+			loguniqueid = 0;
+		}
+
+		if ((tmp = ast_variable_retrieve(cfg, "global", "usegmtime"))) {
+			usegmtime = ast_true(tmp);
+			if (usegmtime) {
+				ast_debug(1, "cdr_odbc: Logging in GMT\n");
+			} else {
+				ast_debug(1, "cdr_odbc: Not logging in GMT\n");
+			}
+		} else {
+			ast_debug(1, "cdr_odbc: Not logging in GMT\n");
+			usegmtime = 0;
+		}
+
+		if ((tmp = ast_variable_retrieve(cfg, "global", "table")) == NULL) {
+			ast_log(LOG_WARNING, "cdr_odbc: table not specified.  Assuming cdr\n");
+			tmp = "cdr";
+		}
+		if (table)
+			ast_free(table);
+		table = ast_strdup(tmp);
+		if (table == NULL) {
 			res = -1;
-			goto out;
-		}
-	}
-
-	tmp = ast_variable_retrieve(cfg,"global","loguniqueid");
-	if (tmp) {
-		loguniqueid = ast_true(tmp);
-		if (loguniqueid) {
-			ast_debug(1,"cdr_odbc: Logging uniqueid\n");
-		} else {
-			ast_debug(1,"cdr_odbc: Not logging uniqueid\n");
-		}
-	} else {
-		ast_debug(1,"cdr_odbc: Not logging uniqueid\n");
-		loguniqueid = 0;
-	}
-
-	tmp = ast_variable_retrieve(cfg,"global","usegmtime");
-	if (tmp) {
-		usegmtime = ast_true(tmp);
-		if (usegmtime) {
-			ast_debug(1,"cdr_odbc: Logging in GMT\n");
-		} else {
-			ast_debug(1,"cdr_odbc: Not logging in GMT\n");
-		}
-	} else {
-		ast_debug(1,"cdr_odbc: Not logging in GMT\n");
-		usegmtime = 0;
-	}
-
-	tmp = ast_variable_retrieve(cfg,"global","table");
-	if (tmp == NULL) {
-		ast_log(LOG_WARNING,"cdr_odbc: table not specified.  Assuming cdr\n");
-		tmp = "cdr";
-	}
-	table = strdup(tmp);
-	if (table == NULL) {
-		ast_log(LOG_ERROR,"cdr_odbc: Out of memory error.\n");
-		res = -1;
-		goto out;
-	}
-
-	ast_verb(3, "cdr_odbc: dsn is %s\n",dsn);
-	if (username) {
-		ast_verb(3, "cdr_odbc: username is %s\n",username);
-		ast_verb(3, "cdr_odbc: password is [secret]\n");
-	} else
-		ast_verb(3, "cdr_odbc: retreiving username and password from odbc config\n");
-	ast_verb(3, "cdr_odbc: table is %s\n",table);
-	
-	res = odbc_init();
-	if (res < 0) {
-		ast_log(LOG_ERROR, "cdr_odbc: Unable to connect to datasource: %s\n", dsn);
-		ast_verb(3, "cdr_odbc: Unable to connect to datasource: %s\n", dsn);
-		}
-	res = ast_cdr_register(name, ast_module_info->description, odbc_log);
-	if (res) {
-		ast_log(LOG_ERROR, "cdr_odbc: Unable to register ODBC CDR handling\n");
-	}
-out:
-	if (cfg)
+			break;
+		}
+
+		ast_verb(3, "cdr_odbc: dsn is %s\n", dsn);
+		if (username) {
+			ast_verb(3, "cdr_odbc: username is %s\n", username);
+			ast_verb(3, "cdr_odbc: password is [secret]\n");
+		} else
+			ast_verb(3, "cdr_odbc: retrieving username and password from odbc config\n");
+		ast_verb(3, "cdr_odbc: table is %s\n", table);
+
+		res = odbc_init();
+		if (res < 0) {
+			ast_log(LOG_ERROR, "cdr_odbc: Unable to connect to datasource: %s\n", dsn);
+			ast_verb(3, "cdr_odbc: Unable to connect to datasource: %s\n", dsn);
+			}
+		res = ast_cdr_register(name, ast_module_info->description, odbc_log);
+		if (res) {
+			ast_log(LOG_ERROR, "cdr_odbc: Unable to register ODBC CDR handling\n");
+		}
+	} while (0);
+
+	if (cfg && cfg != CONFIG_STATUS_FILEUNCHANGED)
 		ast_config_destroy(cfg);
 	ast_mutex_unlock(&odbc_lock);
 	return res;
@@ -418,7 +418,7 @@
 
 static int load_module(void)
 {
-	return odbc_load_module();
+	return odbc_load_module(0);
 }
 
 static int unload_module(void)
@@ -428,8 +428,7 @@
 
 static int reload(void)
 {
-	odbc_unload_module();
-	return odbc_load_module();
+	return odbc_load_module(1);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "ODBC CDR Backend",

Modified: trunk/cdr/cdr_pgsql.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_pgsql.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/cdr/cdr_pgsql.c (original)
+++ trunk/cdr/cdr_pgsql.c Thu Aug 16 16:09:46 2007
@@ -183,7 +183,7 @@
 	return 0;
 }
 
-static int my_unload_module(void)
+static int unload_module(void)
 { 
 	PQfinish(conn);
 	if (pghostname)
@@ -202,20 +202,30 @@
 	return 0;
 }
 
-static int process_my_load_module(struct ast_config *cfg)
+static int config_module(int reload)
 {
 	struct ast_variable *var;
-        char *pgerror;
+	char *pgerror;
 	const char *tmp;
+	struct ast_config *cfg;
+	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
+
+	if ((cfg = ast_config_load(config, config_flags)) == NULL) {
+		ast_log(LOG_WARNING, "Unable to load config for PostgreSQL CDR's: %s\n", config);
+		return -1;
+	} else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+		return 0;
 
 	if (!(var = ast_variable_browse(cfg, "global")))
 		return 0;
 
-	if (!(tmp = ast_variable_retrieve(cfg,"global","hostname"))) {
-		ast_log(LOG_WARNING,"PostgreSQL server hostname not specified.  Assuming unix socket connection\n");
+	if (!(tmp = ast_variable_retrieve(cfg, "global", "hostname"))) {
+		ast_log(LOG_WARNING, "PostgreSQL server hostname not specified.  Assuming unix socket connection\n");
 		tmp = "";	/* connect via UNIX-socket by default */
 	}
-	
+
+	if (pghostname)
+		ast_free(pghostname);
 	if (!(pghostname = ast_strdup(tmp)))
 		return -1;
 
@@ -224,6 +234,8 @@
 		tmp = "asteriskcdrdb";
 	}
 
+	if (pgdbname)
+		ast_free(pgdbname);
 	if (!(pgdbname = ast_strdup(tmp)))
 		return -1;
 
@@ -232,6 +244,8 @@
 		tmp = "asterisk";
 	}
 
+	if (pgdbuser)
+		ast_free(pgdbuser);
 	if (!(pgdbuser = ast_strdup(tmp)))
 		return -1;
 
@@ -240,6 +254,8 @@
 		tmp = "";
 	}
 
+	if (pgpassword)
+		ast_free(pgpassword);
 	if (!(pgpassword = ast_strdup(tmp)))
 		return -1;
 
@@ -248,6 +264,8 @@
 		tmp = "5432";
 	}
 
+	if (pgdbport)
+		ast_free(pgdbport);
 	if (!(pgdbport = ast_strdup(tmp)))
 		return -1;
 
@@ -256,6 +274,8 @@
 		tmp = "cdr";
 	}
 
+	if (table)
+		ast_free(table);
 	if (!(table = ast_strdup(tmp)))
 		return -1;
 
@@ -276,49 +296,23 @@
 		ast_debug(1, "Successfully connected to PostgreSQL database.\n");
 		connected = 1;
 	} else {
-                pgerror = PQerrorMessage(conn);
+		pgerror = PQerrorMessage(conn);
 		ast_log(LOG_ERROR, "cdr_pgsql: Unable to connect to database server %s.  CALLS WILL NOT BE LOGGED!!\n", pghostname);
-                ast_log(LOG_ERROR, "cdr_pgsql: Reason: %s\n", pgerror);
+		ast_log(LOG_ERROR, "cdr_pgsql: Reason: %s\n", pgerror);
 		connected = 0;
 	}
 
 	return ast_cdr_register(name, ast_module_info->description, pgsql_log);
-}
-
-static int my_load_module(void)
-{
-	struct ast_config *cfg;
-	int res;
-
-	if (!(cfg = ast_config_load(config))) {
-		ast_log(LOG_WARNING, "Unable to load config for PostgreSQL CDR's: %s\n", config);
-		return AST_MODULE_LOAD_DECLINE;
-	}
-
-	res = process_my_load_module(cfg);
-	ast_config_destroy(cfg);
-
-	return res;
 }
 
 static int load_module(void)
 {
-	return my_load_module();
-}
-
-static int unload_module(void)
-{
-	return my_unload_module();
+	return config_module(0) ? AST_MODULE_LOAD_DECLINE : 0;
 }
 
 static int reload(void)
 {
-	int res;
-	ast_mutex_lock(&pgsql_lock);
-	my_unload_module();
-	res = my_load_module();
-	ast_mutex_unlock(&pgsql_lock);
-	return res;
+	return config_module(1);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "PostgreSQL CDR Backend",

Modified: trunk/cdr/cdr_radius.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_radius.c?view=diff&rev=79747&r1=79746&r2=79747
==============================================================================
--- trunk/cdr/cdr_radius.c (original)
+++ trunk/cdr/cdr_radius.c Thu Aug 16 16:09:46 2007
@@ -232,10 +232,11 @@
 static int load_module(void)
 {
 	struct ast_config *cfg;
+	struct ast_flags config_flags = { 0 };
 	int res;
 	const char *tmp;
 
-	if ((cfg = ast_config_load(cdr_config))) {
+	if ((cfg = ast_config_load(cdr_config, config_flags))) {
 		ast_set2_flag(&global_flags, ast_true(ast_variable_retrieve(cfg, "radius", "usegmtime")), RADIUS_FLAG_USEGMTIME);
 		ast_set2_flag(&global_flags, ast_true(ast_variable_retrieve(cfg, "radius", "loguniqueid")), RADIUS_FLAG_LOGUNIQUEID);
 		ast_set2_flag(&global_flags, ast_true(ast_variable_retrieve(cfg, "radius", "loguserfield")), RADIUS_FLAG_LOGUSERFIELD);


[... 2919 lines stripped ...]



More information about the svn-commits mailing list