[asterisk-commits] tilghman: trunk r43439 - in /trunk: apps/ funcs/
res/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Sep 21 12:35:29 MST 2006
Author: tilghman
Date: Thu Sep 21 14:35:29 2006
New Revision: 43439
URL: http://svn.digium.com/view/asterisk?rev=43439&view=rev
Log:
Remove deprecated apps and funcs
Added:
trunk/funcs/func_blacklist.c
- copied, changed from r43422, trunk/apps/app_lookupblacklist.c
trunk/funcs/func_vmcount.c
- copied, changed from r43422, trunk/apps/app_hasnewvoicemail.c
trunk/res/res_realtime.c
- copied, changed from r43422, trunk/apps/app_realtime.c
Removed:
trunk/apps/app_hasnewvoicemail.c
trunk/apps/app_lookupblacklist.c
trunk/apps/app_lookupcidname.c
trunk/apps/app_random.c
trunk/apps/app_realtime.c
trunk/funcs/func_language.c
trunk/funcs/func_moh.c
Modified:
trunk/apps/app_queue.c
trunk/funcs/func_md5.c
Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?rev=43439&r1=43438&r2=43439&view=diff
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Thu Sep 21 14:35:29 2006
@@ -3646,16 +3646,6 @@
return 0;
}
-static struct ast_custom_function queueagentcount_function = {
- .name = "QUEUEAGENTCOUNT",
- .synopsis = "Count number of agents answering a queue",
- .syntax = "QUEUEAGENTCOUNT(<queuename>)",
- .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 @@
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 @@
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);
Copied: trunk/funcs/func_blacklist.c (from r43422, trunk/apps/app_lookupblacklist.c)
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_blacklist.c?p2=trunk/funcs/func_blacklist.c&p1=trunk/apps/app_lookupblacklist.c&r1=43422&r2=43439&rev=43439&view=diff
==============================================================================
--- trunk/apps/app_lookupblacklist.c (original)
+++ trunk/funcs/func_blacklist.c Thu Sep 21 14:35:29 2006
@@ -18,11 +18,11 @@
/*! \file
*
- * \brief App to lookup the callerid number, and see if it is blacklisted
+ * \brief Function to lookup the callerid number, and see if it is blacklisted
*
* \author Mark Spencer <markster at digium.com>
*
- * \ingroup applications
+ * \ingroup functions
*
*/
@@ -46,21 +46,6 @@
#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)
{
@@ -88,71 +73,16 @@
.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);
-
+ int 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;
+ return ast_custom_function_register(&blacklist_function);
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Look up Caller*ID name/number from blacklist database");
Modified: trunk/funcs/func_md5.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_md5.c?rev=43439&r1=43438&r2=43439&view=diff
==============================================================================
--- trunk/funcs/func_md5.c (original)
+++ trunk/funcs/func_md5.c Thu Sep 21 14:35:29 2006
@@ -54,42 +54,6 @@
return 0;
}
-static int checkmd5(struct ast_channel *chan, char *cmd, char *parse,
- char *buf, size_t len)
-{
- char newmd5[33];
- static int deprecated = 0;
- AST_DECLARE_APP_ARGS(args, AST_APP_ARG(digest); AST_APP_ARG(data););
-
- if (ast_strlen_zero(parse)) {
- ast_log(LOG_WARNING,
- "Syntax: CHECK_MD5(<digest>,<data>) - missing argument!\n");
- return -1;
- }
-
- AST_STANDARD_APP_ARGS(args, parse);
-
- if (args.argc < 2) {
- ast_log(LOG_WARNING,
- "Syntax: CHECK_MD5(<digest>,<data>) - missing argument!\n");
- return -1;
- }
-
- if (!deprecated) {
- deprecated = 1;
- ast_log(LOG_WARNING, "CHECK_MD5() is deprecated in Asterisk 1.4 and later.\n");
- }
-
- ast_md5_hash(newmd5, args.data);
-
- if (!strcasecmp(newmd5, args.digest)) /* they match */
- ast_copy_string(buf, "1", len);
- else
- ast_copy_string(buf, "0", len);
-
- return 0;
-}
-
static struct ast_custom_function md5_function = {
.name = "MD5",
.synopsis = "Computes an MD5 digest",
@@ -97,24 +61,14 @@
.read = md5,
};
-static struct ast_custom_function checkmd5_function = {
- .name = "CHECK_MD5",
- .synopsis = "Checks an MD5 digest",
- .desc = "Returns 1 on a match, 0 otherwise\n",
- .syntax = "CHECK_MD5(<digest>,<data>)",
- .read = checkmd5,
-};
-
static int unload_module(void)
{
- return ast_custom_function_unregister(&md5_function) |
- ast_custom_function_unregister(&checkmd5_function);
+ return ast_custom_function_unregister(&md5_function);
}
static int load_module(void)
{
- return ast_custom_function_register(&md5_function) |
- ast_custom_function_register(&checkmd5_function);
+ return ast_custom_function_register(&md5_function);
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "MD5 digest dialplan functions");
Copied: trunk/funcs/func_vmcount.c (from r43422, trunk/apps/app_hasnewvoicemail.c)
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_vmcount.c?p2=trunk/funcs/func_vmcount.c&p1=trunk/apps/app_hasnewvoicemail.c&r1=43422&r2=43439&rev=43439&view=diff
==============================================================================
--- trunk/apps/app_hasnewvoicemail.c (original)
+++ trunk/funcs/func_vmcount.c Thu Sep 21 14:35:29 2006
@@ -1,13 +1,9 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Changes Copyright (c) 2004 - 2006 Todd Freeman <freeman at andrews.edu>
+ * Copyright (c) 2006 Tilghman Lesher. All rights reserved.
*
- * 95% based on HasNewVoicemail by:
- *
- * Copyright (c) 2003 Tilghman Lesher. All rights reserved.
- *
- * Tilghman Lesher <asterisk-hasnewvoicemail-app at the-tilghman.com>
+ * Tilghman Lesher <asterisk-vmcount-func at the-tilghman.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
@@ -22,14 +18,11 @@
/*! \file
*
- * \brief HasVoicemail application
+ * \brief VMCOUNT dialplan function
*
- * \author Todd Freeman <freeman at andrews.edu>
+ * \author Tilghman Lesher <asterisk-vmcount-func at the-tilghman.com>
*
- * \note 95% based on HasNewVoicemail by
- * Tilghman Lesher <asterisk-hasnewvoicemail-app at the-tilghman.com>
- *
- * \ingroup applications
+ * \ingroup functions
*/
#include "asterisk.h"
@@ -44,7 +37,6 @@
#include <sys/types.h>
#include "asterisk/file.h"
-#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
@@ -52,103 +44,6 @@
#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 <varname> 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 <varname> 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)
{
@@ -195,12 +90,7 @@
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);
-
+ int res = ast_custom_function_unregister(&acf_vmcount);
ast_module_user_hangup_all();
return res;
@@ -208,13 +98,7 @@
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;
+ return ast_custom_function_register(&acf_vmcount);
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Indicator for whether a voice mailbox has messages in a given folder.");
Copied: trunk/res/res_realtime.c (from r43422, trunk/apps/app_realtime.c)
URL: http://svn.digium.com/view/asterisk/trunk/res/res_realtime.c?p2=trunk/res/res_realtime.c&p1=trunk/apps/app_realtime.c&r1=43422&r2=43439&rev=43439&view=diff
==============================================================================
--- trunk/apps/app_realtime.c (original)
+++ trunk/res/res_realtime.c Thu Sep 21 14:35:29 2006
@@ -19,7 +19,7 @@
/*! \file
*
- * \brief RealTime App
+ * \brief RealTime CLI
*
* \author Anthony Minessale <anthmct at yahoo.com>
* \author Mark Spencer <markster at digium.com>
@@ -45,28 +45,6 @@
#include "asterisk/module.h"
#include "asterisk/lock.h"
#include "asterisk/cli.h"
-
-#define next_one(var) var = var->next
-#define crop_data(str) { *(str) = '\0' ; (str)++; }
-
-static char *app = "RealTime";
-static char *uapp = "RealTimeUpdate";
-static char *synopsis = "Realtime Data Lookup";
-static char *usynopsis = "Realtime Data Rewrite";
-static char *USAGE = "RealTime(<family>|<colmatch>|<value>[|<prefix>])";
-static char *UUSAGE = "RealTimeUpdate(<family>|<colmatch>|<value>|<newcol>|<newval>)";
-static char *desc =
-"Use the RealTime config handler system to read data into channel variables.\n"
-"RealTime(<family>|<colmatch>|<value>[|<prefix>])\n\n"
-"All unique column names will be set as channel variables with optional prefix\n"
-"to the name. For example, a prefix of 'var_' would make the column 'name'\n"
-"become the variable ${var_name}. REALTIMECOUNT will be set with the number\n"
-"of values read.\n";
-static char *udesc = "Use the RealTime config handler system to update a value\n"
-"RealTimeUpdate(<family>|<colmatch>|<value>|<newcol>|<newval>)\n\n"
-"The column <newcol> in 'family' matching column <colmatch>=<value> will be\n"
-"updated to <newval>. REALTIMECOUNT will be set with the number of rows\n"
-"updated or -1 if an error occurs.\n";
static int cli_realtime_load(int fd, int argc, char **argv)
@@ -133,129 +111,17 @@
cli_realtime_update_usage, NULL },
};
-static int realtime_update_exec(struct ast_channel *chan, void *data)
-{
- char *family=NULL, *colmatch=NULL, *value=NULL, *newcol=NULL, *newval=NULL;
- struct ast_module_user *u;
- int res = 0, count = 0;
- char countc[13];
-
- ast_log(LOG_WARNING, "The RealTimeUpdate application has been deprecated in favor of the REALTIME dialplan function.\n");
-
- if (ast_strlen_zero(data)) {
- ast_log(LOG_ERROR,"Invalid input: usage %s\n",UUSAGE);
- return -1;
- }
-
- u = ast_module_user_add(chan);
-
- family = ast_strdupa(data);
- if ((colmatch = strchr(family,'|'))) {
- crop_data(colmatch);
- if ((value = strchr(colmatch,'|'))) {
- crop_data(value);
- if ((newcol = strchr(value,'|'))) {
- crop_data(newcol);
- if ((newval = strchr(newcol,'|')))
- crop_data(newval);
- }
- }
- }
- if (! (family && value && colmatch && newcol && newval) ) {
- ast_log(LOG_ERROR,"Invalid input: usage %s\n",UUSAGE);
- res = -1;
- } else {
- count = ast_update_realtime(family,colmatch,value,newcol,newval,NULL);
- }
-
- snprintf(countc, sizeof(countc), "%d", count);
- pbx_builtin_setvar_helper(chan, "REALTIMECOUNT", countc);
-
- ast_module_user_remove(u);
-
- return res;
-}
-
-
-static int realtime_exec(struct ast_channel *chan, void *data)
-{
- int res=0, count=0;
- struct ast_module_user *u;
- struct ast_variable *var, *itt;
- char *family=NULL, *colmatch=NULL, *value=NULL, *prefix=NULL, *vname=NULL;
- char countc[13];
- size_t len;
-
- ast_log(LOG_WARNING, "The RealTime application has been deprecated in favor of the REALTIME dialplan function.\n");
-
- if (ast_strlen_zero(data)) {
- ast_log(LOG_ERROR,"Invalid input: usage %s\n",USAGE);
- return -1;
- }
-
- u = ast_module_user_add(chan);
-
- family = ast_strdupa(data);
- if ((colmatch = strchr(family,'|'))) {
- crop_data(colmatch);
- if ((value = strchr(colmatch,'|'))) {
- crop_data(value);
- if ((prefix = strchr(value,'|')))
- crop_data(prefix);
- }
- }
- if (! (family && value && colmatch) ) {
- ast_log(LOG_ERROR,"Invalid input: usage %s\n",USAGE);
- res = -1;
- } else {
- if (option_verbose > 3)
- ast_verbose(VERBOSE_PREFIX_4"Realtime Lookup: family:'%s' colmatch:'%s' value:'%s'\n",family,colmatch,value);
- if ((var = ast_load_realtime(family, colmatch, value, NULL))) {
- for (itt = var; itt; itt = itt->next) {
- if(prefix) {
- len = strlen(prefix) + strlen(itt->name) + 2;
- vname = alloca(len);
- snprintf(vname,len,"%s%s",prefix,itt->name);
-
- } else
- vname = itt->name;
-
- pbx_builtin_setvar_helper(chan, vname, itt->value);
- count++;
- }
- ast_variables_destroy(var);
- } else if (option_verbose > 3)
- ast_verbose(VERBOSE_PREFIX_4"No Realtime Matches Found.\n");
- }
- snprintf(countc, sizeof(countc), "%d", count);
- pbx_builtin_setvar_helper(chan, "REALTIMECOUNT", countc);
-
- ast_module_user_remove(u);
- return res;
-}
-
static int unload_module(void)
{
- int res;
-
ast_cli_unregister_multiple(cli_realtime, sizeof(cli_realtime) / sizeof(struct ast_cli_entry));
- res = ast_unregister_application(uapp);
- res |= ast_unregister_application(app);
-
ast_module_user_hangup_all();
-
- return res;
+ return 0;
}
static int load_module(void)
{
- int res;
-
ast_cli_register_multiple(cli_realtime, sizeof(cli_realtime) / sizeof(struct ast_cli_entry));
- res = ast_register_application(uapp, realtime_update_exec, usynopsis, udesc);
- res |= ast_register_application(app, realtime_exec, synopsis, desc);
-
- return res;
+ return 0;
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Realtime Data Lookup/Rewrite");
More information about the asterisk-commits
mailing list