From: Jonathan Rose Date: Fri, 13 Apr 2012 16:04:22 +0000 (+0000) Subject: Make ForkCDR e option not set end time of the newly forked CDR log X-Git-Tag: 10.5.0-rc1~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa9f0bf2a419f7d726027c941c2b1fac4e2f3d41;p=thirdparty%2Fasterisk.git Make ForkCDR e option not set end time of the newly forked CDR log Prior to this patch, ForkCDR's e option would immediately set the end time of the forked CDR to that of the CDR that is being terminated. This resulted in the new CDR's end time being roughly the same as it's beginning time (which is in turn roughly the same as the original's end time). (closes issue ASTERISK-19164) Reported by: Steve Davies Patches: cdr_fork_end.v10.patch uploaded by Steve Davies (license 5012) ........ Merged revisions 362082 from http://svn.asterisk.org/svn/asterisk/branches/1.8 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@362084 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_forkcdr.c b/apps/app_forkcdr.c index ffeeca8ece..d4fc2affc0 100644 --- a/apps/app_forkcdr.c +++ b/apps/app_forkcdr.c @@ -191,6 +191,14 @@ static void ast_cdr_fork(struct ast_channel *chan, struct ast_flags optflags, ch if (!(newcdr = ast_cdr_dup_unique(cdr))) return; + /* + * End the original CDR if requested BEFORE appending the new CDR + * otherwise we incorrectly end the new CDR also. + */ + if (ast_test_flag(&optflags, OPT_ENDCDR)) { + ast_cdr_end(cdr); + } + ast_cdr_append(cdr, newcdr); if (!ast_test_flag(&optflags, OPT_NORESET)) @@ -218,9 +226,6 @@ static void ast_cdr_fork(struct ast_channel *chan, struct ast_flags optflags, ch if (ast_test_flag(&optflags, OPT_RESETDEST)) newcdr->dstchannel[0] = 0; - if (ast_test_flag(&optflags, OPT_ENDCDR)) - ast_cdr_end(cdr); - if (ast_test_flag(&optflags, OPT_ANSLOCK)) ast_set_flag(cdr, AST_CDR_FLAG_ANSLOCKED);