[asterisk-commits] rmudgett: trunk r361998 - in /trunk: ./ configs/ include/asterisk/ main/ pbx/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 12 11:29:58 CDT 2012


Author: rmudgett
Date: Thu Apr 12 11:29:52 2012
New Revision: 361998

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=361998
Log:
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/

Modified:
    trunk/UPGRADE.txt
    trunk/configs/asterisk.conf.sample
    trunk/include/asterisk/options.h
    trunk/main/asterisk.c
    trunk/pbx/pbx_config.c

Modified: trunk/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/trunk/UPGRADE.txt?view=diff&rev=361998&r1=361997&r2=361998
==============================================================================
--- trunk/UPGRADE.txt (original)
+++ trunk/UPGRADE.txt Thu Apr 12 11:29:52 2012
@@ -92,7 +92,8 @@
 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:
 

Modified: trunk/configs/asterisk.conf.sample
URL: http://svnview.digium.com/svn/asterisk/trunk/configs/asterisk.conf.sample?view=diff&rev=361998&r1=361997&r2=361998
==============================================================================
--- trunk/configs/asterisk.conf.sample (original)
+++ trunk/configs/asterisk.conf.sample Thu Apr 12 11:29:52 2012
@@ -74,6 +74,12 @@
 ;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]

Modified: trunk/include/asterisk/options.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/options.h?view=diff&rev=361998&r1=361997&r2=361998
==============================================================================
--- trunk/include/asterisk/options.h (original)
+++ trunk/include/asterisk/options.h Thu Apr 12 11:29:52 2012
@@ -58,6 +58,8 @@
 	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 @@
 #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)

Modified: trunk/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/asterisk.c?view=diff&rev=361998&r1=361997&r2=361998
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Thu Apr 12 11:29:52 2012
@@ -3230,6 +3230,18 @@
 			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) {

Modified: trunk/pbx/pbx_config.c
URL: http://svnview.digium.com/svn/asterisk/trunk/pbx/pbx_config.c?view=diff&rev=361998&r1=361997&r2=361998
==============================================================================
--- trunk/pbx/pbx_config.c (original)
+++ trunk/pbx/pbx_config.c Thu Apr 12 11:29:52 2012
@@ -1753,8 +1753,14 @@
 			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);
 			}




More information about the asterisk-commits mailing list