Thu Feb 13 07:00:00 CET 2003

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@613 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Matteo Brancaleoni
2003-02-13 06:00:14 +00:00
parent 2bd936105e
commit 52a7b81e24
4 changed files with 45 additions and 8 deletions

28
pbx.c
View File

@@ -145,6 +145,7 @@ static int pbx_builtin_ringing(struct ast_channel *, void *);
static int pbx_builtin_congestion(struct ast_channel *, void *);
static int pbx_builtin_busy(struct ast_channel *, void *);
static int pbx_builtin_setvar(struct ast_channel *, void *);
static int pbx_builtin_setglobalvar(struct ast_channel *, void *);
static int pbx_builtin_noop(struct ast_channel *, void *);
static int pbx_builtin_gotoif(struct ast_channel *, void *);
void pbx_builtin_setvar_helper(struct ast_channel *chan, char *name, char *value);
@@ -259,10 +260,14 @@ static struct pbx_builtin {
" Busy(): Requests that the channel indicate busy condition and then waits\n"
"for the user to hang up. Always returns -1." },
{ "Setvar", pbx_builtin_setvar,
{ "SetVar", pbx_builtin_setvar,
"Set variable to value",
" Setvar(#n=value): Sets variable n to value" },
{ "SetGlobalVar", pbx_builtin_setglobalvar,
"Set variable to value",
" Setvar(#n=value): Sets global variable n to value" },
{ "NoOp", pbx_builtin_noop,
"No operation",
" NoOp(): No-operation; Does nothing." },
@@ -3580,6 +3585,27 @@ static int pbx_builtin_setvar(struct ast_channel *chan, void *data)
return(0);
}
static int pbx_builtin_setglobalvar(struct ast_channel *chan, void *data)
{
char *name;
char *value;
char *stringp=NULL;
if (!data || !strlen(data)) {
ast_log(LOG_WARNING, "Ignoring, since there is no variable to set\n");
return 0;
}
stringp=data;
name=strsep(&stringp,"=");
value=strsep(&stringp,"\0");
pbx_builtin_setvar_helper(NULL,name,value);
return(0);
}
static int pbx_builtin_noop(struct ast_channel *chan, void *data)
{
return 0;