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_language.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_language.c')
-rw-r--r-- | funcs/func_language.c | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/funcs/func_language.c b/funcs/func_language.c index f6bc1a4c9..05835d6d3 100644 --- a/funcs/func_language.c +++ b/funcs/func_language.c @@ -1,7 +1,7 @@ /* * Asterisk -- An open source telephony toolkit. * - * Copyright (C) 1999 - 2005, Digium, Inc. + * Copyright (C) 1999 - 2006, Digium, Inc. * * See http://www.asterisk.org for more information about * the Asterisk project. Please do not directly contact @@ -36,31 +36,42 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/app.h" #include "asterisk/stringfields.h" -static char *language_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) +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 buf; + return 0; } -static void language_write(struct ast_channel *chan, char *cmd, char *data, const char *value) +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); + 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 = "Gets or sets the channel language. This information is used for the\n" - "syntax in generation of numbers, and to choose a natural language file\n" - "when available. For example, if language is set to 'fr' and the file\n" - "'demo-congrats' is requested to be played, if the file\n" - "'fr/demo-congrats' exists, then it will play that file, and if not\n" - "will play the normal 'demo-congrats'. For some language codes,\n" - "changing the language also changes the syntax of some Asterisk\n" - "functions, like SayNumber.\n", + .desc = "Deprecated. Use CHANNEL(language) instead.\n", .read = language_read, .write = language_write, }; @@ -69,12 +80,12 @@ static char *tdesc = "Channel language dialplan function"; int unload_module(void) { - return ast_custom_function_unregister(&language_function); + return ast_custom_function_unregister(&language_function); } int load_module(void) { - return ast_custom_function_register(&language_function); + return ast_custom_function_register(&language_function); } char *description(void) @@ -91,11 +102,3 @@ char *key() { return ASTERISK_GPL_KEY; } - -/* -Local Variables: -mode: C -c-file-style: "linux" -indent-tabs-mode: nil -End: -*/ |