[asterisk-commits] pabelanger: trunk r345735 - in /trunk: CHANGES main/config.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Nov 21 10:40:21 CST 2011
Author: pabelanger
Date: Mon Nov 21 10:40:17 2011
New Revision: 345735
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=345735
Log:
Add #tryinclude statement
This provides the same functionality as #include however an asterisk module will
still load if the filename does not exist.
Review: https://reviewboard.asterisk.org/r/1476/
Modified:
trunk/CHANGES
trunk/main/config.c
Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=345735&r1=345734&r2=345735
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Mon Nov 21 10:40:17 2011
@@ -389,6 +389,12 @@
* Addition of the 'auth_options_requests' option for turning on and off
authentication for OPTIONS requests in chan_sip.
+Configuration files
+-------------------
+ * Add #tryinclude statement for config files. This provides the same
+ functionality as the #include statement however an asterisk module will
+ still load if the filename does not exist. Using the #include statement
+ Asterisk will not allow the module to load.
IAX2 Changes
-----------
Modified: trunk/main/config.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/config.c?view=diff&rev=345735&r1=345734&r2=345735
==============================================================================
--- trunk/main/config.c (original)
+++ trunk/main/config.c Mon Nov 21 10:40:17 2011
@@ -1202,6 +1202,7 @@
char *cur2;
char real_inclusion_name[256];
int do_include = 0; /* otherwise, it is exec */
+ int try_include = 0;
cur++;
c = cur;
@@ -1221,6 +1222,9 @@
}
if (!strcasecmp(cur, "include")) {
do_include = 1;
+ } else if (!strcasecmp(cur, "tryinclude")) {
+ do_include = 1;
+ try_include = 1;
} else if (!strcasecmp(cur, "exec")) {
if (!ast_opt_exec_includes) {
ast_log(LOG_WARNING, "Cannot perform #exec unless execincludes option is enabled in asterisk.conf (options section)!\n");
@@ -1232,8 +1236,8 @@
}
if (c == NULL) {
- ast_log(LOG_WARNING, "Directive '#%s' needs an argument (%s) at line %d of %s\n",
- do_include ? "include" : "exec",
+ ast_log(LOG_WARNING, "Directive '#%s' needs an argument (%s) at line %d of %s\n",
+ do_include ? "include / tryinclude" : "exec",
do_include ? "filename" : "/path/to/executable",
lineno,
configfile);
@@ -1278,7 +1282,7 @@
do_include = ast_config_internal_load(cur, cfg, flags, real_inclusion_name, who_asked) ? 1 : 0;
if (!ast_strlen_zero(exec_file))
unlink(exec_file);
- if (!do_include) {
+ if (!do_include && !try_include) {
ast_log(LOG_ERROR, "The file '%s' was listed as a #include but it does not exist.\n", cur);
return -1;
}
More information about the asterisk-commits
mailing list