Index: configs/asterisk.conf.sample =================================================================== --- configs/asterisk.conf.sample (revision 372132) +++ configs/asterisk.conf.sample (working copy) @@ -78,10 +78,13 @@ ; 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. + ; macro - Invoke the stdexten using a macro as + ; done by legacy Asterisk versions. + ; aelsub - Invoke the stdexten subroutine using AELSub + ; providing a sane entry point when stdexten is + ; defined in AEL. + ; gosub - Invoke the stdexten using a gosub as + ; documented in extensions.conf.sample. ; Default gosub. ; Changing the following lines may compromise your security. Index: include/asterisk/options.h =================================================================== --- include/asterisk/options.h (revision 372132) +++ include/asterisk/options.h (working copy) @@ -98,6 +98,8 @@ AST_OPT_FLAG_LOCK_CONFIG_DIR = (1 << 29), /*! Generic PLC */ AST_OPT_FLAG_GENERIC_PLC = (1 << 30), + /*! Invoke the stdexten using AELSub method. */ + AST_OPT_FLAG_STDEXTEN_AEL = (1 << 31), }; /*! These are the options that set by default when Asterisk starts */ @@ -120,6 +122,8 @@ #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) +/*! Invoke the stdexten using AELSub method. */ +#define ast_opt_stdexten_ael ast_test_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_AEL) #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) Index: main/asterisk.c =================================================================== --- main/asterisk.c (revision 372132) +++ main/asterisk.c (working copy) @@ -3302,6 +3302,9 @@ 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 if (!strcasecmp(v->value, "aelsub")) { + ast_clear_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO); + ast_set_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_AEL); } else { ast_log(LOG_WARNING, "'%s' is not a valid setting for the stdexten option, defaulting to 'gosub'\n", Index: pbx/pbx_config.c =================================================================== --- pbx/pbx_config.c (revision 372132) +++ pbx/pbx_config.c (working copy) @@ -1814,8 +1814,14 @@ 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); + if (ast_opt_stdexten_ael) { + /* Use AELSub method. */ + snprintf(tmp, sizeof(tmp), "stdexten,%s,${HINT}", cat); + ast_add_extension2(con, 0, cat, 1, NULL, NULL, "AELSub", 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);