From 056ca07449db2a510b63dfba59f8601e8c8ed80f Mon Sep 17 00:00:00 2001 From: Sean Bright Date: Thu, 18 Oct 2018 15:24:19 -0400 Subject: [PATCH] func_callerid: Remove deprecated CALLERPRES() function. Change-Id: Ia1b2b386505b3102136dab02c45eaaf09f0f89c5 --- UPGRADE.txt | 5 +- funcs/func_callerid.c | 147 ++++++++++++++---------------------------- 2 files changed, 51 insertions(+), 101 deletions(-) diff --git a/UPGRADE.txt b/UPGRADE.txt index 7e17b1057b..a7bf14ccfb 100644 --- a/UPGRADE.txt +++ b/UPGRADE.txt @@ -25,6 +25,9 @@ === UPGRADE-16.txt -- Upgrade info for 15 to 16 =========================================================== -From 16 to 17: +New in 17.0.0: + +* The CALLERPRES() dialplan function, deprecated in Asterisk 1.8, has been + removed. * The JabberStatus application, deprecated in Asterisk 12, has been removed. diff --git a/funcs/func_callerid.c b/funcs/func_callerid.c index 0b6ab517c7..033366af87 100644 --- a/funcs/func_callerid.c +++ b/funcs/func_callerid.c @@ -150,19 +150,9 @@ ISO10646 Bmp String ISO10646 UTF-8 String - - - - - Gets or sets Caller*ID presentation on the channel. - - - - 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: + The allowable values for the num-pres, + name-pres, and pres + fields are the following: Presentation Allowed, Not Screened. @@ -257,6 +247,38 @@ ISO10646 Bmp String ISO10646 UTF-8 String + The allowable values for the num-pres, + name-pres, and pres + fields are the following: + + + Presentation Allowed, Not Screened. + + + Presentation Allowed, Passed Screen. + + + Presentation Allowed, Failed Screen. + + + Presentation Allowed, Network Number. + + + Presentation Prohibited, Not Screened. + + + Presentation Prohibited, Passed Screen. + + + Presentation Prohibited, Failed Screen. + + + Presentation Prohibited, Network Number. + + + Number Unavailable. + + @@ -892,76 +914,6 @@ static enum ID_FIELD_STATUS party_id_write(struct ast_party_id *id, int argc, ch 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 +1777,6 @@ static struct ast_custom_function callerid_function = { .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, @@ -1853,13 +1798,10 @@ static struct ast_custom_function redirecting_function = { */ static int unload_module(void) { - int res; - - res = ast_custom_function_unregister(&callerpres_function); - res |= ast_custom_function_unregister(&callerid_function); - res |= ast_custom_function_unregister(&connectedline_function); - res |= ast_custom_function_unregister(&redirecting_function); - return res; + ast_custom_function_unregister(&callerid_function); + ast_custom_function_unregister(&connectedline_function); + ast_custom_function_unregister(&redirecting_function); + return 0; } /*! @@ -1873,11 +1815,16 @@ static int load_module(void) { 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; + + if (res) { + unload_module(); + return AST_MODULE_LOAD_DECLINE; + } + + return AST_MODULE_LOAD_SUCCESS; } /* Do not wrap the following line. */