[Asterisk-code-review] app macro deprecation. (asterisk[master])

Joshua Colp asteriskteam at digium.com
Wed Oct 18 19:22:13 CDT 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/6817 )

Change subject: app_macro deprecation.
......................................................................

app_macro deprecation.

* Mark the module deprecated.
* Disable the module by default.
* Produce a warning the first time a macro is used.
* Note deprecation related options in app_dial and app_queue.

ASTERISK-27350

Change-Id: I560ea043bacdbc5534a17d97854273d52c2f1bdc
---
M CHANGES
M UPGRADE.txt
M apps/app_dial.c
M apps/app_macro.c
M apps/app_queue.c
5 files changed, 28 insertions(+), 2 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
  Kevin Harwell: Looks good to me, approved



diff --git a/CHANGES b/CHANGES
index 63c8c6f..68617a4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -12,6 +12,12 @@
 --- Functionality changes from Asterisk 15 to Asterisk 16 --------------------
 ------------------------------------------------------------------------------
 
+app_macro
+------------------
+ * The app_macro module is now deprecated and by default it is no longer
+   built.  Users should migrate to app_stack (Gosub).  A warning is logged
+   the first time any Macro is used.
+
 chan_sip
 ------------------
  * New function SIP_HEADERS() enumerates all headers in the incoming INVITE.
diff --git a/UPGRADE.txt b/UPGRADE.txt
index 1fe82c0..39c0f8c 100644
--- a/UPGRADE.txt
+++ b/UPGRADE.txt
@@ -26,6 +26,11 @@
 
 New in 16.0.0:
 
+app_macro:
+ - The app_macro module is now deprecated and by default it is no longer
+   built.  Users should migrate to app_stack (Gosub).  A warning is logged
+   the first time any Macro is used.
+
 New in 15.0.0:
 
 Build System:
diff --git a/apps/app_dial.c b/apps/app_dial.c
index 847a095..8c51f3f 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -324,6 +324,10 @@
 					<warning><para>Be aware of the limitations that macros have, specifically with regards to use of
 					the <literal>WaitExten</literal> application. For more information, see the documentation for
 					<literal>Macro()</literal>.</para></warning>
+					<note>
+						<para>Macros are deprecated, GoSub should be used instead,
+						see the <literal>U</literal> option.</para>
+					</note>
 				</option>
 				<option name="n">
 					<argument name="delete">
diff --git a/apps/app_macro.c b/apps/app_macro.c
index 4ef5252..c6f051e 100644
--- a/apps/app_macro.c
+++ b/apps/app_macro.c
@@ -26,7 +26,8 @@
  */
 
 /*** MODULEINFO
-	<support_level>core</support_level>
+	<defaultenabled>no</defaultenabled>
+	<support_level>deprecated</support_level>
 	<replacement>app_stack (GoSub)</replacement>
  ***/
 
@@ -250,10 +251,17 @@
 	char *save_macro_offset;
 	int save_in_subroutine;
 	struct ast_datastore *macro_store = ast_channel_datastore_find(chan, &macro_ds_info, NULL);
+	static int deprecation_notice = 0;
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "Macro() requires arguments. See \"core show application macro\" for help.\n");
 		return -1;
+	}
+
+	if (!deprecation_notice) {
+		deprecation_notice = 1;
+		ast_log(LOG_WARNING, "Macro() is deprecated and will be removed from a future version of Asterisk.\n");
+		ast_log(LOG_WARNING, "Dialplan should be updated to use Gosub instead.\n");
 	}
 
 	do {
@@ -665,4 +673,4 @@
 	return res;
 }
 
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Extension Macros");
+AST_MODULE_INFO_STANDARD_DEPRECATED(ASTERISK_GPL_KEY, "Extension Macros");
diff --git a/apps/app_queue.c b/apps/app_queue.c
index e3a4e22..801695f 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -235,6 +235,9 @@
 			</parameter>
 			<parameter name="macro">
 				<para>Will run a macro on the called party's channel (the queue member) once the parties are connected.</para>
+				<note>
+					<para>Macros are deprecated, GoSub should be used instead.</para>
+				</note>
 			</parameter>
 			<parameter name="gosub">
 				<para>Will run a gosub on the called party's channel (the queue member) once the parties are connected.</para>

-- 
To view, visit https://gerrit.asterisk.org/6817
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I560ea043bacdbc5534a17d97854273d52c2f1bdc
Gerrit-Change-Number: 6817
Gerrit-PatchSet: 2
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171018/ebf6b4eb/attachment-0001.html>


More information about the asterisk-code-review mailing list