Add the FILE() dialplan function and deprecate ReadFile.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89114 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2007-11-08 17:32:15 +00:00
parent 86e5e39198
commit 3a70afbc3e
2 changed files with 65 additions and 0 deletions

View File

@@ -58,6 +58,7 @@ static int readfile_exec(struct ast_channel *chan, void *data)
int res=0;
char *s, *varname=NULL, *file=NULL, *length=NULL, *returnvar=NULL;
int len=0;
static int deprecation_warning = 0;
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "ReadFile require an argument!\n");
@@ -70,6 +71,9 @@ static int readfile_exec(struct ast_channel *chan, void *data)
file = strsep(&s, ",");
length = s;
if (deprecation_warning++ % 10 == 0)
ast_log(LOG_WARNING, "ReadFile has been deprecated in favor of Set(%s=${FILE(%s,0,%s)})\n", varname, file, length);
if (!varname || !file) {
ast_log(LOG_ERROR, "No file or variable specified!\n");
return -1;