mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
major dialplan functions update
deprecate LANGUAGE() and MUSICCLASS(), in favor of CHANNEL() git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@9674 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -37,22 +37,26 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#include "asterisk/utils.h"
|
||||
#include "asterisk/app.h"
|
||||
|
||||
static char *sha1(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
|
||||
static int sha1(struct ast_channel *chan, char *cmd, char *data,
|
||||
char *buf, size_t len)
|
||||
{
|
||||
*buf = '\0';
|
||||
|
||||
if (ast_strlen_zero(data)) {
|
||||
ast_log(LOG_WARNING, "Syntax: SHA1(<data>) - missing argument!\n");
|
||||
return NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (len >= 41)
|
||||
ast_sha1_hash(buf, data);
|
||||
else {
|
||||
ast_log(LOG_ERROR, "Insufficient space to produce SHA1 hash result (%d < 41)\n", len);
|
||||
*buf = '\0';
|
||||
ast_log(LOG_ERROR,
|
||||
"Insufficient space to produce SHA1 hash result (%d < 41)\n",
|
||||
len);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct ast_custom_function sha1_function = {
|
||||
.name = "SHA1",
|
||||
@@ -60,21 +64,21 @@ static struct ast_custom_function sha1_function = {
|
||||
.syntax = "SHA1(<data>)",
|
||||
.read = sha1,
|
||||
.desc = "Generate a SHA1 digest via the SHA1 algorythm.\n"
|
||||
" Example: Set(sha1hash=${SHA1(junky)})\n"
|
||||
" Sets the asterisk variable sha1hash to the string '60fa5675b9303eb62f99a9cd47f9f5837d18f9a0'\n"
|
||||
" which is known as his hash\n",
|
||||
" Example: Set(sha1hash=${SHA1(junky)})\n"
|
||||
" Sets the asterisk variable sha1hash to the string '60fa5675b9303eb62f99a9cd47f9f5837d18f9a0'\n"
|
||||
" which is known as his hash\n",
|
||||
};
|
||||
|
||||
static char *tdesc = "SHA-1 computation dialplan function";
|
||||
|
||||
int unload_module(void)
|
||||
{
|
||||
return ast_custom_function_unregister(&sha1_function);
|
||||
return ast_custom_function_unregister(&sha1_function);
|
||||
}
|
||||
|
||||
int load_module(void)
|
||||
{
|
||||
return ast_custom_function_register(&sha1_function);
|
||||
return ast_custom_function_register(&sha1_function);
|
||||
}
|
||||
|
||||
char *description(void)
|
||||
|
Reference in New Issue
Block a user