[asterisk-commits] murf: branch 1.4 r82444 - /branches/1.4/main/cdr.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 14 16:19:28 CDT 2007


Author: murf
Date: Fri Sep 14 16:19:27 2007
New Revision: 82444

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82444
Log:
closes issue #10668; thanks to arkadia for his patch; had to leave out the bit about ending the previous cdr in the fork; it would destroy current implementations.

Modified:
    branches/1.4/main/cdr.c

Modified: branches/1.4/main/cdr.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/cdr.c?view=diff&rev=82444&r1=82443&r2=82444
==============================================================================
--- branches/1.4/main/cdr.c (original)
+++ branches/1.4/main/cdr.c Fri Sep 14 16:19:27 2007
@@ -311,20 +311,22 @@
 	}
 
 	for (; cdr; cdr = recur ? cdr->next : NULL) {
-		headp = &cdr->varshead;
-		AST_LIST_TRAVERSE_SAFE_BEGIN(headp, newvariable, entries) {
-			if (!strcasecmp(ast_var_name(newvariable), name)) {
-				/* there is already such a variable, delete it */
-				AST_LIST_REMOVE_CURRENT(headp, entries);
-				ast_var_delete(newvariable);
-				break;
+		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+			headp = &cdr->varshead;
+			AST_LIST_TRAVERSE_SAFE_BEGIN(headp, newvariable, entries) {
+				if (!strcasecmp(ast_var_name(newvariable), name)) {
+					/* there is already such a variable, delete it */
+					AST_LIST_REMOVE_CURRENT(headp, entries);
+					ast_var_delete(newvariable);
+					break;
+				}
 			}
-		}
-		AST_LIST_TRAVERSE_SAFE_END;
-
-		if (value) {
-			newvariable = ast_var_assign(name, value);
-			AST_LIST_INSERT_HEAD(headp, newvariable, entries);
+			AST_LIST_TRAVERSE_SAFE_END;
+
+			if (value) {
+				newvariable = ast_var_assign(name, value);
+				AST_LIST_INSERT_HEAD(headp, newvariable, entries);
+			}
 		}
 	}
 
@@ -693,11 +695,13 @@
 {
 
 	for (; cdr; cdr = cdr->next) {
-		check_post(cdr);
-		if (cdr->disposition < AST_CDR_ANSWERED)
-			cdr->disposition = AST_CDR_ANSWERED;
-		if (ast_tvzero(cdr->answer))
-			cdr->answer = ast_tvnow();
+		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+			check_post(cdr);
+			if (cdr->disposition < AST_CDR_ANSWERED)
+				cdr->disposition = AST_CDR_ANSWERED;
+			if (ast_tvzero(cdr->answer))
+				cdr->answer = ast_tvnow();
+		}
 	}
 }
 
@@ -842,15 +846,17 @@
 void ast_cdr_end(struct ast_cdr *cdr)
 {
 	for ( ; cdr ; cdr = cdr->next) {
-		check_post(cdr);
-		if (ast_tvzero(cdr->end))
-			cdr->end = ast_tvnow();
-		if (ast_tvzero(cdr->start)) {
-			ast_log(LOG_WARNING, "CDR on channel '%s' has not started\n", S_OR(cdr->channel, "<unknown>"));
-			cdr->disposition = AST_CDR_FAILED;
-		} else
-			cdr->duration = cdr->end.tv_sec - cdr->start.tv_sec;
-		cdr->billsec = ast_tvzero(cdr->answer) ? 0 : cdr->end.tv_sec - cdr->answer.tv_sec;
+		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+			check_post(cdr);
+			if (ast_tvzero(cdr->end))
+				cdr->end = ast_tvnow();
+			if (ast_tvzero(cdr->start)) {
+				ast_log(LOG_WARNING, "CDR on channel '%s' has not started\n", S_OR(cdr->channel, "<unknown>"));
+				cdr->disposition = AST_CDR_FAILED;
+			} else
+				cdr->duration = cdr->end.tv_sec - cdr->start.tv_sec;
+			cdr->billsec = ast_tvzero(cdr->answer) ? 0 : cdr->end.tv_sec - cdr->answer.tv_sec;
+		}
 	}
 }
 




More information about the asterisk-commits mailing list