aboutsummaryrefslogtreecommitdiffstats
path: root/funcs/func_moh.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-12 04:28:58 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-12 04:28:58 +0000
commit5d9ed5739aab2b302efc178d21e6c75672369db3 (patch)
tree5c4270c1ac3d265b96361d98722a75b947f2f8c6 /funcs/func_moh.c
parent9f87dd693e9e74816b913a157fdcdefa3d7a2e56 (diff)
major dialplan functions update
deprecate LANGUAGE() and MUSICCLASS(), in favor of CHANNEL() git-svn-id: http://svn.digium.com/svn/asterisk/trunk@9674 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs/func_moh.c')
-rw-r--r--funcs/func_moh.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/funcs/func_moh.c b/funcs/func_moh.c
index f7cebff93..d027b75f4 100644
--- a/funcs/func_moh.c
+++ b/funcs/func_moh.c
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
*
* Russell Bryant <russelb@clemson.edu>
*
@@ -35,23 +35,39 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/stringfields.h"
-static char *moh_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+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 buf;
+ return 0;
}
-static void moh_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
+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 = "This function will read or set the music on hold class for a channel.\n",
+ .desc = "Deprecated. Use CHANNEL(musicclass) instead.\n",
.read = moh_read,
.write = moh_write,
};
@@ -60,12 +76,12 @@ static char *tdesc = "Music-on-hold dialplan function";
int unload_module(void)
{
- return ast_custom_function_unregister(&moh_function);
+ return ast_custom_function_unregister(&moh_function);
}
int load_module(void)
{
- return ast_custom_function_register(&moh_function);
+ return ast_custom_function_register(&moh_function);
}
char *description(void)