Merged revisions 331955 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r331955 | rmudgett | 2011-08-15 12:24:08 -0500 (Mon, 15 Aug 2011) | 13 lines
  
  Fix some minor chan_dahdi config load issues.
  
  * Address chan_dahdi.conf dahdichan option todo item about needing line
  number.
  
  * Make ignore_failed_channels option also apply to dahdichan option.
  
  * Don't attempt to create a default pseudo channel if the chan_dahdi.conf
  channel/channels option is not allowed.
  
  * Add a similar check for dahdichan in normal chan_dahdi.conf sections as
  is done in users.conf.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@331956 65c4cc65-6c06-0410-ace0-fbb531ad65f3
10-digiumphones
Richard Mudgett 14 years ago
parent 8d614eb68f
commit 41549fcd66

@ -17007,7 +17007,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
struct dahdi_pvt *tmp; struct dahdi_pvt *tmp;
int y; int y;
int found_pseudo = 0; int found_pseudo = 0;
char dahdichan[MAX_CHANLIST_LEN] = {}; struct ast_variable *dahdichan = NULL;
for (; v; v = v->next) { for (; v; v = v->next) {
if (!ast_jb_read_conf(&global_jbconf, v->name, v->value)) if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
@ -17041,7 +17041,8 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
confp->chan.usefaxbuffers = 1; confp->chan.usefaxbuffers = 1;
} }
} else if (!strcasecmp(v->name, "dahdichan")) { } else if (!strcasecmp(v->name, "dahdichan")) {
ast_copy_string(dahdichan, v->value, sizeof(dahdichan)); /* Only process the last dahdichan value. */
dahdichan = v;
} else if (!strcasecmp(v->name, "usedistinctiveringdetection")) { } else if (!strcasecmp(v->name, "usedistinctiveringdetection")) {
usedistinctiveringdetection = ast_true(v->value); usedistinctiveringdetection = ast_true(v->value);
} else if (!strcasecmp(v->name, "distinctiveringaftercid")) { } else if (!strcasecmp(v->name, "distinctiveringaftercid")) {
@ -18104,13 +18105,19 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
confp->chan.vars = NULL; confp->chan.vars = NULL;
} }
if (dahdichan[0]) { if (dahdichan) {
/* The user has set 'dahdichan' */ /* Process the deferred dahdichan value. */
/*< \todo pass proper line number instead of 0 */ if (build_channels(confp, dahdichan->value, reload, dahdichan->lineno,
if (build_channels(confp, dahdichan, reload, 0, &found_pseudo)) { &found_pseudo)) {
if (confp->ignore_failed_channels) {
ast_log(LOG_WARNING,
"Dahdichan '%s' failure ignored: ignore_failed_channels.\n",
dahdichan->value);
} else {
return -1; return -1;
} }
} }
}
/* mark the first channels of each DAHDI span to watch for their span alarms */ /* mark the first channels of each DAHDI span to watch for their span alarms */
for (tmp = iflist, y=-1; tmp; tmp = tmp->next) { for (tmp = iflist, y=-1; tmp; tmp = tmp->next) {
@ -18124,7 +18131,7 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
/*< \todo why check for the pseudo in the per-channel section. /*< \todo why check for the pseudo in the per-channel section.
* Any actual use for manual setup of the pseudo channel? */ * Any actual use for manual setup of the pseudo channel? */
if (!found_pseudo && reload != 1) { if (!found_pseudo && reload != 1 && !(options & PROC_DAHDI_OPT_NOCHAN)) {
/* use the default configuration for a channel, so /* use the default configuration for a channel, so
that any settings from real configured channels that any settings from real configured channels
don't "leak" into the pseudo channel config don't "leak" into the pseudo channel config
@ -18184,6 +18191,7 @@ static int setup_dahdi_int(int reload, struct dahdi_chan_conf *default_conf, str
struct ast_config *ucfg; struct ast_config *ucfg;
struct ast_variable *v; struct ast_variable *v;
struct ast_flags config_flags = { reload == 1 ? CONFIG_FLAG_FILEUNCHANGED : 0 }; struct ast_flags config_flags = { reload == 1 ? CONFIG_FLAG_FILEUNCHANGED : 0 };
const char *chans;
const char *cat; const char *cat;
int res; int res;
@ -18297,7 +18305,9 @@ static int setup_dahdi_int(int reload, struct dahdi_chan_conf *default_conf, str
mwimonitornotify[0] = '\0'; mwimonitornotify[0] = '\0';
v = ast_variable_browse(cfg, "channels"); v = ast_variable_browse(cfg, "channels");
if ((res = process_dahdi(base_conf, "", v, reload, 0))) { if ((res = process_dahdi(base_conf,
"" /* Must be empty for the channels category. Silly voicemail mailbox. */,
v, reload, 0))) {
ast_mutex_unlock(&iflock); ast_mutex_unlock(&iflock);
ast_config_destroy(cfg); ast_config_destroy(cfg);
if (ucfg) { if (ucfg) {
@ -18318,6 +18328,12 @@ static int setup_dahdi_int(int reload, struct dahdi_chan_conf *default_conf, str
continue; continue;
} }
chans = ast_variable_retrieve(ucfg, cat, "dahdichan");
if (ast_strlen_zero(chans)) {
/* Section is useless without a dahdichan value present. */
continue;
}
/* Copy base_conf to conf. */ /* Copy base_conf to conf. */
deep_copy_dahdi_chan_conf(conf, base_conf); deep_copy_dahdi_chan_conf(conf, base_conf);
@ -18334,11 +18350,11 @@ static int setup_dahdi_int(int reload, struct dahdi_chan_conf *default_conf, str
ast_config_destroy(cfg); ast_config_destroy(cfg);
if (ucfg) { if (ucfg) {
const char *chans; /* Reset base_conf, so things don't leak from chan_dahdi.conf */
/* Reset base_conf, so things don't leak from dahdi_chan.conf */
deep_copy_dahdi_chan_conf(base_conf, default_conf); deep_copy_dahdi_chan_conf(base_conf, default_conf);
process_dahdi(base_conf, "", ast_variable_browse(ucfg, "general"), 1, 0); process_dahdi(base_conf,
"" /* Must be empty for the general category. Silly voicemail mailbox. */,
ast_variable_browse(ucfg, "general"), 1, 0);
for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) { for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) {
if (!strcasecmp(cat, "general")) { if (!strcasecmp(cat, "general")) {
@ -18346,8 +18362,8 @@ static int setup_dahdi_int(int reload, struct dahdi_chan_conf *default_conf, str
} }
chans = ast_variable_retrieve(ucfg, cat, "dahdichan"); chans = ast_variable_retrieve(ucfg, cat, "dahdichan");
if (ast_strlen_zero(chans)) { if (ast_strlen_zero(chans)) {
/* Section is useless without a dahdichan value present. */
continue; continue;
} }

Loading…
Cancel
Save