diff options
-rwxr-xr-x | include/asterisk/pbx.h | 2 | ||||
-rwxr-xr-x | manager.c | 2 | ||||
-rwxr-xr-x | pbx.c | 7 | ||||
-rwxr-xr-x | 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 ae45e5e73..c2c4878b9 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); @@ -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 ); } @@ -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 67682702d..3c256956f 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); |