From fc88db013e7423badd3eae9fa58b45c705840c5e Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Thu, 21 Sep 2006 19:35:29 +0000 Subject: [PATCH] Remove deprecated apps and funcs git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43439 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_hasnewvoicemail.c | 220 ------------------------------------- apps/app_lookupblacklist.c | 158 --------------------------- apps/app_lookupcidname.c | 101 ----------------- apps/app_queue.c | 12 -- apps/app_random.c | 108 ------------------ apps/app_realtime.c | 261 -------------------------------------------- funcs/func_blacklist.c | 88 +++++++++++++++ funcs/func_language.c | 90 --------------- funcs/func_md5.c | 50 +-------- funcs/func_moh.c | 86 --------------- funcs/func_vmcount.c | 104 ++++++++++++++++++ res/res_realtime.c | 127 +++++++++++++++++++++ 12 files changed, 321 insertions(+), 1084 deletions(-) delete mode 100644 apps/app_hasnewvoicemail.c delete mode 100644 apps/app_lookupblacklist.c delete mode 100644 apps/app_lookupcidname.c delete mode 100644 apps/app_random.c delete mode 100644 apps/app_realtime.c create mode 100644 funcs/func_blacklist.c delete mode 100644 funcs/func_language.c delete mode 100644 funcs/func_moh.c create mode 100644 funcs/func_vmcount.c create mode 100644 res/res_realtime.c diff --git a/apps/app_hasnewvoicemail.c b/apps/app_hasnewvoicemail.c deleted file mode 100644 index 33204bb..0000000 --- a/apps/app_hasnewvoicemail.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Asterisk -- An open source telephony toolkit. - * - * Changes Copyright (c) 2004 - 2006 Todd Freeman - * - * 95% based on HasNewVoicemail by: - * - * Copyright (c) 2003 Tilghman Lesher. All rights reserved. - * - * Tilghman Lesher - * - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2. See the LICENSE file - * at the top of the source tree. - */ - -/*! \file - * - * \brief HasVoicemail application - * - * \author Todd Freeman - * - * \note 95% based on HasNewVoicemail by - * Tilghman Lesher - * - * \ingroup applications - */ - -#include "asterisk.h" - -ASTERISK_FILE_VERSION(__FILE__, "$Revision$") - -#include -#include -#include -#include -#include -#include - -#include "asterisk/file.h" -#include "asterisk/logger.h" -#include "asterisk/channel.h" -#include "asterisk/pbx.h" -#include "asterisk/module.h" -#include "asterisk/lock.h" -#include "asterisk/utils.h" -#include "asterisk/app.h" -#include "asterisk/options.h" - -static char *app_hasvoicemail = "HasVoicemail"; -static char *hasvoicemail_synopsis = "Conditionally branches to priority + 101 with the right options set"; -static char *hasvoicemail_descrip = -"HasVoicemail(vmbox[/folder][@context][|varname[|options]])\n" -" Optionally sets to the number of messages in that folder." -" Assumes folder of INBOX if not specified.\n" -" The option string may contain zero or the following character:\n" -" 'j' -- jump to priority n+101, if there is voicemail in the folder indicated.\n" -" This application sets the following channel variable upon completion:\n" -" HASVMSTATUS The result of the voicemail check returned as a text string as follows\n" -" <# of messages in the folder, 0 for NONE>\n"; - -static char *app_hasnewvoicemail = "HasNewVoicemail"; -static char *hasnewvoicemail_synopsis = "Conditionally branches to priority + 101 with the right options set"; -static char *hasnewvoicemail_descrip = -"HasNewVoicemail(vmbox[/folder][@context][|varname[|options]])\n" -"Assumes folder 'INBOX' if folder is not specified. Optionally sets to the number of messages\n" -"in that folder.\n" -" The option string may contain zero of the following character:\n" -" 'j' -- jump to priority n+101, if there is new voicemail in folder 'folder' or INBOX\n" -" This application sets the following channel variable upon completion:\n" -" HASVMSTATUS The result of the new voicemail check returned as a text string as follows\n" -" <# of messages in the folder, 0 for NONE>\n"; - - -static int hasvoicemail_exec(struct ast_channel *chan, void *data) -{ - struct ast_module_user *u; - char *input, *varname = NULL, *vmbox, *context = "default"; - char *vmfolder; - int vmcount = 0; - static int dep_warning = 0; - int priority_jump = 0; - char tmp[12]; - AST_DECLARE_APP_ARGS(args, - AST_APP_ARG(vmbox); - AST_APP_ARG(varname); - AST_APP_ARG(options); - ); - - if (!dep_warning) { - ast_log(LOG_WARNING, "The applications HasVoicemail and HasNewVoicemail have been deprecated. Please use the VMCOUNT() function instead.\n"); - dep_warning = 1; - } - - if (!data) { - ast_log(LOG_WARNING, "HasVoicemail requires an argument (vm-box[/folder][@context][|varname[|options]])\n"); - return -1; - } - - u = ast_module_user_add(chan); - - input = ast_strdupa(data); - - AST_STANDARD_APP_ARGS(args, input); - - vmbox = strsep(&args.vmbox, "@"); - - if (!ast_strlen_zero(args.vmbox)) - context = args.vmbox; - - vmfolder = strchr(vmbox, '/'); - if (vmfolder) { - *vmfolder = '\0'; - vmfolder++; - } else { - vmfolder = "INBOX"; - } - - if (args.options) { - if (strchr(args.options, 'j')) - priority_jump = 1; - } - - vmcount = ast_app_messagecount(context, vmbox, vmfolder); - /* Set the count in the channel variable */ - if (varname) { - snprintf(tmp, sizeof(tmp), "%d", vmcount); - pbx_builtin_setvar_helper(chan, varname, tmp); - } - - if (vmcount > 0) { - /* Branch to the next extension */ - if (priority_jump || ast_opt_priority_jumping) { - if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) - ast_log(LOG_WARNING, "VM box %s@%s has new voicemail, but extension %s, priority %d doesn't exist\n", vmbox, context, chan->exten, chan->priority + 101); - } - } - - snprintf(tmp, sizeof(tmp), "%d", vmcount); - pbx_builtin_setvar_helper(chan, "HASVMSTATUS", tmp); - - ast_module_user_remove(u); - - return 0; -} - -static int acf_vmcount_exec(struct ast_channel *chan, char *cmd, char *argsstr, char *buf, size_t len) -{ - struct ast_module_user *u; - char *context; - AST_DECLARE_APP_ARGS(args, - AST_APP_ARG(vmbox); - AST_APP_ARG(folder); - ); - - u = ast_module_user_add(chan); - - buf[0] = '\0'; - - AST_STANDARD_APP_ARGS(args, argsstr); - - if (strchr(args.vmbox, '@')) { - context = args.vmbox; - args.vmbox = strsep(&context, "@"); - } else { - context = "default"; - } - - if (ast_strlen_zero(args.folder)) { - args.folder = "INBOX"; - } - - snprintf(buf, len, "%d", ast_app_messagecount(context, args.vmbox, args.folder)); - - ast_module_user_remove(u); - - return 0; -} - -struct ast_custom_function acf_vmcount = { - .name = "VMCOUNT", - .synopsis = "Counts the voicemail in a specified mailbox", - .syntax = "VMCOUNT(vmbox[@context][|folder])", - .desc = - " context - defaults to \"default\"\n" - " folder - defaults to \"INBOX\"\n", - .read = acf_vmcount_exec, -}; - -static int unload_module(void) -{ - int res; - - res = ast_custom_function_unregister(&acf_vmcount); - res |= ast_unregister_application(app_hasvoicemail); - res |= ast_unregister_application(app_hasnewvoicemail); - - ast_module_user_hangup_all(); - - return res; -} - -static int load_module(void) -{ - int res; - - res = ast_custom_function_register(&acf_vmcount); - res |= ast_register_application(app_hasvoicemail, hasvoicemail_exec, hasvoicemail_synopsis, hasvoicemail_descrip); - res |= ast_register_application(app_hasnewvoicemail, hasvoicemail_exec, hasnewvoicemail_synopsis, hasnewvoicemail_descrip); - - return res; -} - -AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Indicator for whether a voice mailbox has messages in a given folder."); diff --git a/apps/app_lookupblacklist.c b/apps/app_lookupblacklist.c deleted file mode 100644 index 2eb1e54..0000000 --- a/apps/app_lookupblacklist.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Asterisk -- An open source telephony toolkit. - * - * Copyright (C) 1999 - 2005, Digium, Inc. - * - * Mark Spencer - * - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2. See the LICENSE file - * at the top of the source tree. - */ - -/*! \file - * - * \brief App to lookup the callerid number, and see if it is blacklisted - * - * \author Mark Spencer - * - * \ingroup applications - * - */ - -#include "asterisk.h" - -ASTERISK_FILE_VERSION(__FILE__, "$Revision$") - -#include -#include -#include - -#include "asterisk/lock.h" -#include "asterisk/file.h" -#include "asterisk/logger.h" -#include "asterisk/options.h" -#include "asterisk/channel.h" -#include "asterisk/pbx.h" -#include "asterisk/module.h" -#include "asterisk/translate.h" -#include "asterisk/image.h" -#include "asterisk/callerid.h" -#include "asterisk/astdb.h" -#include "asterisk/options.h" - -static char *app = "LookupBlacklist"; - -static char *synopsis = "Look up Caller*ID name/number from blacklist database"; - -static char *descrip = - " LookupBlacklist(options): Looks up the Caller*ID number on the active\n" - "channel in the Asterisk database (family 'blacklist'). \n" - "The option string may contain the following character:\n" - " 'j' -- jump to n+101 priority if the number/name is found in the blacklist\n" - "This application sets the following channel variable upon completion:\n" - " LOOKUPBLSTATUS The status of the Blacklist lookup as a text string, one of\n" - " FOUND | NOTFOUND\n" - "Example: exten => 1234,1,LookupBlacklist()\n"; - - -static int blacklist_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) -{ - char blacklist[1]; - int bl = 0; - - if (chan->cid.cid_num) { - if (!ast_db_get("blacklist", chan->cid.cid_num, blacklist, sizeof (blacklist))) - bl = 1; - } - if (chan->cid.cid_name) { - if (!ast_db_get("blacklist", chan->cid.cid_name, blacklist, sizeof (blacklist))) - bl = 1; - } - - snprintf(buf, len, "%d", bl); - return 0; -} - -static struct ast_custom_function blacklist_function = { - .name = "BLACKLIST", - .synopsis = "Check if the callerid is on the blacklist", - .desc = "Uses astdb to check if the Caller*ID is in family 'blacklist'. Returns 1 or 0.\n", - .syntax = "BLACKLIST()", - .read = blacklist_read, -}; - -static int -lookupblacklist_exec (struct ast_channel *chan, void *data) -{ - char blacklist[1]; - struct ast_module_user *u; - int bl = 0; - int priority_jump = 0; - static int dep_warning = 0; - - u = ast_module_user_add(chan); - - if (!dep_warning) { - dep_warning = 1; - ast_log(LOG_WARNING, "LookupBlacklist is deprecated. Please use ${BLACKLIST()} instead.\n"); - } - - if (!ast_strlen_zero(data)) { - if (strchr(data, 'j')) - priority_jump = 1; - } - - if (chan->cid.cid_num) { - if (!ast_db_get("blacklist", chan->cid.cid_num, blacklist, sizeof (blacklist))) { - if (option_verbose > 2) - ast_log(LOG_NOTICE, "Blacklisted number %s found\n",chan->cid.cid_num); - bl = 1; - } - } - if (chan->cid.cid_name) { - if (!ast_db_get("blacklist", chan->cid.cid_name, blacklist, sizeof (blacklist))) { - if (option_verbose > 2) - ast_log (LOG_NOTICE,"Blacklisted name \"%s\" found\n",chan->cid.cid_name); - bl = 1; - } - } - - if (bl) { - if (priority_jump || ast_opt_priority_jumping) - ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101); - pbx_builtin_setvar_helper(chan, "LOOKUPBLSTATUS", "FOUND"); - } else - pbx_builtin_setvar_helper(chan, "LOOKUPBLSTATUS", "NOTFOUND"); - - ast_module_user_remove(u); - - return 0; -} - -static int unload_module(void) -{ - int res; - - res = ast_unregister_application(app); - res |= ast_custom_function_unregister(&blacklist_function); - - ast_module_user_hangup_all(); - - return res; -} - -static int load_module(void) -{ - int res = ast_custom_function_register(&blacklist_function); - res |= ast_register_application (app, lookupblacklist_exec, synopsis,descrip); - return res; -} - -AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Look up Caller*ID name/number from blacklist database"); diff --git a/apps/app_lookupcidname.c b/apps/app_lookupcidname.c deleted file mode 100644 index 5a0042a..0000000 --- a/apps/app_lookupcidname.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Asterisk -- An open source telephony toolkit. - * - * Copyright (C) 1999 - 2005, Digium, Inc. - * - * Mark Spencer - * - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2. See the LICENSE file - * at the top of the source tree. - */ - -/*! \file - * - * \brief App to set callerid name from database, based on directory number - * - * \author Mark Spencer - * - * \ingroup applications - */ - -#include "asterisk.h" - -ASTERISK_FILE_VERSION(__FILE__, "$Revision$") - -#include -#include -#include - -#include "asterisk/lock.h" -#include "asterisk/file.h" -#include "asterisk/logger.h" -#include "asterisk/options.h" -#include "asterisk/channel.h" -#include "asterisk/pbx.h" -#include "asterisk/module.h" -#include "asterisk/translate.h" -#include "asterisk/image.h" -#include "asterisk/callerid.h" -#include "asterisk/astdb.h" - -static char *app = "LookupCIDName"; - -static char *synopsis = "Look up CallerID Name from local database"; - -static char *descrip = - " LookupCIDName: Looks up the Caller*ID number on the active\n" - "channel in the Asterisk database (family 'cidname') and sets the\n" - "Caller*ID name. Does nothing if no Caller*ID was received on the\n" - "channel. This is useful if you do not subscribe to Caller*ID\n" - "name delivery, or if you want to change the names on some incoming\n" - "calls.\n"; - - -static int lookupcidname_exec (struct ast_channel *chan, void *data) -{ - char dbname[64]; - struct ast_module_user *u; - static int dep_warning = 0; - - u = ast_module_user_add(chan); - if (!dep_warning) { - dep_warning = 1; - ast_log(LOG_WARNING, "LookupCIDName is deprecated. Please use ${DB(cidname/${CALLERID(num)})} instead.\n"); - } - if (chan->cid.cid_num) { - if (!ast_db_get ("cidname", chan->cid.cid_num, dbname, sizeof (dbname))) { - ast_set_callerid (chan, NULL, dbname, NULL); - if (option_verbose > 2) - ast_verbose (VERBOSE_PREFIX_3 "Changed Caller*ID name to %s\n", - dbname); - } - } - ast_module_user_remove(u); - - return 0; -} - -static int unload_module(void) -{ - int res; - - res = ast_unregister_application (app); - - ast_module_user_hangup_all(); - - return res; -} - -static int load_module(void) -{ - return ast_register_application (app, lookupcidname_exec, synopsis, descrip); -} - -AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Look up CallerID Name from local database"); diff --git a/apps/app_queue.c b/apps/app_queue.c index a8eda76..2e43f25 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -3646,16 +3646,6 @@ static int queue_function_queuememberlist(struct ast_channel *chan, char *cmd, c return 0; } -static struct ast_custom_function queueagentcount_function = { - .name = "QUEUEAGENTCOUNT", - .synopsis = "Count number of agents answering a queue", - .syntax = "QUEUEAGENTCOUNT()", - .desc = -"Returns the number of members currently associated with the specified queue.\n" -"This function is deprecated. You should use QUEUE_MEMBER_COUNT() instead.\n", - .read = queue_function_qac, -}; - static struct ast_custom_function queuemembercount_function = { .name = "QUEUE_MEMBER_COUNT", .synopsis = "Count number of members answering a queue", @@ -4438,7 +4428,6 @@ static int unload_module(void) res |= ast_unregister_application(app_upqm); res |= ast_unregister_application(app_ql); res |= ast_unregister_application(app); - res |= ast_custom_function_unregister(&queueagentcount_function); res |= ast_custom_function_unregister(&queuemembercount_function); res |= ast_custom_function_unregister(&queuememberlist_function); res |= ast_custom_function_unregister(&queuewaitingcount_function); @@ -4469,7 +4458,6 @@ static int load_module(void) res |= ast_manager_register("QueueAdd", EVENT_FLAG_AGENT, manager_add_queue_member, "Add interface to queue."); res |= ast_manager_register("QueueRemove", EVENT_FLAG_AGENT, manager_remove_queue_member, "Remove interface from queue."); res |= ast_manager_register("QueuePause", EVENT_FLAG_AGENT, manager_pause_queue_member, "Makes a queue member temporarily unavailable"); - res |= ast_custom_function_register(&queueagentcount_function); res |= ast_custom_function_register(&queuemembercount_function); res |= ast_custom_function_register(&queuememberlist_function); res |= ast_custom_function_register(&queuewaitingcount_function); diff --git a/apps/app_random.c b/apps/app_random.c deleted file mode 100644 index 8484f65..0000000 --- a/apps/app_random.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Asterisk -- An open source telephony toolkit. - * - * Copyright (c) 2003 - 2005 Tilghman Lesher. All rights reserved. - * - * Tilghman Lesher - * - * This code is released by the author with no restrictions on usage or distribution. - * - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - */ - -/*! \file - * - * \brief Random application - * - * \author Tilghman Lesher - * \ingroup applications - */ - -#include "asterisk.h" - -ASTERISK_FILE_VERSION(__FILE__, "$Revision$") - -#include -#include -#include -#include - -#include "asterisk/file.h" -#include "asterisk/logger.h" -#include "asterisk/options.h" -#include "asterisk/channel.h" -#include "asterisk/pbx.h" -#include "asterisk/module.h" - -/*! \todo The Random() app should be removed from trunk following the release of 1.4 */ - -static char *app_random = "Random"; - -static char *random_synopsis = "Conditionally branches, based upon a probability"; - -static char *random_descrip = -"Random([probability]:[[context|]extension|]priority)\n" -" probability := INTEGER in the range 1 to 100\n" -"DEPRECATED: Use GotoIf($[${RAND(1,100)} > ]?