[asterisk-commits] murf: trunk r82457 - in /trunk: ./ main/cdr.c

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


Author: murf
Date: Fri Sep 14 16:30:44 2007
New Revision: 82457

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82457
Log:
Merged revisions 82444 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r82444 | murf | 2007-09-14 15:19:27 -0600 (Fri, 14 Sep 2007) | 1 line

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:
    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=82457&r1=82456&r2=82457
==============================================================================
--- trunk/main/cdr.c (original)
+++ trunk/main/cdr.c Fri Sep 14 16:30:44 2007
@@ -308,20 +308,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);
+			}
 		}
 	}
 
@@ -691,11 +693,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();
+		}
 	}
 }
 
@@ -841,15 +845,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