[svn-commits] rmudgett: trunk r334014 - in /trunk: ./ channels/chan_dahdi.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Aug 31 11:02:15 CDT 2011


Author: rmudgett
Date: Wed Aug 31 11:02:11 2011
New Revision: 334014

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=334014
Log:
Merged revisions 334013 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r334013 | rmudgett | 2011-08-31 11:00:49 -0500 (Wed, 31 Aug 2011) | 30 lines
  
  Merged revisions 334012 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r334012 | rmudgett | 2011-08-31 10:57:12 -0500 (Wed, 31 Aug 2011) | 23 lines
    
    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:
    trunk/   (props changed)
    trunk/channels/chan_dahdi.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=334014&r1=334013&r2=334014
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Wed Aug 31 11:02:11 2011
@@ -18216,23 +18216,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;
@@ -18242,12 +18275,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