Index: pbx.c =================================================================== RCS file: /usr/cvsroot/asterisk/pbx.c,v retrieving revision 1.198 diff -u -r1.198 pbx.c --- pbx.c 21 Jan 2005 07:06:24 -0000 1.198 +++ pbx.c 27 Jan 2005 18:14:52 -0000 @@ -4340,7 +4340,7 @@ return 0; /* success */ } -int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, const char *variable, const char *account) +int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, const char *variable, const char *account, struct ast_channel **channel) { struct ast_channel *chan; struct async_stat *as; @@ -4352,6 +4552,8 @@ if (sync) { LOAD_OH(oh); chan = __ast_request_and_dial(type, format, data, timeout, reason, cid_num, cid_name, &oh); + if (channel) + *channel = chan; if (chan) { if (account) @@ -4440,6 +4442,8 @@ return -1; memset(as, 0, sizeof(struct async_stat)); chan = ast_request_and_dial(type, format, data, timeout, reason, cid_num, cid_name); + if (channel) + *channel = chan; if (!chan) { free(as); return -1; @@ -4492,7 +4496,7 @@ return NULL; } -int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, const char *variable, const char *account) +int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, const char *variable, const char *account, struct ast_channel **channel) { struct ast_channel *chan; struct async_stat *as; @@ -4505,6 +4509,8 @@ return -1; if (sync) { chan = ast_request_and_dial(type, format, data, timeout, reason, cid_num, cid_name); + if (channel) + *channel = chan; if (chan) { if (account) @@ -4585,6 +4591,8 @@ return -1; memset(as, 0, sizeof(struct async_stat)); chan = ast_request_and_dial(type, format, data, timeout, reason, cid_num, cid_name); + if (channel) + *channel = chan; if (!chan) { free(as); return -1; Index: manager.c =================================================================== RCS file: /usr/cvsroot/asterisk/manager.c,v retrieving revision 1.82 diff -u -r1.82 manager.c --- manager.c 25 Jan 2005 06:10:19 -0000 1.82 +++ manager.c 27 Jan 2005 18:14:52 -0000 @@ -818,16 +818,18 @@ struct fast_originate_helper *in = data; int res; int reason = 0; + struct ast_channel *chan = NULL; + if (!ast_strlen_zero(in->app)) { res = ast_pbx_outgoing_app(in->tech, AST_FORMAT_SLINEAR, in->data, in->timeout, in->app, in->appdata, &reason, 1, !ast_strlen_zero(in->cid_num) ? in->cid_num : NULL, !ast_strlen_zero(in->cid_name) ? in->cid_name : NULL, - in->variable, in->account); + in->variable, in->account, &chan); } else { res = ast_pbx_outgoing_exten(in->tech, AST_FORMAT_SLINEAR, in->data, in->timeout, in->context, in->exten, in->priority, &reason, 1, !ast_strlen_zero(in->cid_num) ? in->cid_num : NULL, !ast_strlen_zero(in->cid_name) ? in->cid_name : NULL, - in->variable, in->account); + in->variable, in->account, &chan); } if (!res) manager_event(EVENT_FLAG_CALL, @@ -840,16 +842,18 @@ "%s" "Channel: %s/%s\r\n" "Context: %s\r\n" - "Exten: %s\r\n", - in->idtext, in->tech, in->data, in->context, in->exten); + "Exten: %s\r\n" + "Uniqueid: %s\r\n", + in->idtext, in->tech, in->data, in->context, in->exten, chan ? chan->uniqueid : ""); else manager_event(EVENT_FLAG_CALL, "OriginateFailure", "%s" "Channel: %s/%s\r\n" "Context: %s\r\n" - "Exten: %s\r\n", - in->idtext, in->tech, in->data, in->context, in->exten); + "Exten: %s\r\n" + "Uniqueid: %s\r\n", + in->idtext, in->tech, in->data, in->context, in->exten, chan ? chan->uniqueid : ""); free(in); return NULL; @@ -959,10 +963,10 @@ } } } else if (!ast_strlen_zero(app)) { - res = ast_pbx_outgoing_app(tech, AST_FORMAT_SLINEAR, data, to, app, appdata, &reason, 0, l, n, variable, account); + res = ast_pbx_outgoing_app(tech, AST_FORMAT_SLINEAR, data, to, app, appdata, &reason, 0, l, n, variable, account, NULL); } else { if (exten && context && pi) - res = ast_pbx_outgoing_exten(tech, AST_FORMAT_SLINEAR, data, to, context, exten, pi, &reason, 0, l, n, variable, account); + res = ast_pbx_outgoing_exten(tech, AST_FORMAT_SLINEAR, data, to, context, exten, pi, &reason, 0, l, n, variable, account, NULL); else { astman_send_error(s, m, "Originate with 'Exten' requires 'Context' and 'Priority'"); return 0; Index: include/asterisk/pbx.h =================================================================== RCS file: /usr/cvsroot/asterisk/include/asterisk/pbx.h,v retrieving revision 1.39 diff -u -r1.39 pbx.h --- include/asterisk/pbx.h 15 Jan 2005 23:48:12 -0000 1.39 +++ include/asterisk/pbx.h 27 Jan 2005 18:14:52 -0000 @@ -524,11 +524,11 @@ /* Synchronously or asynchronously make an outbound call and send it to a particular extension */ -int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, const char *variable, const char *account ); +int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, const char *variable, const char *account, struct ast_channel **chan); /* Synchronously or asynchronously make an outbound call and send it to a particular application with given extension */ -int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, const char *variable, const char *account); +int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, const char *variable, const char *account, struct ast_channel **chan); /* Functions for returning values from structures */ const char *ast_get_context_name(struct ast_context *con); Index: pbx/pbx_spool.c =================================================================== RCS file: /usr/cvsroot/asterisk/pbx/pbx_spool.c,v retrieving revision 1.18 diff -u -r1.18 pbx_spool.c --- pbx/pbx_spool.c 21 Jan 2005 07:06:25 -0000 1.18 +++ pbx/pbx_spool.c 27 Jan 2005 18:14:52 -0000 @@ -224,11 +224,11 @@ if (!ast_strlen_zero(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->cid_num, o->cid_name, o->variable, o->account); + 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->cid_num, o->cid_name, o->variable, o->account, NULL); } 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); - res = ast_pbx_outgoing_exten(o->tech, AST_FORMAT_SLINEAR, o->dest, o->waittime * 1000, o->context, o->exten, o->priority, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->variable, o->account); + res = ast_pbx_outgoing_exten(o->tech, AST_FORMAT_SLINEAR, o->dest, o->waittime * 1000, o->context, o->exten, o->priority, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->variable, o->account, NULL); } if (res) { ast_log(LOG_NOTICE, "Call failed to go through, reason %d\n", reason);