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: 191140 $")
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 static int md5(struct ast_channel *chan, const char *cmd, char *data,
00051 char *buf, size_t len)
00052 {
00053 if (ast_strlen_zero(data)) {
00054 ast_log(LOG_WARNING, "Syntax: MD5(<data>) - missing argument!\n");
00055 return -1;
00056 }
00057
00058 ast_md5_hash(buf, data);
00059 buf[32] = '\0';
00060
00061 return 0;
00062 }
00063
00064 static struct ast_custom_function md5_function = {
00065 .name = "MD5",
00066 .read = md5,
00067 .read_max = 33,
00068 };
00069
00070 static int unload_module(void)
00071 {
00072 return ast_custom_function_unregister(&md5_function);
00073 }
00074
00075 static int load_module(void)
00076 {
00077 return ast_custom_function_register(&md5_function);
00078 }
00079
00080 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "MD5 digest dialplan functions");