[Asterisk-cvs] asterisk cdr.c,1.21,1.22 pbx.c,1.153,1.154

anthm at lists.digium.com anthm at lists.digium.com
Fri Sep 24 17:29:38 CDT 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv2704

Modified Files:
	cdr.c pbx.c 
Log Message:
add app_forkcdr

Index: cdr.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cdr.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- cdr.c	10 Sep 2004 13:40:56 -0000	1.21
+++ cdr.c	24 Sep 2004 21:32:56 -0000	1.22
@@ -499,25 +499,29 @@
 	}
 }
 
-void ast_cdr_reset(struct ast_cdr *cdr, int post)
+void ast_cdr_reset(struct ast_cdr *cdr, int flags)
 {
 	while (cdr) {
 		/* Post if requested */
-		if (post) {
-			ast_cdr_end(cdr);
-			ast_cdr_post(cdr);
+		if (ast_cdr_compare_flag(flags,AST_CDR_FLAG_LOCKED) || !ast_cdr_has_flag(cdr,AST_CDR_FLAG_LOCKED)) {
+			if (ast_cdr_compare_flag(flags,AST_CDR_FLAG_POSTED)) {
+				ast_cdr_end(cdr);
+				ast_cdr_post(cdr);
+			}
+			/* Reset to initial state */
+			cdr->flags=0;
+			memset(&cdr->start, 0, sizeof(cdr->start));
+			memset(&cdr->end, 0, sizeof(cdr->end));
+			memset(&cdr->answer, 0, sizeof(cdr->answer));
+			cdr->billsec = 0;
+			cdr->duration = 0;
+			ast_cdr_start(cdr);
+			cdr->disposition = AST_CDR_NOANSWER;
 		}
-		/* Reset to initial state */
-		cdr->flags=0;
-		memset(&cdr->start, 0, sizeof(cdr->start));
-		memset(&cdr->end, 0, sizeof(cdr->end));
-		memset(&cdr->answer, 0, sizeof(cdr->answer));
-		cdr->billsec = 0;
-		cdr->duration = 0;
-		ast_cdr_start(cdr);
-		cdr->disposition = AST_CDR_NOANSWER;
+			
 		cdr = cdr->next;
 	}
+	
 }
 
 void ast_cdr_append(struct ast_cdr *cdr, struct ast_cdr *newcdr) {

Index: pbx.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx.c,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -d -r1.153 -r1.154
--- pbx.c	14 Sep 2004 22:35:53 -0000	1.153
+++ pbx.c	24 Sep 2004 21:32:56 -0000	1.154
@@ -4387,11 +4387,16 @@
 
 static int pbx_builtin_resetcdr(struct ast_channel *chan, void *data)
 {
+	int flags = 0;
 	/* Reset the CDR as specified */
-	if (data)
-		ast_cdr_reset(chan->cdr, strchr((char *)data, 'w') ? 1 : 0);
-	else
-		ast_cdr_reset(chan->cdr, 0);
+	if(data) {
+		if(strchr((char *)data, 'w'))
+			flags |= AST_CDR_FLAG_POSTED;
+		if(strchr((char *)data, 'a'))
+			flags |= AST_CDR_FLAG_LOCKED;
+	}
+
+	ast_cdr_reset(chan->cdr, flags);
 	return 0;
 }
 




More information about the svn-commits mailing list