From aaf83cc86fc9bde43a4d245ca12eeadd8b2c8d05 Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Mon, 25 Aug 2003 22:40:14 +0000 Subject: [PATCH] Merge james's patch (bug #7) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1432 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- include/asterisk/pbx.h | 2 +- manager.c | 2 +- pbx.c | 7 ++++++- pbx/pbx_spool.c | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h index ae45e5e73e..c2c4878b97 100755 --- a/include/asterisk/pbx.h +++ b/include/asterisk/pbx.h @@ -484,7 +484,7 @@ int ast_pbx_outgoing_exten(char *type, int format, void *data, int timeout, char /* Synchronously or asynchronously make an outbound call and send it to a particular application with given extension */ -int ast_pbx_outgoing_app(char *type, int format, void *data, int timeout, char *app, char *appdata, int *reason, int sync, char *callerid); +int ast_pbx_outgoing_app(char *type, int format, void *data, int timeout, char *app, char *appdata, int *reason, int sync, char *callerid, char *variable); /* Functions for returning values from structures */ char *ast_get_context_name(struct ast_context *con); diff --git a/manager.c b/manager.c index f441829c56..a46e435054 100755 --- a/manager.c +++ b/manager.c @@ -435,7 +435,7 @@ static int action_originate(struct mansession *s, struct message *m) *data = '\0'; data++; if (strlen(app)) { - res = ast_pbx_outgoing_app(tech, AST_FORMAT_SLINEAR, data, to, app, appdata, &reason, 0, strlen(callerid) ? callerid : NULL ); + res = ast_pbx_outgoing_app(tech, AST_FORMAT_SLINEAR, data, to, app, appdata, &reason, 0, strlen(callerid) ? callerid : NULL, NULL ); } else { res = ast_pbx_outgoing_exten(tech, AST_FORMAT_SLINEAR, data, to, context, exten, pi, &reason, 0, strlen(callerid) ? callerid : NULL, NULL ); } diff --git a/pbx.c b/pbx.c index b500868e0a..bd3e3a1b6f 100755 --- a/pbx.c +++ b/pbx.c @@ -3855,17 +3855,22 @@ static void *ast_pbx_run_app(void *data) return NULL; } -int ast_pbx_outgoing_app(char *type, int format, void *data, int timeout, char *app, char *appdata, int *reason, int sync, char *callerid) +int ast_pbx_outgoing_app(char *type, int format, void *data, int timeout, char *app, char *appdata, int *reason, int sync, char *callerid, char *variable) { struct ast_channel *chan; struct async_stat *as; struct app_tmp *tmp; + char *var, *vartmp; int res = -1; if (!app || !strlen(app)) return -1; if (sync) { chan = ast_request_and_dial(type, format, data, timeout, reason, callerid); if (chan) { + vartmp = variable; + while( (var = strtok_r(NULL, "|", &vartmp)) ) { + pbx_builtin_setvar( chan, var ); + } if (chan->_state == AST_STATE_UP) { res = 0; if (option_verbose > 3) diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c index 67682702d4..3c256956f5 100755 --- a/pbx/pbx_spool.c +++ b/pbx/pbx_spool.c @@ -185,7 +185,7 @@ static void *attempt_thread(void *data) if (strlen(o->app)) { if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Attempting call on %s/%s for application %s(%s) (Retry %d)\n", o->tech, o->dest, o->app, o->data, o->retries); - res = ast_pbx_outgoing_app(o->tech, AST_FORMAT_SLINEAR, o->dest, o->waittime * 1000, o->app, o->data, &reason, 2 /* wait to finish */, o->callerid); + res = ast_pbx_outgoing_app(o->tech, AST_FORMAT_SLINEAR, o->dest, o->waittime * 1000, o->app, o->data, &reason, 2 /* wait to finish */, o->callerid, o->variable); } else { if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Attempting call on %s/%s for %s@%s:%d (Retry %d)\n", o->tech, o->dest, o->exten, o->context,o->priority, o->retries);