aboutsummaryrefslogtreecommitdiffstats
path: root/pbx.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-11 18:31:59 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-11 18:31:59 +0000
commit0a0b84d8deb680293d6dcbe15b169f4bf084d8d8 (patch)
tree5c41daa1c544d5af1e159c2fd22ea4d3cd5e0011 /pbx.c
parent39387e08ccf4896b76ad37e4aba0728fecdb1fd1 (diff)
Merged revisions 9581 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r9581 | russell | 2006-02-11 13:15:00 -0500 (Sat, 11 Feb 2006) | 2 lines now that CDR is a loadable module, don't depend on it elsewhere (issue #6460) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@9582 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rw-r--r--pbx.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/pbx.c b/pbx.c
index b25079b96..e921811a9 100644
--- a/pbx.c
+++ b/pbx.c
@@ -4649,7 +4649,7 @@ int ast_pbx_outgoing_cdr_failed(void)
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, struct ast_variable *vars, struct ast_channel **channel)
+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, struct ast_variable *vars, const char *account, struct ast_channel **channel)
{
struct ast_channel *chan;
struct async_stat *as;
@@ -4666,7 +4666,7 @@ int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout
ast_mutex_lock(&chan->lock);
}
if (chan) {
- if(chan->cdr) { /* check if the channel already has a cdr record, if not give it one */
+ if (chan->cdr) { /* check if the channel already has a cdr record, if not give it one */
ast_log(LOG_WARNING, "%s already has a call record??\n", chan->name);
} else {
chan->cdr = ast_cdr_alloc(); /* allocate a cdr for the channel */
@@ -4743,6 +4743,8 @@ int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout
ast_copy_string(chan->exten, "failed", sizeof(chan->exten));
chan->priority = 1;
ast_set_variables(chan, vars);
+ if (account)
+ ast_cdr_setaccount(chan, account);
ast_pbx_run(chan);
} else
ast_log(LOG_WARNING, "Can't allocate the channel structure, skipping execution of extension 'failed'\n");
@@ -4772,6 +4774,8 @@ int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout
as->priority = priority;
as->timeout = timeout;
ast_set_variables(chan, vars);
+ if (account)
+ ast_cdr_setaccount(chan, account);
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (ast_pthread_create(&as->p, &attr, async_wait, as)) {
@@ -4813,7 +4817,7 @@ static void *ast_pbx_run_app(void *data)
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, struct ast_variable *vars, struct ast_channel **locked_channel)
+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, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel)
{
struct ast_channel *chan;
struct async_stat *as;
@@ -4821,9 +4825,10 @@ int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout,
int res = -1, cdr_res = -1;
struct outgoing_helper oh;
pthread_attr_t attr;
-
+
memset(&oh, 0, sizeof(oh));
- oh.vars = vars;
+ oh.vars = vars;
+ oh.account = account;
if (locked_channel)
*locked_channel = NULL;
@@ -4850,6 +4855,8 @@ int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout,
ast_cdr_start(chan->cdr);
}
ast_set_variables(chan, vars);
+ if (account)
+ ast_cdr_setaccount(chan, account);
if (chan->_state == AST_STATE_UP) {
res = 0;
if (option_verbose > 3)
@@ -4929,6 +4936,8 @@ int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout,
ast_copy_string(as->appdata, appdata, sizeof(as->appdata));
as->timeout = timeout;
ast_set_variables(chan, vars);
+ if (account)
+ ast_cdr_setaccount(chan, account);
/* Start a new thread, and get something handling this channel. */
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);