diff options
author | Kevin P. Fleming <kpfleming@digium.com> | 2006-02-12 04:28:58 +0000 |
---|---|---|
committer | Kevin P. Fleming <kpfleming@digium.com> | 2006-02-12 04:28:58 +0000 |
commit | 96bf384e7d84291c40dcbe2e26e16af1c5a974c1 (patch) | |
tree | 5c4270c1ac3d265b96361d98722a75b947f2f8c6 /funcs/func_moh.c | |
parent | 3d2404c62cc4ff50c05900f305d2a4939a9d5c8b (diff) |
major dialplan functions update
deprecate LANGUAGE() and MUSICCLASS(), in favor of CHANNEL()
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@9674 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'funcs/func_moh.c')
-rw-r--r-- | funcs/func_moh.c | 30 |
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) |