[asterisk-commits] murf: trunk r61659 - in /trunk: ./ main/cdr.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Apr 13 14:22:02 MST 2007
Author: murf
Date: Fri Apr 13 16:22:01 2007
New Revision: 61659
URL: http://svn.digium.com/view/asterisk?view=rev&rev=61659
Log:
Merged revisions 61658 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r61658 | murf | 2007-04-13 15:17:20 -0600 (Fri, 13 Apr 2007) | 1 line
This is a fix to the way CDR merge handles the data that results from ForkCDR.
........
Modified:
trunk/ (props changed)
trunk/main/cdr.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/main/cdr.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cdr.c?view=diff&rev=61659&r1=61658&r2=61659
==============================================================================
--- trunk/main/cdr.c (original)
+++ trunk/main/cdr.c Fri Apr 13 16:22:01 2007
@@ -512,6 +512,8 @@
void ast_cdr_merge(struct ast_cdr *to, struct ast_cdr *from)
{
+ struct ast_cdr *tcdr;
+
if (!to || !from)
return;
@@ -587,15 +589,15 @@
ast_copy_string(to->dst, from->dst, sizeof(to->dst));
from->dst[0] = 0; /* theft */
}
- if (!to->amaflags && from->amaflags) {
+ if (ast_test_flag(from, AST_CDR_FLAG_LOCKED) || (!to->amaflags && from->amaflags)) {
to->amaflags = from->amaflags;
from->amaflags = 0; /* theft */
}
- if (ast_strlen_zero(to->accountcode) && !ast_strlen_zero(from->accountcode)) {
+ if (ast_test_flag(from, AST_CDR_FLAG_LOCKED) || (ast_strlen_zero(to->accountcode) && !ast_strlen_zero(from->accountcode))) {
ast_copy_string(to->accountcode, from->accountcode, sizeof(to->accountcode));
from->accountcode[0] = 0; /* theft */
}
- if (ast_strlen_zero(to->userfield) && !ast_strlen_zero(from->userfield)) {
+ if (ast_test_flag(from, AST_CDR_FLAG_LOCKED) || (ast_strlen_zero(to->userfield) && !ast_strlen_zero(from->userfield))) {
ast_copy_string(to->userfield, from->userfield, sizeof(to->userfield));
from->userfield[0] = 0; /* theft */
}
@@ -612,6 +614,16 @@
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);
+
+ /* last, but not least, we need to merge any forked CDRs to the 'to' cdr */
+ while (from->next) {
+ /* just rip 'em off the 'from' and insert them on the 'to' */
+ tcdr = from->next;
+ from->next = tcdr->next;
+ tcdr->next = NULL;
+ /* tcdr is now ripped from the current list; */
+ ast_cdr_append(to, tcdr);
+ }
}
void ast_cdr_start(struct ast_cdr *cdr)
@@ -817,8 +829,9 @@
ast_string_field_set(chan, accountcode, account);
for ( ; cdr ; cdr = cdr->next) {
- if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
+ if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
ast_copy_string(cdr->accountcode, chan->accountcode, sizeof(cdr->accountcode));
+ }
}
return 0;
}
More information about the asterisk-commits
mailing list