Let's also include aclocal.m4
[asterisk-bristuff.git] / funcs / func_language.c
blob43b368f4f57876ae667a3b073ca2d13a82323497
1 /*
2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 1999 - 2006, Digium, Inc.
6 * See http://www.asterisk.org for more information about
7 * the Asterisk project. Please do not directly contact
8 * any of the maintainers of this project for assistance;
9 * the project provides a web site, mailing lists and IRC
10 * channels for your use.
12 * This program is free software, distributed under the terms of
13 * the GNU General Public License Version 2. See the LICENSE file
14 * at the top of the source tree.
17 /*! \file
19 * \brief Language related dialplan functions
23 #include "asterisk.h"
25 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
30 #include <sys/types.h>
32 #include "asterisk/module.h"
33 #include "asterisk/channel.h"
34 #include "asterisk/pbx.h"
35 #include "asterisk/logger.h"
36 #include "asterisk/utils.h"
37 #include "asterisk/app.h"
38 #include "asterisk/stringfields.h"
40 static int depwarning = 0;
42 static int language_read(struct ast_channel *chan, char *cmd, char *data,
43 char *buf, size_t len)
45 if (!depwarning) {
46 depwarning = 1;
47 ast_log(LOG_WARNING,
48 "LANGUAGE() is deprecated; use CHANNEL(language) instead.\n");
51 ast_copy_string(buf, chan ? chan->language : "", len);
53 return 0;
56 static int language_write(struct ast_channel *chan, char *cmd, char *data,
57 const char *value)
59 if (!depwarning) {
60 depwarning = 1;
61 ast_log(LOG_WARNING,
62 "LANGUAGE() is deprecated; use CHANNEL(language) instead.\n");
65 if (chan && value)
66 ast_string_field_set(chan, language, value);
68 return 0;
71 static struct ast_custom_function language_function = {
72 .name = "LANGUAGE",
73 .synopsis = "Gets or sets the channel's language.",
74 .syntax = "LANGUAGE()",
75 .desc = "Deprecated. Use CHANNEL(language) instead.\n",
76 .read = language_read,
77 .write = language_write,
80 static int unload_module(void)
82 return ast_custom_function_unregister(&language_function);
85 static int load_module(void)
87 return ast_custom_function_register(&language_function);
90 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Channel language dialplan function");