mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 00:04:53 +00:00
Finished up a previous fix to overcome a compiler warning; the app NoCDR() has been updated to mark the channel CDR as POST_DISABLED instead of destroying the CDR; this way its flags are propagated thru a bridge and the CDR is actually dropped. The cases where only one channel in a bridge has a CDR was cleaned up.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@61136 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -51,8 +51,7 @@ static int nocdr_exec(struct ast_channel *chan, void *data)
|
|||||||
u = ast_module_user_add(chan);
|
u = ast_module_user_add(chan);
|
||||||
|
|
||||||
if (chan->cdr) {
|
if (chan->cdr) {
|
||||||
ast_cdr_free(chan->cdr);
|
ast_set_flag(chan->cdr, AST_CDR_FLAG_POST_DISABLED);
|
||||||
chan->cdr = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_module_user_remove(u);
|
ast_module_user_remove(u);
|
||||||
|
13
main/cdr.c
13
main/cdr.c
@@ -88,7 +88,7 @@ static pthread_t cdr_thread = AST_PTHREADT_NULL;
|
|||||||
#define BATCH_SCHEDULER_ONLY_DEFAULT 0
|
#define BATCH_SCHEDULER_ONLY_DEFAULT 0
|
||||||
#define BATCH_SAFE_SHUTDOWN_DEFAULT 1
|
#define BATCH_SAFE_SHUTDOWN_DEFAULT 1
|
||||||
|
|
||||||
static int enabled;
|
static int enabled; /*! Is the CDR subsystem enabled ? */
|
||||||
static int batchmode;
|
static int batchmode;
|
||||||
static int batchsize;
|
static int batchsize;
|
||||||
static int batchtime;
|
static int batchtime;
|
||||||
@@ -596,6 +596,17 @@ void ast_cdr_merge(struct ast_cdr *to, struct ast_cdr *from)
|
|||||||
}
|
}
|
||||||
/* flags, varsead, ? */
|
/* flags, varsead, ? */
|
||||||
cdr_merge_vars(from, to);
|
cdr_merge_vars(from, to);
|
||||||
|
|
||||||
|
if (ast_test_flag(from, AST_CDR_FLAG_KEEP_VARS))
|
||||||
|
ast_set_flag(to, AST_CDR_FLAG_KEEP_VARS);
|
||||||
|
if (ast_test_flag(from, AST_CDR_FLAG_POSTED))
|
||||||
|
ast_set_flag(to, AST_CDR_FLAG_POSTED);
|
||||||
|
if (ast_test_flag(from, AST_CDR_FLAG_LOCKED))
|
||||||
|
ast_set_flag(to, AST_CDR_FLAG_LOCKED);
|
||||||
|
if (ast_test_flag(from, AST_CDR_FLAG_CHILD))
|
||||||
|
ast_set_flag(to, AST_CDR_FLAG_CHILD);
|
||||||
|
if (ast_test_flag(from, AST_CDR_FLAG_POST_DISABLED))
|
||||||
|
ast_set_flag(to, AST_CDR_FLAG_POST_DISABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ast_cdr_start(struct ast_cdr *cdr)
|
void ast_cdr_start(struct ast_cdr *cdr)
|
||||||
|
@@ -1436,8 +1436,6 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
|
|||||||
}
|
}
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
ast_log(LOG_WARNING, "Bridge failed on channels %s and %s\n", chan->name, peer->name);
|
ast_log(LOG_WARNING, "Bridge failed on channels %s and %s\n", chan->name, peer->name);
|
||||||
chan->cdr = NULL;
|
|
||||||
peer->cdr = NULL;
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1532,10 +1530,10 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
|
|||||||
/* arrange the cdrs */
|
/* arrange the cdrs */
|
||||||
bridge_cdr = ast_cdr_alloc();
|
bridge_cdr = ast_cdr_alloc();
|
||||||
if (bridge_cdr) {
|
if (bridge_cdr) {
|
||||||
ast_log(LOG_NOTICE,"merging the bridged CDRs\n");
|
|
||||||
ast_cdr_init(bridge_cdr,chan); /* seems more logicaller to use the destination as a base, but, really, it's random */
|
|
||||||
if (chan->cdr && peer->cdr) { /* both of them? merge */
|
if (chan->cdr && peer->cdr) { /* both of them? merge */
|
||||||
|
ast_cdr_init(bridge_cdr,chan); /* seems more logicaller to use the destination as a base, but, really, it's random */
|
||||||
ast_cdr_start(bridge_cdr); /* now is the time to start */
|
ast_cdr_start(bridge_cdr); /* now is the time to start */
|
||||||
|
|
||||||
/* absorb the channel cdr */
|
/* absorb the channel cdr */
|
||||||
ast_cdr_merge(bridge_cdr, chan->cdr);
|
ast_cdr_merge(bridge_cdr, chan->cdr);
|
||||||
ast_cdr_discard(chan->cdr); /* no posting these guys */
|
ast_cdr_discard(chan->cdr); /* no posting these guys */
|
||||||
@@ -1548,27 +1546,17 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
|
|||||||
} else if (chan->cdr) {
|
} else if (chan->cdr) {
|
||||||
/* take the cdr from the channel - literally */
|
/* take the cdr from the channel - literally */
|
||||||
ast_cdr_init(bridge_cdr,chan);
|
ast_cdr_init(bridge_cdr,chan);
|
||||||
if (chan->cdr->disposition==AST_CDR_ANSWERED) {
|
/* absorb this data */
|
||||||
ast_cdr_end(chan->cdr);
|
ast_cdr_merge(bridge_cdr, chan->cdr);
|
||||||
ast_cdr_detach(chan->cdr); /* post the existing cdr, we will be starting a fresh new cdr presently */
|
ast_cdr_discard(chan->cdr); /* no posting these guys */
|
||||||
} else {
|
|
||||||
/* absorb this data */
|
|
||||||
ast_cdr_merge(bridge_cdr, chan->cdr);
|
|
||||||
ast_cdr_discard(chan->cdr); /* no posting these guys */
|
|
||||||
}
|
|
||||||
chan->cdr = bridge_cdr; /* make this available to the rest of the world via the chan while the call is in progress */
|
chan->cdr = bridge_cdr; /* make this available to the rest of the world via the chan while the call is in progress */
|
||||||
} else if (peer->cdr) {
|
} else if (peer->cdr) {
|
||||||
/* take the cdr from the peer - literally */
|
/* take the cdr from the peer - literally */
|
||||||
ast_cdr_init(bridge_cdr,peer);
|
ast_cdr_init(bridge_cdr,peer);
|
||||||
if (peer->cdr->disposition == AST_CDR_ANSWERED) {
|
/* absorb this data */
|
||||||
ast_cdr_end(peer->cdr);
|
ast_cdr_merge(bridge_cdr, peer->cdr);
|
||||||
ast_cdr_detach(peer->cdr); /* post the existing cdr, we will be starting a fresh new cdr presently */
|
ast_cdr_discard(peer->cdr); /* no posting these guys */
|
||||||
} else {
|
peer->cdr = NULL;
|
||||||
/* absorb this data */
|
|
||||||
ast_cdr_merge(bridge_cdr, peer->cdr);
|
|
||||||
ast_cdr_discard(peer->cdr); /* no posting these guys */
|
|
||||||
peer->cdr = NULL;
|
|
||||||
}
|
|
||||||
peer->cdr = bridge_cdr; /* make this available to the rest of the world via the chan while the call is in progress */
|
peer->cdr = bridge_cdr; /* make this available to the rest of the world via the chan while the call is in progress */
|
||||||
} else {
|
} else {
|
||||||
/* make up a new cdr */
|
/* make up a new cdr */
|
||||||
|
Reference in New Issue
Block a user