[asterisk-commits] rmudgett: trunk r324850 - in /trunk: ./ pbx/pbx_config.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jun 24 15:50:55 CDT 2011
Author: rmudgett
Date: Fri Jun 24 15:50:52 2011
New Revision: 324850
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=324850
Log:
Merged revisions 324849 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r324849 | rmudgett | 2011-06-24 15:46:01 -0500 (Fri, 24 Jun 2011) | 15 lines
Syntax errors in dialplan do not display the file name.
When issuing the CLI command "dialplan reload" syntax errors and warnings
are displayed on the console. The offending line number is displayed on
the console, but the file name is not displayed. Errors caught in
main/config.c do display the file name.
(closes issue ASTERISK-17985)
Reported by: ulogic
Patches:
pbx_config.patch uploaded by ulogic (License #5685) modified format
Tested by: rmudgett
JIRA SWP-3554
........
Modified:
trunk/ (props changed)
trunk/pbx/pbx_config.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: trunk/pbx/pbx_config.c
URL: http://svnview.digium.com/svn/asterisk/trunk/pbx/pbx_config.c?view=diff&rev=324850&r1=324849&r2=324850
==============================================================================
--- trunk/pbx/pbx_config.c (original)
+++ trunk/pbx/pbx_config.c Fri Jun 24 15:50:52 2011
@@ -1439,10 +1439,16 @@
char *tc = NULL;
char realext[256] = "";
char *stringp, *ext;
+ const char *vfile;
+
+ /* get filename for error reporting from top level or an #include */
+ vfile = !*v->file ? config_file : v->file;
if (!strncasecmp(v->name, "same", 4)) {
if (ast_strlen_zero(lastextension)) {
- ast_log(LOG_ERROR, "No previous pattern in the first entry of context '%s' to match '%s' at line %d!\n", cxt, v->name, v->lineno);
+ ast_log(LOG_ERROR,
+ "No previous pattern in the first entry of context '%s' to match '%s' at line %d of %s!\n",
+ cxt, v->name, v->lineno, vfile);
continue;
}
if ((stringp = tc = ast_strdup(v->value))) {
@@ -1473,7 +1479,9 @@
if ((end = strchr(label, ')'))) {
*end = '\0';
} else {
- ast_log(LOG_WARNING, "Label missing trailing ')' at line %d\n", v->lineno);
+ ast_log(LOG_WARNING,
+ "Label missing trailing ')' at line %d of %s\n",
+ v->lineno, vfile);
ast_free(tc);
continue;
}
@@ -1487,7 +1495,9 @@
if (lastpri > -2) {
ipri = lastpri + 1;
} else {
- ast_log(LOG_WARNING, "Can't use 'next' priority on the first entry at line %d!\n", v->lineno);
+ ast_log(LOG_WARNING,
+ "Can't use 'next' priority on the first entry at line %d of %s!\n",
+ v->lineno, vfile);
ast_free(tc);
continue;
}
@@ -1495,18 +1505,23 @@
if (lastpri > -2) {
ipri = lastpri;
} else {
- ast_log(LOG_WARNING, "Can't use 'same' priority on the first entry at line %d!\n", v->lineno);
+ ast_log(LOG_WARNING,
+ "Can't use 'same' priority on the first entry at line %d of %s!\n",
+ v->lineno, vfile);
ast_free(tc);
continue;
}
} else if (sscanf(pri, "%30d", &ipri) != 1 &&
(ipri = ast_findlabel_extension2(NULL, con, realext, pri, cidmatch)) < 1) {
- ast_log(LOG_WARNING, "Invalid priority/label '%s' at line %d\n", pri, v->lineno);
+ ast_log(LOG_WARNING,
+ "Invalid priority/label '%s' at line %d of %s\n",
+ pri, v->lineno, vfile);
ipri = 0;
ast_free(tc);
continue;
} else if (ipri < 1) {
- ast_log(LOG_WARNING, "Invalid priority '%s' at line %d\n", pri, v->lineno);
+ ast_log(LOG_WARNING, "Invalid priority '%s' at line %d of %s\n",
+ pri, v->lineno, vfile);
ast_free(tc);
continue;
}
@@ -1537,7 +1552,9 @@
if ((end = strrchr(data, ')'))) {
*end = '\0';
} else {
- ast_log(LOG_WARNING, "No closing parenthesis found? '%s(%s' at line %d\n", appl, data, v->lineno);
+ ast_log(LOG_WARNING,
+ "No closing parenthesis found? '%s(%s' at line %d of %s\n",
+ appl, data, v->lineno, vfile);
}
}
ast_free(orig_appl);
@@ -1550,10 +1567,14 @@
}
lastpri = ipri;
if (!ast_opt_dont_warn && (!strcmp(realext, "_.") || !strcmp(realext, "_!"))) {
- ast_log(LOG_WARNING, "The use of '%s' for an extension is strongly discouraged and can have unexpected behavior. Please use '_X%c' instead at line %d\n", realext, realext[1], v->lineno);
+ ast_log(LOG_WARNING,
+ "The use of '%s' for an extension is strongly discouraged and can have unexpected behavior. Please use '_X%c' instead at line %d of %s\n",
+ realext, realext[1], v->lineno, vfile);
}
if (ast_add_extension2(con, 0, realext, ipri, label, cidmatch, appl, strdup(data), ast_free_ptr, registrar)) {
- ast_log(LOG_WARNING, "Unable to register extension at line %d\n", v->lineno);
+ ast_log(LOG_WARNING,
+ "Unable to register extension at line %d of %s\n",
+ v->lineno, vfile);
}
}
free(tc);
@@ -1561,35 +1582,40 @@
pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
if (ast_context_add_include2(con, realvalue, registrar)) {
switch (errno) {
- case ENOMEM:
- ast_log(LOG_WARNING, "Out of memory for context addition\n");
- break;
-
- case EBUSY:
- ast_log(LOG_WARNING, "Failed to lock context(s) list, please try again later\n");
- break;
-
- case EEXIST:
- ast_log(LOG_WARNING, "Context '%s' already included in '%s' context on include at line %d\n",
- v->value, cxt, v->lineno);
- break;
-
- case ENOENT:
- case EINVAL:
- ast_log(LOG_WARNING, "There is no existence of context '%s' included at line %d\n",
- errno == ENOENT ? v->value : cxt, v->lineno);
- break;
-
- default:
- ast_log(LOG_WARNING, "Failed to include '%s' in '%s' context at line %d\n",
- v->value, cxt, v->lineno);
- break;
+ case ENOMEM:
+ ast_log(LOG_WARNING, "Out of memory for context addition\n");
+ break;
+
+ case EBUSY:
+ ast_log(LOG_WARNING, "Failed to lock context(s) list, please try again later\n");
+ break;
+
+ case EEXIST:
+ ast_log(LOG_WARNING,
+ "Context '%s' already included in '%s' context on include at line %d of %s\n",
+ v->value, cxt, v->lineno, vfile);
+ break;
+
+ case ENOENT:
+ case EINVAL:
+ ast_log(LOG_WARNING,
+ "There is no existence of context '%s' included at line %d of %s\n",
+ errno == ENOENT ? v->value : cxt, v->lineno, vfile);
+ break;
+
+ default:
+ ast_log(LOG_WARNING,
+ "Failed to include '%s' in '%s' context at line %d of %s\n",
+ v->value, cxt, v->lineno, vfile);
+ break;
}
}
} else if (!strcasecmp(v->name, "ignorepat")) {
pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
if (ast_context_add_ignorepat2(con, realvalue, registrar)) {
- ast_log(LOG_WARNING, "Unable to include ignorepat '%s' in context '%s' at line %d\n", v->value, cxt, v->lineno);
+ ast_log(LOG_WARNING,
+ "Unable to include ignorepat '%s' in context '%s' at line %d of %s\n",
+ v->value, cxt, v->lineno, vfile);
}
} else if (!strcasecmp(v->name, "switch") || !strcasecmp(v->name, "lswitch") || !strcasecmp(v->name, "eswitch")) {
char *stringp = realvalue;
@@ -1603,10 +1629,14 @@
appl = strsep(&stringp, "/");
data = S_OR(stringp, "");
if (ast_context_add_switch2(con, appl, data, !strcasecmp(v->name, "eswitch"), registrar)) {
- ast_log(LOG_WARNING, "Unable to include switch '%s' in context '%s' at line %d\n", v->value, cxt, v->lineno);
+ ast_log(LOG_WARNING,
+ "Unable to include switch '%s' in context '%s' at line %d of %s\n",
+ v->value, cxt, v->lineno, vfile);
}
} else {
- ast_log(LOG_WARNING, "==!!== Unknown directive: %s at line %d -- IGNORING!!!\n", v->name, v->lineno);
+ ast_log(LOG_WARNING,
+ "==!!== Unknown directive: %s at line %d of %s -- IGNORING!!!\n",
+ v->name, v->lineno, vfile);
}
}
}
More information about the asterisk-commits
mailing list