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
00026
00027
00028
00029 #include "asterisk.h"
00030
00031 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 328209 $")
00032
00033 #include "asterisk/module.h"
00034 #include "asterisk/pbx.h"
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 static int ifmodule_read(struct ast_channel *chan, const char *cmd, char *data,
00055 char *buf, size_t len)
00056 {
00057 char *ret = "0";
00058
00059 *buf = '\0';
00060
00061 if (data)
00062 if (ast_module_check(data))
00063 ret = "1";
00064
00065 ast_copy_string(buf, ret, len);
00066
00067 return 0;
00068 }
00069
00070 static struct ast_custom_function ifmodule_function = {
00071 .name = "IFMODULE",
00072 .read = ifmodule_read,
00073 .read_max = 2,
00074 };
00075
00076
00077 static int unload_module(void)
00078 {
00079 return ast_custom_function_unregister(&ifmodule_function);
00080 }
00081
00082 static int load_module(void)
00083 {
00084 return ast_custom_function_register(&ifmodule_function);
00085 }
00086
00087 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Checks if Asterisk module is loaded in memory");