[svn-commits] rmudgett: branch 1.8 r334012 - /branches/1.8/channels/chan_dahdi.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Aug 31 10:57:16 CDT 2011


Author: rmudgett
Date: Wed Aug 31 10:57:12 2011
New Revision: 334012

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=334012
Log:
No DAHDI channel available for conference, user introduction disabled.

The following error will consistently occur when trying to dial into a
MeetMe conference when the server does not have DAHDI hardware installed:

app_meetme.c: No DAHDI channel available for conference, user introduction
disabled (is chan_dahdi loaded?)

While chan_dahdi is loaded correctly during compilation and install of
Asterisk/Dahdi, including associated modules, etc., a chan_dahdi.conf
configuration file in /etc/asterisk is not created by FreePBX if hardware
does not exist, causing MeetMe to be unable to open a DAHDI pseudo
channel.

* Allow chan_dahdi to create a pseudo channel when there is no
chan_dahdi.conf file to load.

(closes issue ASTERISK-17398)
Reported by: Preston Edwards
Patches:
      jira_asterisk_17398_v1.8.patch (license #5621) patch uploaded by rmudgett
Tested by: rmudgett

Modified:
    branches/1.8/channels/chan_dahdi.c

Modified: branches/1.8/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_dahdi.c?view=diff&rev=334012&r1=334011&r2=334012
==============================================================================
--- branches/1.8/channels/chan_dahdi.c (original)
+++ branches/1.8/channels/chan_dahdi.c Wed Aug 31 10:57:12 2011
@@ -17858,23 +17858,56 @@
 	int trunkgroup;
 	int dchannels[SIG_PRI_NUM_DCHANS];
 #endif
+	int have_cfg_now;
+	static int had_cfg_before = 1;/* So initial load will complain if we don't have cfg. */
 
 	cfg = ast_config_load(config, config_flags);
-
-	/* Error if we have no config file */
+	have_cfg_now = !!cfg;
 	if (!cfg) {
-		ast_log(LOG_ERROR, "Unable to load config %s\n", config);
-		return 0;
+		/* Error if we have no config file */
+		if (had_cfg_before) {
+			ast_log(LOG_ERROR, "Unable to load config %s\n", config);
+			ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
+		}
+		cfg = ast_config_new();/* Dummy config */
+		if (!cfg) {
+			return 0;
+		}
+		ucfg = ast_config_load("users.conf", config_flags);
+		if (ucfg == CONFIG_STATUS_FILEUNCHANGED) {
+			ast_config_destroy(cfg);
+			return 0;
+		}
+		if (ucfg == CONFIG_STATUS_FILEINVALID) {
+			ast_log(LOG_ERROR, "File users.conf cannot be parsed.  Aborting.\n");
+			ast_config_destroy(cfg);
+			return 0;
+		}
 	} else if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
 		ucfg = ast_config_load("users.conf", config_flags);
 		if (ucfg == CONFIG_STATUS_FILEUNCHANGED) {
 			return 0;
-		} else if (ucfg == CONFIG_STATUS_FILEINVALID) {
+		}
+		if (ucfg == CONFIG_STATUS_FILEINVALID) {
 			ast_log(LOG_ERROR, "File users.conf cannot be parsed.  Aborting.\n");
 			return 0;
 		}
 		ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
-		if ((cfg = ast_config_load(config, config_flags)) == CONFIG_STATUS_FILEINVALID) {
+		cfg = ast_config_load(config, config_flags);
+		have_cfg_now = !!cfg;
+		if (!cfg) {
+			if (had_cfg_before) {
+				/* We should have been able to load the config. */
+				ast_log(LOG_ERROR, "Bad. Unable to load config %s\n", config);
+				ast_config_destroy(ucfg);
+				return 0;
+			}
+			cfg = ast_config_new();/* Dummy config */
+			if (!cfg) {
+				ast_config_destroy(ucfg);
+				return 0;
+			}
+		} else if (cfg == CONFIG_STATUS_FILEINVALID) {
 			ast_log(LOG_ERROR, "File %s cannot be parsed.  Aborting.\n", config);
 			ast_config_destroy(ucfg);
 			return 0;
@@ -17884,12 +17917,14 @@
 		return 0;
 	} else {
 		ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
-		if ((ucfg = ast_config_load("users.conf", config_flags)) == CONFIG_STATUS_FILEINVALID) {
+		ucfg = ast_config_load("users.conf", config_flags);
+		if (ucfg == CONFIG_STATUS_FILEINVALID) {
 			ast_log(LOG_ERROR, "File users.conf cannot be parsed.  Aborting.\n");
 			ast_config_destroy(cfg);
 			return 0;
 		}
 	}
+	had_cfg_before = have_cfg_now;
 
 	/* It's a little silly to lock it, but we might as well just to be sure */
 	ast_mutex_lock(&iflock);




More information about the svn-commits mailing list