Advertisement
tacvbo

aelsub-stdexten.patch

Sep 3rd, 2012
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.90 KB | None | 0 0
  1. Index: configs/asterisk.conf.sample
  2. ===================================================================
  3. --- configs/asterisk.conf.sample    (revision 372132)
  4. +++ configs/asterisk.conf.sample    (working copy)
  5. @@ -78,10 +78,13 @@
  6.                 ; configuration files (/etc/asterisk) with a
  7.                 ; lock.
  8.  ;stdexten = gosub      ; How to invoke the extensions.conf stdexten.
  9. -               ; macro - Invoke the stdexten using a macro as
  10. -               ;         done by legacy Asterisk versions.
  11. -               ; gosub - Invoke the stdexten using a gosub as
  12. -               ;         documented in extensions.conf.sample.
  13. +               ; macro  - Invoke the stdexten using a macro as
  14. +               ;          done by legacy Asterisk versions.
  15. +               ; aelsub - Invoke the stdexten subroutine using AELSub
  16. +               ;          providing a sane entry point when stdexten is
  17. +               ;          defined in AEL.
  18. +               ; gosub  - Invoke the stdexten using a gosub as
  19. +               ;          documented in extensions.conf.sample.
  20.                 ; Default gosub.
  21.  
  22.  ; Changing the following lines may compromise your security.
  23. Index: include/asterisk/options.h
  24. ===================================================================
  25. --- include/asterisk/options.h  (revision 372132)
  26. +++ include/asterisk/options.h  (working copy)
  27. @@ -98,6 +98,8 @@
  28.     AST_OPT_FLAG_LOCK_CONFIG_DIR = (1 << 29),
  29.     /*! Generic PLC */
  30.     AST_OPT_FLAG_GENERIC_PLC = (1 << 30),
  31. +   /*! Invoke the stdexten using AELSub method. */
  32. +   AST_OPT_FLAG_STDEXTEN_AEL = (1 << 31),
  33.  };
  34.  
  35.  /*! These are the options that set by default when Asterisk starts */
  36. @@ -120,6 +122,8 @@
  37.  #define ast_opt_transcode_via_slin ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSCODE_VIA_SLIN)
  38.  /*! Invoke the stdexten using the legacy macro method. */
  39.  #define ast_opt_stdexten_macro     ast_test_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO)
  40. +/*! Invoke the stdexten using AELSub method. */
  41. +#define ast_opt_stdexten_ael       ast_test_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_AEL)
  42.  #define ast_opt_dump_core      ast_test_flag(&ast_options, AST_OPT_FLAG_DUMP_CORE)
  43.  #define ast_opt_cache_record_files ast_test_flag(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES)
  44.  #define ast_opt_timestamp      ast_test_flag(&ast_options, AST_OPT_FLAG_TIMESTAMP)
  45. Index: main/asterisk.c
  46. ===================================================================
  47. --- main/asterisk.c (revision 372132)
  48. +++ main/asterisk.c (working copy)
  49. @@ -3302,6 +3302,9 @@
  50.                 ast_clear_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO);
  51.             } else if (!strcasecmp(v->value, "macro")) {
  52.                 ast_set_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO);
  53. +           } else if (!strcasecmp(v->value, "aelsub")) {
  54. +               ast_clear_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO);
  55. +               ast_set_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_AEL);
  56.             } else {
  57.                 ast_log(LOG_WARNING,
  58.                     "'%s' is not a valid setting for the stdexten option, defaulting to 'gosub'\n",
  59. Index: pbx/pbx_config.c
  60. ===================================================================
  61. --- pbx/pbx_config.c    (revision 372132)
  62. +++ pbx/pbx_config.c    (working copy)
  63. @@ -1814,8 +1814,14 @@
  64.                     snprintf(tmp, sizeof(tmp), "stdexten,%s,${HINT}", cat);
  65.                     ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Macro", ast_strdup(tmp), ast_free_ptr, registrar);
  66.                 } else {
  67. -                   snprintf(tmp, sizeof(tmp), "%s,stdexten(${HINT})", cat);
  68. -                   ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Gosub", ast_strdup(tmp), ast_free_ptr, registrar);
  69. +                   if (ast_opt_stdexten_ael) {
  70. +                   /* Use AELSub method. */
  71. +                       snprintf(tmp, sizeof(tmp), "stdexten,%s,${HINT}", cat);
  72. +                       ast_add_extension2(con, 0, cat, 1, NULL, NULL, "AELSub", ast_strdup(tmp), ast_free_ptr, registrar);
  73. +                   } else {
  74. +                       snprintf(tmp, sizeof(tmp), "%s,stdexten(${HINT})", cat);
  75. +                       ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Gosub", ast_strdup(tmp), ast_free_ptr, registrar);
  76. +                   }
  77.                 }
  78.             } else {
  79.                 ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Dial", ast_strdup("${HINT}"), ast_free_ptr, registrar);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement