Index: apps/app_forkcdr.c =================================================================== --- apps/app_forkcdr.c (revision 339503) +++ apps/app_forkcdr.c (working copy) @@ -191,6 +191,12 @@ 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 +224,6 @@ 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);