Pass accountcode to outgoing spool call when originated with Context&Extension&Priority

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1597 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.0
Martin Pycko 22 years ago
parent c0dde4ac5b
commit b239d0de27

@ -1509,12 +1509,14 @@ struct ast_channel *__ast_request_and_dial(char *type, int format, void *data, i
while( (var = strtok_r(NULL, "|", &tmp)) ) {
pbx_builtin_setvar( chan, var );
} /* /JDG */
if (*oh->context)
if (oh->context && *oh->context)
strncpy(chan->context, oh->context, sizeof(chan->context) - 1);
if (*oh->exten)
if (oh->exten && *oh->exten)
strncpy(chan->exten, oh->exten, sizeof(chan->exten) - 1);
if (*oh->callerid)
if (oh->callerid && *oh->callerid)
ast_set_callerid(chan, oh->callerid, 1);
if (oh->account && *oh->account)
ast_cdr_setaccount(chan, oh->account);
chan->priority = oh->priority;
}
if (callerid && strlen(callerid))

@ -238,6 +238,7 @@ struct chanmon;
oh.priority = priority; \
oh.callerid = callerid; \
oh.variable = variable; \
oh.account = account; \
}
struct outgoing_helper {
@ -246,6 +247,7 @@ struct outgoing_helper {
int priority;
char *callerid;
char *variable;
char *account;
};
#define AST_CDR_TRANSFER (1 << 0)

@ -480,11 +480,11 @@ int ast_async_goto_by_name(char *chan, char *context, char *exten, int priority)
/* Synchronously or asynchronously make an outbound call and send it to a
particular extension */
int ast_pbx_outgoing_exten(char *type, int format, void *data, int timeout, char *context, char *exten, int priority, int *reason, int sync, char *callerid, char *variable );
int ast_pbx_outgoing_exten(char *type, int format, void *data, int timeout, char *context, char *exten, int priority, int *reason, int sync, char *callerid, char *variable, char *account );
/* 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, char *variable);
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, char *account);
/* Functions for returning values from structures */
char *ast_get_context_name(struct ast_context *con);

@ -448,9 +448,9 @@ 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, NULL );
res = ast_pbx_outgoing_app(tech, AST_FORMAT_SLINEAR, data, to, app, appdata, &reason, 0, strlen(callerid) ? callerid : NULL, NULL, NULL);
} else {
res = ast_pbx_outgoing_exten(tech, AST_FORMAT_SLINEAR, data, to, context, exten, pi, &reason, 0, strlen(callerid) ? callerid : NULL, NULL );
res = ast_pbx_outgoing_exten(tech, AST_FORMAT_SLINEAR, data, to, context, exten, pi, &reason, 0, strlen(callerid) ? callerid : NULL, NULL, NULL);
}
if (!res)
astman_send_ack(s, m, "Originate successfully queued");

@ -3783,7 +3783,7 @@ static void *async_wait(void *data)
return NULL;
}
int ast_pbx_outgoing_exten(char *type, int format, void *data, int timeout, char *context, char *exten, int priority, int *reason, int sync, char *callerid, char *variable)
int ast_pbx_outgoing_exten(char *type, int format, void *data, int timeout, char *context, char *exten, int priority, int *reason, int sync, char *callerid, char *variable, char *account)
{
struct ast_channel *chan;
struct async_stat *as;
@ -3888,7 +3888,7 @@ 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, char *variable)
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, char *account)
{
struct ast_channel *chan;
struct async_stat *as;

@ -69,6 +69,8 @@ struct outgoing {
/* Channel variables */
char variable[10*256];
/* Account code */
char account[256];
/* Maximum length of call */
int maxlen;
@ -159,6 +161,8 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f)
strncat(o->variable, c, sizeof(o->variable) - strlen(o->variable) - 1);
strncat(o->variable, "|", sizeof(o->variable) - strlen(o->variable) - 1);
} else if (!strcasecmp(buf, "account")) {
strncpy(o->account, c, sizeof(o->account) - 1);
} else {
ast_log(LOG_WARNING, "Unknown keyword '%s' at line %d of %s\n", buf, lineno, fn);
}
@ -185,11 +189,11 @@ 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, o->variable);
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, o->account);
} 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->callerid, o->variable );
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->callerid, o->variable, o->account);
}
if (res) {
ast_log(LOG_NOTICE, "Call failed to go through, reason %d\n", reason);

Loading…
Cancel
Save