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
This commit is contained in:
Kevin P. Fleming
2006-02-12 04:28:58 +00:00
parent 3d2404c62c
commit 96bf384e7d
35 changed files with 1160 additions and 1101 deletions

View File

@@ -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:
*/