mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
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
This commit is contained in:
@@ -1509,12 +1509,14 @@ struct ast_channel *__ast_request_and_dial(char *type, int format, void *data, i
|
|||||||
while( (var = strtok_r(NULL, "|", &tmp)) ) {
|
while( (var = strtok_r(NULL, "|", &tmp)) ) {
|
||||||
pbx_builtin_setvar( chan, var );
|
pbx_builtin_setvar( chan, var );
|
||||||
} /* /JDG */
|
} /* /JDG */
|
||||||
if (*oh->context)
|
if (oh->context && *oh->context)
|
||||||
strncpy(chan->context, oh->context, sizeof(chan->context) - 1);
|
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);
|
strncpy(chan->exten, oh->exten, sizeof(chan->exten) - 1);
|
||||||
if (*oh->callerid)
|
if (oh->callerid && *oh->callerid)
|
||||||
ast_set_callerid(chan, oh->callerid, 1);
|
ast_set_callerid(chan, oh->callerid, 1);
|
||||||
|
if (oh->account && *oh->account)
|
||||||
|
ast_cdr_setaccount(chan, oh->account);
|
||||||
chan->priority = oh->priority;
|
chan->priority = oh->priority;
|
||||||
}
|
}
|
||||||
if (callerid && strlen(callerid))
|
if (callerid && strlen(callerid))
|
||||||
|
@@ -238,6 +238,7 @@ struct chanmon;
|
|||||||
oh.priority = priority; \
|
oh.priority = priority; \
|
||||||
oh.callerid = callerid; \
|
oh.callerid = callerid; \
|
||||||
oh.variable = variable; \
|
oh.variable = variable; \
|
||||||
|
oh.account = account; \
|
||||||
}
|
}
|
||||||
|
|
||||||
struct outgoing_helper {
|
struct outgoing_helper {
|
||||||
@@ -246,6 +247,7 @@ struct outgoing_helper {
|
|||||||
int priority;
|
int priority;
|
||||||
char *callerid;
|
char *callerid;
|
||||||
char *variable;
|
char *variable;
|
||||||
|
char *account;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define AST_CDR_TRANSFER (1 << 0)
|
#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
|
/* Synchronously or asynchronously make an outbound call and send it to a
|
||||||
particular extension */
|
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
|
/* Synchronously or asynchronously make an outbound call and send it to a
|
||||||
particular application with given extension */
|
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 */
|
/* Functions for returning values from structures */
|
||||||
char *ast_get_context_name(struct ast_context *con);
|
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 = '\0';
|
||||||
data++;
|
data++;
|
||||||
if (strlen(app)) {
|
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 {
|
} 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)
|
if (!res)
|
||||||
astman_send_ack(s, m, "Originate successfully queued");
|
astman_send_ack(s, m, "Originate successfully queued");
|
||||||
|
4
pbx.c
4
pbx.c
@@ -3783,7 +3783,7 @@ static void *async_wait(void *data)
|
|||||||
return NULL;
|
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 ast_channel *chan;
|
||||||
struct async_stat *as;
|
struct async_stat *as;
|
||||||
@@ -3888,7 +3888,7 @@ static void *ast_pbx_run_app(void *data)
|
|||||||
return NULL;
|
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 ast_channel *chan;
|
||||||
struct async_stat *as;
|
struct async_stat *as;
|
||||||
|
@@ -69,6 +69,8 @@ struct outgoing {
|
|||||||
|
|
||||||
/* Channel variables */
|
/* Channel variables */
|
||||||
char variable[10*256];
|
char variable[10*256];
|
||||||
|
/* Account code */
|
||||||
|
char account[256];
|
||||||
|
|
||||||
/* Maximum length of call */
|
/* Maximum length of call */
|
||||||
int maxlen;
|
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, c, sizeof(o->variable) - strlen(o->variable) - 1);
|
||||||
strncat(o->variable, "|", 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 {
|
} else {
|
||||||
ast_log(LOG_WARNING, "Unknown keyword '%s' at line %d of %s\n", buf, lineno, fn);
|
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 (strlen(o->app)) {
|
||||||
if (option_verbose > 2)
|
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);
|
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 {
|
} else {
|
||||||
if (option_verbose > 2)
|
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);
|
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) {
|
if (res) {
|
||||||
ast_log(LOG_NOTICE, "Call failed to go through, reason %d\n", reason);
|
ast_log(LOG_NOTICE, "Call failed to go through, reason %d\n", reason);
|
||||||
|
Reference in New Issue
Block a user