summaryrefslogtreecommitdiff
path: root/apps/app_externalivr.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2007-07-23 19:51:41 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2007-07-23 19:51:41 +0000
commit55b1ee298e926c594f45456e5afbc25c79e3889b (patch)
treec9c73917bfd120da30c16650000c7296781fae50 /apps/app_externalivr.c
parentd8d1b6c8f242dbc1be319ceef5442378a5bda885 (diff)
Merge the dialplan_aesthetics branch. Most of this patch simply converts applications
using old methods of parsing arguments to using the standard macros. However, the big change is that the really old way of specifying application and arguments separated by a comma will no longer work (e.g. NoOp,foo|bar). Instead, the way that has been recommended since long before 1.0 will become the only method available (e.g. NoOp(foo,bar). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@76703 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_externalivr.c')
-rw-r--r--apps/app_externalivr.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/apps/app_externalivr.c b/apps/app_externalivr.c
index 63c182337..31cdafd0a 100644
--- a/apps/app_externalivr.c
+++ b/apps/app_externalivr.c
@@ -58,7 +58,7 @@ static const char *app = "ExternalIVR";
static const char *synopsis = "Interfaces with an external IVR application";
static const char *descrip =
-" ExternalIVR(command[|arg[|arg...]]): Forks an process to run the supplied command,\n"
+" ExternalIVR(command[,arg[,arg...]]): Forks an process to run the supplied command,\n"
"and starts a generator on the channel. The generator's play list is\n"
"controlled by the external application, which can add and clear entries\n"
"via simple commands issued over its stdout. The external application\n"
@@ -244,7 +244,6 @@ static struct playlist_entry *make_entry(const char *filename)
static int app_exec(struct ast_channel *chan, void *data)
{
struct playlist_entry *entry;
- const char *args = data;
int child_stdin[2] = { 0,0 };
int child_stdout[2] = { 0,0 };
int child_stderr[2] = { 0,0 };
@@ -252,7 +251,6 @@ static int app_exec(struct ast_channel *chan, void *data)
int gen_active = 0;
int pid;
char *argv[32];
- int argc = 1;
char *buf, *command;
FILE *child_commands = NULL;
FILE *child_errors = NULL;
@@ -263,6 +261,9 @@ static int app_exec(struct ast_channel *chan, void *data)
};
struct ivr_localuser *u = &foo;
sigset_t fullset, oldset;
+ AST_DECLARE_APP_ARGS(args,
+ AST_APP_ARG(cmd)[32];
+ );
sigfillset(&fullset);
pthread_sigmask(SIG_BLOCK, &fullset, &oldset);
@@ -270,14 +271,13 @@ static int app_exec(struct ast_channel *chan, void *data)
u->abort_current_sound = 0;
u->chan = chan;
- if (ast_strlen_zero(args)) {
+ if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "ExternalIVR requires a command to execute\n");
return -1;
}
buf = ast_strdupa(data);
-
- argc = ast_app_separate_args(buf, '|', argv, sizeof(argv) / sizeof(argv[0]));
+ AST_STANDARD_APP_ARGS(args, buf);
if (pipe(child_stdin)) {
ast_chan_log(LOG_WARNING, chan, "Could not create pipe for child input: %s\n", strerror(errno));