00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <stdlib.h>
00024 #include <string.h>
00025 #include <sys/types.h>
00026
00027 #include "asterisk.h"
00028
00029
00030
00031 #include "asterisk/channel.h"
00032 #include "asterisk/pbx.h"
00033 #include "asterisk/logger.h"
00034 #include "asterisk/utils.h"
00035 #include "asterisk/app.h"
00036
00037 static char *builtin_function_language_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
00038 {
00039 ast_copy_string(buf, chan->language, len);
00040
00041 return buf;
00042 }
00043
00044 static void builtin_function_language_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
00045 {
00046 if (value)
00047 ast_copy_string(chan->language, value, sizeof(chan->language));
00048 }
00049
00050 #ifndef BUILTIN_FUNC
00051 static
00052 #endif
00053 struct ast_custom_function language_function = {
00054 .name = "LANGUAGE",
00055 .synopsis = "Gets or sets the channel's language.",
00056 .syntax = "LANGUAGE()",
00057 .desc = "Gets or sets the channel language. This information is used for the\n"
00058 "syntax in generation of numbers, and to choose a natural language file\n"
00059 "when available. For example, if language is set to 'fr' and the file\n"
00060 "'demo-congrats' is requested to be played, if the file\n"
00061 "'fr/demo-congrats' exists, then it will play that file, and if not\n"
00062 "will play the normal 'demo-congrats'. For some language codes,\n"
00063 "changing the language also changes the syntax of some Asterisk\n"
00064 "functions, like SayNumber.\n",
00065 .read = builtin_function_language_read,
00066 .write = builtin_function_language_write,
00067 };
00068
00069
00070
00071
00072
00073
00074
00075