00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "asterisk.h"
00024
00025 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 61681 $")
00026
00027 #include <stdio.h>
00028 #include <stdlib.h>
00029 #include <string.h>
00030 #include <sys/types.h>
00031
00032 #include "asterisk/module.h"
00033 #include "asterisk/channel.h"
00034 #include "asterisk/pbx.h"
00035 #include "asterisk/logger.h"
00036 #include "asterisk/utils.h"
00037 #include "asterisk/app.h"
00038 #include "asterisk/stringfields.h"
00039
00040 static int depwarning = 0;
00041
00042 static int language_read(struct ast_channel *chan, char *cmd, char *data,
00043 char *buf, size_t len)
00044 {
00045 if (!depwarning) {
00046 depwarning = 1;
00047 ast_log(LOG_WARNING,
00048 "LANGUAGE() is deprecated; use CHANNEL(language) instead.\n");
00049 }
00050
00051 ast_copy_string(buf, chan ? chan->language : "", len);
00052
00053 return 0;
00054 }
00055
00056 static int language_write(struct ast_channel *chan, char *cmd, char *data,
00057 const char *value)
00058 {
00059 if (!depwarning) {
00060 depwarning = 1;
00061 ast_log(LOG_WARNING,
00062 "LANGUAGE() is deprecated; use CHANNEL(language) instead.\n");
00063 }
00064
00065 if (chan && value)
00066 ast_string_field_set(chan, language, value);
00067
00068 return 0;
00069 }
00070
00071 static struct ast_custom_function language_function = {
00072 .name = "LANGUAGE",
00073 .synopsis = "Gets or sets the channel's language.",
00074 .syntax = "LANGUAGE()",
00075 .desc = "Deprecated. Use CHANNEL(language) instead.\n",
00076 .read = language_read,
00077 .write = language_write,
00078 };
00079
00080 static int unload_module(void)
00081 {
00082 return ast_custom_function_unregister(&language_function);
00083 }
00084
00085 static int load_module(void)
00086 {
00087 return ast_custom_function_register(&language_function);
00088 }
00089
00090 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Channel language dialplan function");