]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
No DAHDI channel available for conference, user introduction disabled.
authorRichard Mudgett <rmudgett@digium.com>
Wed, 31 Aug 2011 15:57:12 +0000 (15:57 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Wed, 31 Aug 2011 15:57:12 +0000 (15:57 +0000)
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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@334012 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_dahdi.c

index 1ec88bc663b7bfdfd139469462f323b316370336..909ff92b21e47daefa514565404c91de06c3c49c 100644 (file)
@@ -17858,23 +17858,56 @@ static int setup_dahdi_int(int reload, struct dahdi_chan_conf *default_conf, str
        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 @@ static int setup_dahdi_int(int reload, struct dahdi_chan_conf *default_conf, str
                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);