summaryrefslogtreecommitdiffstats
path: root/main/asterisk/900-tryinclude.patch
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-01-16 09:53:22 +0200
committerTimo Teräs <timo.teras@iki.fi>2012-01-16 09:53:22 +0200
commit9e10a7e929717793efe85444b56da6af63cf40db (patch)
treed77b70b82260f90ff1f20cdf2f9e763304f95de2 /main/asterisk/900-tryinclude.patch
parent381434cdf487d9bbab0940fd5b8dc78c37aaf473 (diff)
downloadaports-9e10a7e929717793efe85444b56da6af63cf40db.tar.bz2
aports-9e10a7e929717793efe85444b56da6af63cf40db.tar.xz
main/asterisk: cherry-pick #tryinclude from Asterisk 11
Instead of using the obsolete #-include patch from Asterisk JIRA.
Diffstat (limited to 'main/asterisk/900-tryinclude.patch')
-rw-r--r--main/asterisk/900-tryinclude.patch71
1 files changed, 71 insertions, 0 deletions
diff --git a/main/asterisk/900-tryinclude.patch b/main/asterisk/900-tryinclude.patch
new file mode 100644
index 000000000..8bcfc24f2
--- /dev/null
+++ b/main/asterisk/900-tryinclude.patch
@@ -0,0 +1,71 @@
+------------------------------------------------------------------------
+r345735 | pabelanger | 2011-11-21 18:40:17 +0200 (Mon, 21 Nov 2011) | 7 lines
+
+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/
+
+
+diff --git a/CHANGES b/CHANGES
+index 4d106f6..bfc7301 100644
+--- a/CHANGES
++++ b/CHANGES
+@@ -389,6 +389,12 @@ SIP Changes
+ * 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
+ -----------
+diff --git a/main/config.c b/main/config.c
+index 498ae99..e76a43f 100644
+--- a/main/config.c
++++ b/main/config.c
+@@ -1202,6 +1202,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
+ 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 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
+ }
+ 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 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
+ }
+
+ 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 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
+ 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;
+ }
+------------------------------------------------------------------------