aboutsummaryrefslogtreecommitdiffstats
path: root/funcs
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-21 19:35:29 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-21 19:35:29 +0000
commitd634012c4e22037962bc4eb5cd502f26e3b120f0 (patch)
tree2273c2af124e1edd36bd7b3efcd65f9e84a54281 /funcs
parentc2b2866b49ad8587959de5001451fcd06d82123d (diff)
Remove deprecated apps and funcs
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43439 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_blacklist.c88
-rw-r--r--funcs/func_language.c90
-rw-r--r--funcs/func_md5.c50
-rw-r--r--funcs/func_moh.c86
-rw-r--r--funcs/func_vmcount.c104
5 files changed, 194 insertions, 224 deletions
diff --git a/funcs/func_blacklist.c b/funcs/func_blacklist.c
new file mode 100644
index 000000000..2d1291924
--- /dev/null
+++ b/funcs/func_blacklist.c
@@ -0,0 +1,88 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 1999 - 2005, Digium, Inc.
+ *
+ * Mark Spencer <markster@digium.com>
+ *
+ * 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 Function to lookup the callerid number, and see if it is blacklisted
+ *
+ * \author Mark Spencer <markster@digium.com>
+ *
+ * \ingroup functions
+ *
+ */
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#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 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 unload_module(void)
+{
+ int res = ast_custom_function_unregister(&blacklist_function);
+ ast_module_user_hangup_all();
+ return res;
+}
+
+static int load_module(void)
+{
+ return ast_custom_function_register(&blacklist_function);
+}
+
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Look up Caller*ID name/number from blacklist database");
diff --git a/funcs/func_language.c b/funcs/func_language.c
deleted file mode 100644
index af6f9d0a9..000000000
--- a/funcs/func_language.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 1999 - 2006, Digium, Inc.
- *
- * 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 Language related dialplan functions
- *
- */
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include "asterisk/module.h"
-#include "asterisk/channel.h"
-#include "asterisk/pbx.h"
-#include "asterisk/logger.h"
-#include "asterisk/utils.h"
-#include "asterisk/app.h"
-#include "asterisk/stringfields.h"
-
-static int depwarning = 0;
-
-static int language_read(struct ast_channel *chan, char *cmd, char *data,
- char *buf, size_t len)
-{
- if (!depwarning) {
- depwarning = 1;
- ast_log(LOG_WARNING,
- "LANGUAGE() is deprecated; use CHANNEL(language) instead.\n");
- }
-
- ast_copy_string(buf, chan->language, len);
-
- return 0;
-}
-
-static int language_write(struct ast_channel *chan, char *cmd, char *data,
- const char *value)
-{
- if (!depwarning) {
- depwarning = 1;
- ast_log(LOG_WARNING,
- "LANGUAGE() is deprecated; use CHANNEL(language) instead.\n");
- }
-
- if (value)
- ast_string_field_set(chan, language, value);
-
- return 0;
-}
-
-static struct ast_custom_function language_function = {
- .name = "LANGUAGE",
- .synopsis = "Gets or sets the channel's language.",
- .syntax = "LANGUAGE()",
- .desc = "Deprecated. Use CHANNEL(language) instead.\n",
- .read = language_read,
- .write = language_write,
-};
-
-static int unload_module(void)
-{
- return ast_custom_function_unregister(&language_function);
-}
-
-static int load_module(void)
-{
- return ast_custom_function_register(&language_function);
-}
-
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Channel language dialplan function");
diff --git a/funcs/func_md5.c b/funcs/func_md5.c
index db6be8f7b..9b58693fc 100644
--- a/funcs/func_md5.c
+++ b/funcs/func_md5.c
@@ -54,42 +54,6 @@ static int md5(struct ast_channel *chan, char *cmd, char *data,
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 @@ static struct ast_custom_function md5_function = {
.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");
diff --git a/funcs/func_moh.c b/funcs/func_moh.c
deleted file mode 100644
index c8e29a747..000000000
--- a/funcs/func_moh.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 1999 - 2006, Digium, Inc.
- *
- * Russell Bryant <russelb@clemson.edu>
- *
- * 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 Functions for reading or setting the MusicOnHold class
- *
- * \author Russell Bryant <russelb@clemson.edu>
- */
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "asterisk/module.h"
-#include "asterisk/channel.h"
-#include "asterisk/pbx.h"
-#include "asterisk/utils.h"
-#include "asterisk/stringfields.h"
-
-static int depwarning = 0;
-
-static int moh_read(struct ast_channel *chan, char *cmd, char *data,
- char *buf, size_t len)
-{
- if (!depwarning) {
- depwarning = 1;
- ast_log(LOG_WARNING, "MUSICCLASS() is deprecated; use CHANNEL(musicclass) instead.\n");
- }
-
- ast_copy_string(buf, chan->musicclass, len);
-
- return 0;
-}
-
-static int moh_write(struct ast_channel *chan, char *cmd, char *data,
- const char *value)
-{
- if (!depwarning) {
- depwarning = 1;
- ast_log(LOG_WARNING, "MUSICCLASS() is deprecated; use CHANNEL(musicclass) instead.\n");
- }
-
- ast_string_field_set(chan, musicclass, value);
-
- return 0;
-}
-
-static struct ast_custom_function moh_function = {
- .name = "MUSICCLASS",
- .synopsis = "Read or Set the MusicOnHold class",
- .syntax = "MUSICCLASS()",
- .desc = "Deprecated. Use CHANNEL(musicclass) instead.\n",
- .read = moh_read,
- .write = moh_write,
-};
-
-static int unload_module(void)
-{
- return ast_custom_function_unregister(&moh_function);
-}
-
-static int load_module(void)
-{
- return ast_custom_function_register(&moh_function);
-}
-
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Music-on-hold dialplan function");
diff --git a/funcs/func_vmcount.c b/funcs/func_vmcount.c
new file mode 100644
index 000000000..10ff000c7
--- /dev/null
+++ b/funcs/func_vmcount.c
@@ -0,0 +1,104 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (c) 2006 Tilghman Lesher. All rights reserved.
+ *
+ * Tilghman Lesher <asterisk-vmcount-func@the-tilghman.com>
+ *
+ * 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 VMCOUNT dialplan function
+ *
+ * \author Tilghman Lesher <asterisk-vmcount-func@the-tilghman.com>
+ *
+ * \ingroup functions
+ */
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <dirent.h>
+#include <sys/types.h>
+
+#include "asterisk/file.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 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 = ast_custom_function_unregister(&acf_vmcount);
+ ast_module_user_hangup_all();
+
+ return res;
+}
+
+static int load_module(void)
+{
+ 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.");