[Asterisk-code-review] func callerid: Remove deprecated CALLERPRES() function. (asterisk[master])

Sean Bright asteriskteam at digium.com
Thu Oct 18 14:33:08 CDT 2018


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/10510


Change subject: func_callerid: Remove deprecated CALLERPRES() function.
......................................................................

func_callerid: Remove deprecated CALLERPRES() function.

Change-Id: Ia1b2b386505b3102136dab02c45eaaf09f0f89c5
---
M UPGRADE.txt
M funcs/func_callerid.c
2 files changed, 6 insertions(+), 123 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/10/10510/1

diff --git a/UPGRADE.txt b/UPGRADE.txt
index b7bbf3b..cbaa87a 100644
--- a/UPGRADE.txt
+++ b/UPGRADE.txt
@@ -25,3 +25,7 @@
 === UPGRADE-16.txt  -- Upgrade info for 15 to 16
 ===========================================================
 
+From 16 to 17:
+
+* The CALLERPRES() dialplan function, deprecated in Asterisk 1.8, has been
+  removed.
diff --git a/funcs/func_callerid.c b/funcs/func_callerid.c
index 0b6ab51..80cca9a 100644
--- a/funcs/func_callerid.c
+++ b/funcs/func_callerid.c
@@ -152,48 +152,6 @@
 			</enumlist>
 		</description>
 	</function>
-	<function name="CALLERPRES" language="en_US">
-		<synopsis>
-			Gets or sets Caller*ID presentation on the channel.
-		</synopsis>
-		<syntax />
-		<description>
-			<para>Gets or sets Caller*ID presentation on the channel.
-			This function is deprecated in favor of CALLERID(num-pres)
-			and CALLERID(name-pres) or CALLERID(pres) to get/set both
-			at once.
-			The following values are valid:</para>
-			<enumlist>
-				<enum name="allowed_not_screened">
-					<para>Presentation Allowed, Not Screened.</para>
-				</enum>
-				<enum name="allowed_passed_screen">
-					<para>Presentation Allowed, Passed Screen.</para>
-				</enum>
-				<enum name="allowed_failed_screen">
-					<para>Presentation Allowed, Failed Screen.</para>
-				</enum>
-				<enum name="allowed">
-					<para>Presentation Allowed, Network Number.</para>
-				</enum>
-				<enum name="prohib_not_screened">
-					<para>Presentation Prohibited, Not Screened.</para>
-				</enum>
-				<enum name="prohib_passed_screen">
-					<para>Presentation Prohibited, Passed Screen.</para>
-				</enum>
-				<enum name="prohib_failed_screen">
-					<para>Presentation Prohibited, Failed Screen.</para>
-				</enum>
-				<enum name="prohib">
-					<para>Presentation Prohibited, Network Number.</para>
-				</enum>
-				<enum name="unavailable">
-					<para>Number Unavailable.</para>
-				</enum>
-			</enumlist>
-		</description>
-	</function>
 	<function name="CONNECTEDLINE" language="en_US">
 		<synopsis>
 			Gets or sets Connected Line data on the channel.
@@ -892,76 +850,6 @@
 	return status;
 }
 
-/*! TRUE if we have already notified about CALLERPRES being deprecated. */
-static int callerpres_deprecate_notify;
-
-/*!
- * \internal
- * \brief Read values from the caller-id presentation information struct.
- *
- * \param chan Asterisk channel to read
- * \param cmd Not used
- * \param data Caller-id presentation function datatype string
- * \param buf Buffer to fill with read value.
- * \param len Length of the buffer
- *
- * \retval 0 on success.
- * \retval -1 on error.
- */
-static int callerpres_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
-{
-	if (!chan) {
-		ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
-		return -1;
-	}
-
-	if (!callerpres_deprecate_notify) {
-		callerpres_deprecate_notify = 1;
-		ast_log(LOG_WARNING, "CALLERPRES is deprecated."
-			"  Use CALLERID(name-pres) or CALLERID(num-pres) instead.\n");
-	}
-	ast_copy_string(buf,
-		ast_named_caller_presentation(ast_party_id_presentation(&ast_channel_caller(chan)->id)), len);
-	return 0;
-}
-
-/*!
- * \internal
- * \brief Write new values to the caller-id presentation information struct.
- *
- * \param chan Asterisk channel to update
- * \param cmd Not used
- * \param data Caller-id presentation function datatype string
- * \param value Value to assign to the caller-id presentation information struct.
- *
- * \retval 0 on success.
- * \retval -1 on error.
- */
-static int callerpres_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
-{
-	int pres;
-
-	if (!chan) {
-		ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
-		return -1;
-	}
-
-	if (!callerpres_deprecate_notify) {
-		callerpres_deprecate_notify = 1;
-		ast_log(LOG_WARNING, "CALLERPRES is deprecated."
-			"  Use CALLERID(name-pres) or CALLERID(num-pres) instead.\n");
-	}
-
-	pres = ast_parse_caller_presentation(value);
-	if (pres < 0) {
-		ast_log(LOG_WARNING, "'%s' is not a valid presentation (see 'show function CALLERPRES')\n", value);
-	} else {
-		ast_channel_caller(chan)->id.name.presentation = pres;
-		ast_channel_caller(chan)->id.number.presentation = pres;
-	}
-	return 0;
-}
-
 /*!
  * \internal
  * \brief Read values from the caller-id information struct.
@@ -1825,13 +1713,6 @@
 	.write = callerid_write,
 };
 
-static struct ast_custom_function callerpres_function = {
-	.name = "CALLERPRES",
-	.read = callerpres_read,
-	.read_max = 50,
-	.write = callerpres_write,
-};
-
 static struct ast_custom_function connectedline_function = {
 	.name = "CONNECTEDLINE",
 	.read = connectedline_read,
@@ -1855,8 +1736,7 @@
 {
 	int res;
 
-	res = ast_custom_function_unregister(&callerpres_function);
-	res |= ast_custom_function_unregister(&callerid_function);
+	res = ast_custom_function_unregister(&callerid_function);
 	res |= ast_custom_function_unregister(&connectedline_function);
 	res |= ast_custom_function_unregister(&redirecting_function);
 	return res;
@@ -1873,8 +1753,7 @@
 {
 	int res;
 
-	res = ast_custom_function_register(&callerpres_function);
-	res |= ast_custom_function_register(&callerid_function);
+	res = ast_custom_function_register(&callerid_function);
 	res |= ast_custom_function_register(&connectedline_function);
 	res |= ast_custom_function_register(&redirecting_function);
 	return res ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;

-- 
To view, visit https://gerrit.asterisk.org/10510
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia1b2b386505b3102136dab02c45eaaf09f0f89c5
Gerrit-Change-Number: 10510
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181018/a1210045/attachment-0001.html>


More information about the asterisk-code-review mailing list