From d6b359ff0b333fdb0b1485ca5744078fe9bec733 Mon Sep 17 00:00:00 2001
From: Richard Mudgett <rmudgett@digium.com>
Date: Thu, 5 Jan 2012 23:06:17 +0000
Subject: [PATCH] Make pbx_config.c use Gosub instead of Macro call for
 stdexten.

Users created by users.conf with hasvoicemail=yes have been documented as
using a Gosub to stdexten since v1.6.0.  However, the code still generates
dialplan to access stdexten as a Macro as documented in v1.4; which does
not work with the newer extensions.conf.sample file.

* Make generated dialplan access the stdexten dialplan with the documented
Gosub instead of the older Macro style.

(closes issue ASTERISK-18809)
Reported by: Jay Allen
Patches:
      gosub_patch-pbx_config.patch (license #6323) patch uploaded by Jay Allen (modified)
Tested by: rmudgett


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349782 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 UPGRADE.txt      | 5 +++++
 pbx/pbx_config.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/UPGRADE.txt b/UPGRADE.txt
index 90aa4a3c70..a876d07731 100644
--- a/UPGRADE.txt
+++ b/UPGRADE.txt
@@ -49,6 +49,11 @@ SIP
  - A new option "tonezone" for setting default tonezone for the channel driver
    or individual devices
 
+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.
+
 From 1.8 to 10:
 
 cel_pgsql:
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index 91cfe04e95..15b3cc80c4 100644
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -1743,8 +1743,8 @@ 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), "stdexten,%s,${HINT}", cat);
-				ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Macro", strdup(tmp), ast_free_ptr, registrar);
+				snprintf(tmp, sizeof(tmp), "%s,stdexten(${HINT})", cat);
+				ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Gosub", strdup(tmp), ast_free_ptr, registrar);
 			} else {
 				ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Dial", strdup("${HINT}"), ast_free_ptr, registrar);
 			}
-- 
GitLab