mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-29 18:19:30 +00:00
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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user