[asterisk-commits] kharwell: branch 1.8 r408747 - /branches/1.8/apps/app_forkcdr.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Feb 21 14:18:51 CST 2014


Author: kharwell
Date: Fri Feb 21 14:18:45 2014
New Revision: 408747

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=408747
Log:
app_forkcdr: ForkCDR v option does not keep CDR variables for subsequent records

When the 'v' option is specified to ForkCDR application, AST_CDR_FLAG_KEEP_VARS
flag is set only for the first CDR in the chain. So ForkCDR works fine with this
option only once. After the second and further calls to ForkCDR, CDR variables
get cleared on all CDRs besides the first one and moved to the newly forked CDR.
It always sets the KEEP_VARS flag on the first CDR in the chain, instead of the
most recent CDR which is used as a base to fork a new CDR.

This patch sets KEEP_VARS flag on the most recent CDR on the stack (the CDR used
for forking).

(closes issue ASTERISK-23260)
Reported by: zvision
Patches:
     app_forkcdr.diff uploaded by zvision (license 5755)

Modified:
    branches/1.8/apps/app_forkcdr.c

Modified: branches/1.8/apps/app_forkcdr.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/apps/app_forkcdr.c?view=diff&rev=408747&r1=408746&r2=408747
==============================================================================
--- branches/1.8/apps/app_forkcdr.c (original)
+++ branches/1.8/apps/app_forkcdr.c Fri Feb 21 14:18:45 2014
@@ -239,13 +239,14 @@
 {
 	int res = 0;
 	char *argcopy = NULL;
+	struct ast_cdr *cdr;
 	struct ast_flags flags = {0};
 	char *opts[OPT_ARG_ARRAY_SIZE];
 	AST_DECLARE_APP_ARGS(arglist,
 		AST_APP_ARG(options);
 	);
 
-	if (!chan->cdr) {
+	if (!(cdr = chan->cdr)) {
 		ast_log(LOG_WARNING, "Channel does not have a CDR\n");
 		return 0;
 	}
@@ -261,7 +262,10 @@
 
 	if (!ast_strlen_zero(data)) {
 		int keepvars = ast_test_flag(&flags, OPT_KEEPVARS) ? 1 : 0;
-		ast_set2_flag(chan->cdr, keepvars, AST_CDR_FLAG_KEEP_VARS);
+		while (cdr->next) {
+			cdr = cdr->next;
+		}
+		ast_set2_flag(cdr, keepvars, AST_CDR_FLAG_KEEP_VARS);
 	}
 	
 	ast_cdr_fork(chan, flags, opts[OPT_ARG_VARSET]);




More information about the asterisk-commits mailing list