The last argument of process_zap() is called 'skipchannels'. It is intended when calling it to process sections from users.conf , and has two effect: 1. Not process 'channel =>' and 'crv =>' keywords (only build channel at the end of the section). 2. Skip warnings for unknown keywords, as with users.conf this is expected. Processing of sections in zapata.conf requires only (1). Using (2) as well would hide configuration file typos. This patch makes that parameter a bit-field with two separate options . Note that now the default call is to this parameter with a value of 0 rather than 1. Thus it is possible to use (1) without (2). --- trunk.orig/channels/chan_zap.c +++ trunk/channels/chan_zap.c @@ -206,6 +206,12 @@ static const char config[] = "zapata.con #define SIG_GR303FXOKS (0x0100000 | ZT_SIG_FXOKS) #define SIG_GR303FXSKS (0x0100000 | ZT_SIG_FXSKS) + +/*! process_zap() - ignore keywork 'channel' and similar */ +#define PROC_ZAP_OPT_NOCHAN (1 << 0) +/*! process_zap() - No warnings on non-existing cofiguration keywords */ +#define PROC_ZAP_OPT_NOWARN (1 << 1) + #ifdef LOTS_OF_SPANS #define NUM_SPANS ZT_MAX_SPANS #else @@ -13195,7 +13201,7 @@ static void process_echocancel(struct zt } #endif /* defined(HAVE_ZAPTEL_ECHOCANPARAMS) */ -static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int reload, int skipchannels) +static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int reload, int options) { struct zt_pvt *tmp; const char *ringc; /* temporary string for parsing the dring number. */ @@ -13214,7 +13220,7 @@ static int process_zap(struct zt_chan_co #endif ) { int iscrv; - if (skipchannels) + if (options && PROC_ZAP_OPT_NOCHAN) continue; iscrv = !strcasecmp(v->name, "crv"); if (build_channels(*confp, iscrv, v->value, reload, v->lineno, &found_pseudo)) @@ -13959,7 +13965,7 @@ static int process_zap(struct zt_chan_co } else if (!strcasecmp(v->name, "mwilevel")) { mwilevel = atoi(v->value); } - } else if (!skipchannels) + } else if (!(options && PROC_ZAP_OPT_NOWARN) ) ast_log(LOG_WARNING, "Ignoring %s at line %d.\n", v->name, v->lineno); } if (zapchan[0]) { @@ -14104,7 +14110,7 @@ static int setup_zap(int reload) return res; } if (ucfg) { - process_zap(&base_conf, ast_variable_browse(ucfg, "general"), 1, 1); + process_zap(&base_conf, ast_variable_browse(ucfg, "general"), 1, 0); } /* Now get configuration from all normal sections in zapata.conf: */ @@ -14123,7 +14129,7 @@ static int setup_zap(int reload) ast_config_destroy(cfg); return -1; } - process_zap(&conf, ast_variable_browse(cfg, cat), reload, 0); + process_zap(&conf, ast_variable_browse(cfg, cat), reload, PROC_ZAP_OPT_NOCHAN); if (res) { ast_mutex_unlock(&iflock); ast_config_destroy(cfg); @@ -14136,7 +14142,7 @@ static int setup_zap(int reload) if (ucfg) { const char *chans; - process_zap(&base_conf, ast_variable_browse(ucfg, "general"), 1, 1); + process_zap(&base_conf, ast_variable_browse(ucfg, "general"), 1, 0); for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) { if (!strcasecmp(cat, "general")) continue; @@ -14149,7 +14155,8 @@ static int setup_zap(int reload) return -1; } - res = process_zap(&conf, ast_variable_browse(ucfg, cat), reload, 0); + res = process_zap(&conf, ast_variable_browse(ucfg, cat), reload, + PROC_ZAP_OPT_NOCHAN | PROC_ZAP_OPT_NOWARN); if (res) { ast_config_destroy(ucfg); ast_mutex_unlock(&iflock);