Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "asterisk.h"
00026
00027 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 153365 $")
00028
00029 #include "asterisk/module.h"
00030 #include "asterisk/channel.h"
00031 #include "asterisk/pbx.h"
00032 #include "asterisk/utils.h"
00033 #include "asterisk/app.h"
00034 #include "asterisk/ast_version.h"
00035 #include "asterisk/build.h"
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 static int acf_version_exec(struct ast_channel *chan, const char *cmd,
00081 char *parse, char *buffer, size_t buflen)
00082 {
00083 const char *response_char = ast_get_version();
00084 AST_DECLARE_APP_ARGS(args,
00085 AST_APP_ARG(info);
00086 );
00087
00088 AST_STANDARD_APP_ARGS(args, parse);
00089
00090 if (!ast_strlen_zero(args.info) ) {
00091 if (!strcasecmp(args.info,"ASTERISK_VERSION_NUM"))
00092 response_char = ast_get_version_num();
00093 else if (!strcasecmp(args.info,"BUILD_USER"))
00094 response_char = BUILD_USER;
00095 else if (!strcasecmp(args.info,"BUILD_HOSTNAME"))
00096 response_char = BUILD_HOSTNAME;
00097 else if (!strcasecmp(args.info,"BUILD_MACHINE"))
00098 response_char = BUILD_MACHINE;
00099 else if (!strcasecmp(args.info,"BUILD_KERNEL"))
00100 response_char = BUILD_KERNEL;
00101 else if (!strcasecmp(args.info,"BUILD_OS"))
00102 response_char = BUILD_OS;
00103 else if (!strcasecmp(args.info,"BUILD_DATE"))
00104 response_char = BUILD_DATE;
00105 }
00106
00107 ast_debug(1, "VERSION returns %s result, given %s argument\n", response_char, args.info);
00108
00109 ast_copy_string(buffer, response_char, buflen);
00110
00111 return 0;
00112 }
00113
00114 static struct ast_custom_function acf_version = {
00115 .name = "VERSION",
00116 .read = acf_version_exec,
00117 };
00118
00119 static int unload_module(void)
00120 {
00121 ast_custom_function_unregister(&acf_version);
00122
00123 return 0;
00124 }
00125
00126 static int load_module(void)
00127 {
00128 return ast_custom_function_register(&acf_version);
00129 }
00130
00131 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Get Asterisk Version/Build Info");