aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormartinp <martinp@f38db490-d61c-443f-a65b-d21fe96a405b>2003-10-01 21:01:31 +0000
committermartinp <martinp@f38db490-d61c-443f-a65b-d21fe96a405b>2003-10-01 21:01:31 +0000
commitef4363371f4b59d7226cf34eb3344abb97a8f83a (patch)
tree1df9b399a1b59f781fe716efc5761e9f492d9677
parent143f06cec4526c4f8f9dadb3d3533b9c77ac250c (diff)
Pass accountcode to outgoing spool call when originated with Context&Extension&Priority
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1597 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xchannel.c8
-rwxr-xr-xinclude/asterisk/channel.h2
-rwxr-xr-xinclude/asterisk/pbx.h4
-rwxr-xr-xmanager.c4
-rwxr-xr-xpbx.c4
-rwxr-xr-xpbx/pbx_spool.c8
6 files changed, 19 insertions, 11 deletions
diff --git a/channel.c b/channel.c
index e6f0e98ae..094a8a330 100755
--- a/channel.c
+++ b/channel.c
@@ -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))
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index d90be73e6..13e97da7c 100755
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -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)
diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h
index 3238ab403..23366d2eb 100755
--- a/include/asterisk/pbx.h
+++ b/include/asterisk/pbx.h
@@ -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);
diff --git a/manager.c b/manager.c
index ba33f132c..94f4628b1 100755
--- a/manager.c
+++ b/manager.c
@@ -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");
diff --git a/pbx.c b/pbx.c
index 49a3af341..528aa0fbf 100755
--- a/pbx.c
+++ b/pbx.c
@@ -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;
diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c
index d51c17e9c..638dea640 100755
--- a/pbx/pbx_spool.c
+++ b/pbx/pbx_spool.c
@@ -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);