summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2012-04-12 16:29:52 +0000
committerRichard Mudgett <rmudgett@digium.com>2012-04-12 16:29:52 +0000
commita35c7ba8e7e5e05efb2ca3f57d31b4501bfdb75b (patch)
treea814ff52f8918c92f4e1d4b384c0b0d79f33dec3
parentf9155c9c3d50b47b6c6b7619f1788d2e790803ca (diff)
Add option to invoke the extensions.conf stdexten using the legacy macro method.
ASTERISK-18809 eliminated the legacy macro invocation of the stdexten in favor of the Gosub method without a means of backwards compatibility. (issue ASTERISK-18809) (closes issue ASTERISK-19457) Reported by: Matt Jordan Tested by: rmudgett Review: https://reviewboard.asterisk.org/r/1855/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@361998 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--UPGRADE.txt3
-rw-r--r--configs/asterisk.conf.sample6
-rw-r--r--include/asterisk/options.h4
-rw-r--r--main/asterisk.c12
-rw-r--r--pbx/pbx_config.c10
5 files changed, 32 insertions, 3 deletions
diff --git a/UPGRADE.txt b/UPGRADE.txt
index a654865fa..289043896 100644
--- a/UPGRADE.txt
+++ b/UPGRADE.txt
@@ -92,7 +92,8 @@ chan_unistim
users.conf:
- A defined user with hasvoicemail=yes now finally uses a Gosub to stdexten
as documented in extensions.conf.sample since v1.6.0 instead of a Macro as
- documented in v1.4.
+ documented in v1.4. Set the asterisk.conf stdexten=macro parameter to
+ invoke the stdexten the old way.
From 1.8 to 10:
diff --git a/configs/asterisk.conf.sample b/configs/asterisk.conf.sample
index cc9933044..44f3c1dea 100644
--- a/configs/asterisk.conf.sample
+++ b/configs/asterisk.conf.sample
@@ -74,6 +74,12 @@ documentation_language = en_US ; Set the language you want documentation
;lockconfdir = no ; Protect the directory containing the
; configuration files (/etc/asterisk) with a
; lock.
+;stdexten = gosub ; How to invoke the extensions.conf stdexten.
+ ; macro - Invoke the stdexten using a macro as
+ ; done by legacy Asterisk versions.
+ ; gosub - Invoke the stdexten using a gosub as
+ ; documented in extensions.conf.sample.
+ ; Default gosub.
; Changing the following lines may compromise your security.
;[files]
diff --git a/include/asterisk/options.h b/include/asterisk/options.h
index 2509f4642..c411b3aad 100644
--- a/include/asterisk/options.h
+++ b/include/asterisk/options.h
@@ -58,6 +58,8 @@ enum ast_option_flags {
AST_OPT_FLAG_FULLY_BOOTED = (1 << 9),
/*! Trascode via signed linear */
AST_OPT_FLAG_TRANSCODE_VIA_SLIN = (1 << 10),
+ /*! Invoke the stdexten using the legacy macro method. */
+ AST_OPT_FLAG_STDEXTEN_MACRO = (1 << 11),
/*! Dump core on a seg fault */
AST_OPT_FLAG_DUMP_CORE = (1 << 12),
/*! Cache sound files */
@@ -116,6 +118,8 @@ enum ast_option_flags {
#define ast_opt_no_color ast_test_flag(&ast_options, AST_OPT_FLAG_NO_COLOR)
#define ast_fully_booted ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)
#define ast_opt_transcode_via_slin ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSCODE_VIA_SLIN)
+/*! Invoke the stdexten using the legacy macro method. */
+#define ast_opt_stdexten_macro ast_test_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO)
#define ast_opt_dump_core ast_test_flag(&ast_options, AST_OPT_FLAG_DUMP_CORE)
#define ast_opt_cache_record_files ast_test_flag(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES)
#define ast_opt_timestamp ast_test_flag(&ast_options, AST_OPT_FLAG_TIMESTAMP)
diff --git a/main/asterisk.c b/main/asterisk.c
index 19982b6e2..5f6449c92 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -3230,6 +3230,18 @@ static void ast_readconfig(void)
ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIDE_CONSOLE_CONNECT);
} else if (!strcasecmp(v->name, "lockconfdir")) {
ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_LOCK_CONFIG_DIR);
+ } else if (!strcasecmp(v->name, "stdexten")) {
+ /* Choose how to invoke the extensions.conf stdexten */
+ if (!strcasecmp(v->value, "gosub")) {
+ ast_clear_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO);
+ } else if (!strcasecmp(v->value, "macro")) {
+ ast_set_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO);
+ } else {
+ ast_log(LOG_WARNING,
+ "'%s' is not a valid setting for the stdexten option, defaulting to 'gosub'\n",
+ v->value);
+ ast_clear_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO);
+ }
}
}
for (v = ast_variable_browse(cfg, "compat"); v; v = v->next) {
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index 86b132279..22ea1d710 100644
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -1753,8 +1753,14 @@ static void pbx_load_users(void)
ast_add_extension2(con, 0, cat, -1, NULL, NULL, iface, NULL, NULL, registrar);
/* If voicemail, use "stdexten" else use plain old dial */
if (hasvoicemail) {
- snprintf(tmp, sizeof(tmp), "%s,stdexten(${HINT})", cat);
- ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Gosub", ast_strdup(tmp), ast_free_ptr, registrar);
+ if (ast_opt_stdexten_macro) {
+ /* Use legacy stdexten macro method. */
+ snprintf(tmp, sizeof(tmp), "stdexten,%s,${HINT}", cat);
+ ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Macro", ast_strdup(tmp), ast_free_ptr, registrar);
+ } else {
+ snprintf(tmp, sizeof(tmp), "%s,stdexten(${HINT})", cat);
+ ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Gosub", ast_strdup(tmp), ast_free_ptr, registrar);
+ }
} else {
ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Dial", ast_strdup("${HINT}"), ast_free_ptr, registrar);
}