[asterisk-commits] murf: branch group/CDRfix5 r76173 - in /team/group/CDRfix5: apps/ main/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 20 15:28:00 CDT 2007


Author: murf
Date: Fri Jul 20 15:27:59 2007
New Revision: 76173

URL: http://svn.digium.com/view/asterisk?view=rev&rev=76173
Log:
just copy the fields into the cdr-- and get rid of LOCK flag references. Nothing's locked any more

Modified:
    team/group/CDRfix5/apps/app_meetme.c
    team/group/CDRfix5/main/cdr.c
    team/group/CDRfix5/res/res_features.c

Modified: team/group/CDRfix5/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/apps/app_meetme.c?view=diff&rev=76173&r1=76172&r2=76173
==============================================================================
--- team/group/CDRfix5/apps/app_meetme.c (original)
+++ team/group/CDRfix5/apps/app_meetme.c Fri Jul 20 15:27:59 2007
@@ -1709,7 +1709,8 @@
 			ast_set_flag(chan->cdr, AST_CDR_FLAG_MAIN);
 			ast_cdr_update(chan);
 			bridge_cdr = ast_cdr_dup(chan->cdr);
-			ast_cdr_setapp(bridge_cdr, chan->appl, chan->data);
+			ast_copy_string(bridge_cdr->lastapp, chan->appl, sizeof(bridge_cdr->lastapp));
+			ast_copy_string(bridge_cdr->lastdata, chan->data, sizeof(bridge_cdr->lastdata));
 		} else {
 			/* better yet, in a xfer situation, find out why the chan cdr got zapped (pun unintentional) */
 			bridge_cdr = ast_cdr_alloc(); /* this should be really, really rare/impossible? */

Modified: team/group/CDRfix5/main/cdr.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/main/cdr.c?view=diff&rev=76173&r1=76172&r2=76173
==============================================================================
--- team/group/CDRfix5/main/cdr.c (original)
+++ team/group/CDRfix5/main/cdr.c Fri Jul 20 15:27:59 2007
@@ -450,11 +450,9 @@
 {
 	char *chan; 
 
-	if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-		chan = S_OR(cdr->channel, "<unknown>");
-		check_post(cdr);
-		cdr->start = ast_tvnow();
-	}
+	chan = S_OR(cdr->channel, "<unknown>");
+	check_post(cdr);
+	cdr->start = ast_tvnow();
 }
 
 void ast_cdr_answer(struct ast_cdr *cdr)
@@ -470,20 +468,16 @@
 void ast_cdr_busy(struct ast_cdr *cdr)
 {
 
-	if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-		check_post(cdr);
-		if (cdr->disposition < AST_CDR_BUSY)
-			cdr->disposition = AST_CDR_BUSY;
-	}
+	check_post(cdr);
+	if (cdr->disposition < AST_CDR_BUSY)
+		cdr->disposition = AST_CDR_BUSY;
 }
 
 void ast_cdr_failed(struct ast_cdr *cdr)
 {
 	check_post(cdr);
-	if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-		if (cdr->disposition < AST_CDR_FAILED)
-			cdr->disposition = AST_CDR_FAILED;
-	}
+	if (cdr->disposition < AST_CDR_FAILED)
+		cdr->disposition = AST_CDR_FAILED;
 }
 
 void ast_cdr_noanswer(struct ast_cdr *cdr)
@@ -493,10 +487,8 @@
 	chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
 	if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
 		ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
-	if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-		if (cdr->disposition < AST_CDR_NOANSWER)
-			cdr->disposition = AST_CDR_NOANSWER;
-	}
+	if (cdr->disposition < AST_CDR_NOANSWER)
+		cdr->disposition = AST_CDR_NOANSWER;
 }
 
 int ast_cdr_disposition(struct ast_cdr *cdr, int cause)
@@ -525,22 +517,19 @@
 void ast_cdr_setdestchan(struct ast_cdr *cdr, const char *chann)
 {
 	check_post(cdr);
-	if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
-		ast_copy_string(cdr->dstchannel, chann, sizeof(cdr->dstchannel));
+	ast_copy_string(cdr->dstchannel, chann, sizeof(cdr->dstchannel));
 }
 
 void ast_cdr_setapp(struct ast_cdr *cdr, char *app, char *data)
 {
-
-	if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-		check_post(cdr);
-		if (!app)
-			app = "";
-		ast_copy_string(cdr->lastapp, app, sizeof(cdr->lastapp));
-		if (!data)
-			data = "";
-		ast_copy_string(cdr->lastdata, data, sizeof(cdr->lastdata));
-	}
+	
+	check_post(cdr);
+	if (!app)
+		app = "";
+	ast_copy_string(cdr->lastapp, app, sizeof(cdr->lastapp));
+	if (!data)
+		data = "";
+	ast_copy_string(cdr->lastdata, data, sizeof(cdr->lastdata));
 }
 
 /* set cid info for one record */
@@ -565,8 +554,7 @@
 }
 int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *c)
 {
-	if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
-		set_one_cid(cdr, c);
+	set_one_cid(cdr, c);
 	return 0;
 }
 
@@ -574,24 +562,22 @@
 {
 	char *chan;
 
-	if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-		chan = S_OR(cdr->channel, "<unknown>");
-		if (!ast_strlen_zero(cdr->channel)) 
-			ast_log(LOG_WARNING, "CDR already initialized on '%s'\n", chan); 
-		ast_copy_string(cdr->channel, c->name, sizeof(cdr->channel));
-		set_one_cid(cdr, c);
-		
-		cdr->disposition = (c->_state == AST_STATE_UP) ?  AST_CDR_ANSWERED : AST_CDR_NULL;
-		cdr->amaflags = c->amaflags ? c->amaflags :  ast_default_amaflags;
-		ast_copy_string(cdr->accountcode, c->accountcode, sizeof(cdr->accountcode));
-		/* Destination information */
-		ast_copy_string(cdr->dst, S_OR(c->macroexten,c->exten), sizeof(cdr->dst));
-		ast_copy_string(cdr->dcontext, S_OR(c->macrocontext,c->context), sizeof(cdr->dcontext));
-		/* Unique call identifier */
-		ast_copy_string(cdr->uniqueid, c->uniqueid, sizeof(cdr->uniqueid));
-		/* Linked call identifier */
-		ast_copy_string(cdr->linkedid, c->linkedid, sizeof(cdr->linkedid));
-	}
+	chan = S_OR(cdr->channel, "<unknown>");
+	if (!ast_strlen_zero(cdr->channel)) 
+		ast_log(LOG_WARNING, "CDR already initialized on '%s'\n", chan); 
+	ast_copy_string(cdr->channel, c->name, sizeof(cdr->channel));
+	set_one_cid(cdr, c);
+	
+	cdr->disposition = (c->_state == AST_STATE_UP) ?  AST_CDR_ANSWERED : AST_CDR_NULL;
+	cdr->amaflags = c->amaflags ? c->amaflags :  ast_default_amaflags;
+	ast_copy_string(cdr->accountcode, c->accountcode, sizeof(cdr->accountcode));
+	/* Destination information */
+	ast_copy_string(cdr->dst, S_OR(c->macroexten,c->exten), sizeof(cdr->dst));
+	ast_copy_string(cdr->dcontext, S_OR(c->macrocontext,c->context), sizeof(cdr->dcontext));
+	/* Unique call identifier */
+	ast_copy_string(cdr->uniqueid, c->uniqueid, sizeof(cdr->uniqueid));
+	/* Linked call identifier */
+	ast_copy_string(cdr->linkedid, c->linkedid, sizeof(cdr->linkedid));
 	return 0;
 }
 
@@ -644,9 +630,7 @@
 	struct ast_cdr *cdr = chan->cdr;
 
 	ast_string_field_set(chan, accountcode, account);
-	if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-		ast_copy_string(cdr->accountcode, chan->accountcode, sizeof(cdr->accountcode));
-	}
+	ast_copy_string(cdr->accountcode, chan->accountcode, sizeof(cdr->accountcode));
 	return 0;
 }
 
@@ -655,9 +639,7 @@
 	struct ast_cdr *cdr;
 	int newflag = ast_cdr_amaflags2int(flag);
 	if (newflag) {
-		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-			cdr->amaflags = newflag;
-		}
+		cdr->amaflags = newflag;
 	}
 
 	return 0;
@@ -741,30 +723,28 @@
 		ast_copy_flags(&flags, _flags, AST_FLAGS_ALL);
 
 	/* Detach if post is requested */
-	if (ast_test_flag(&flags, AST_CDR_FLAG_LOCKED) || !ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-		if (ast_test_flag(&flags, AST_CDR_FLAG_POSTED)) {
-			ast_cdr_end(cdr);
-			if ((dup = ast_cdr_dup(cdr))) {
-				ast_cdr_detach(dup);
-			}
-			ast_set_flag(cdr, AST_CDR_FLAG_POSTED);
-		}
-		
-		/* clear variables */
-		if (!ast_test_flag(&flags, AST_CDR_FLAG_KEEP_VARS)) {
-			ast_cdr_free_vars(cdr, 0);
-		}
-		
-		/* Reset to initial state */
-		ast_clear_flag(cdr, AST_FLAGS_ALL);	
-		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_NULL;
-	}
+	if (ast_test_flag(&flags, AST_CDR_FLAG_POSTED)) {
+		ast_cdr_end(cdr);
+		if ((dup = ast_cdr_dup(cdr))) {
+			ast_cdr_detach(dup);
+		}
+		ast_set_flag(cdr, AST_CDR_FLAG_POSTED);
+	}
+	
+	/* clear variables */
+	if (!ast_test_flag(&flags, AST_CDR_FLAG_KEEP_VARS)) {
+		ast_cdr_free_vars(cdr, 0);
+	}
+	
+	/* Reset to initial state */
+	ast_clear_flag(cdr, AST_FLAGS_ALL);	
+	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_NULL;
 }
 
 void ast_cdr_sortof_reset(struct ast_cdr *cdr, struct ast_flags *_flags)
@@ -775,18 +755,16 @@
 		ast_copy_flags(&flags, _flags, AST_FLAGS_ALL);
 
 	/* Detach if post is requested */
-	if (ast_test_flag(&flags, AST_CDR_FLAG_LOCKED) || !ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
 		
-		/* Reset to initial state */
-		ast_clear_flag(cdr, AST_FLAGS_ALL);	
-		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_NULL;
-	}
+	/* Reset to initial state */
+	ast_clear_flag(cdr, AST_FLAGS_ALL);	
+	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_NULL;
 }
 
 

Modified: team/group/CDRfix5/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/res/res_features.c?view=diff&rev=76173&r1=76172&r2=76173
==============================================================================
--- team/group/CDRfix5/res/res_features.c (original)
+++ team/group/CDRfix5/res/res_features.c Fri Jul 20 15:27:59 2007
@@ -1704,7 +1704,8 @@
 			ast_set_flag(chan->cdr, AST_CDR_FLAG_MAIN);
 			ast_cdr_update(chan);
 			bridge_cdr = ast_cdr_dup(chan->cdr);
-			ast_cdr_setapp(bridge_cdr, chan->appl, chan->data);
+			ast_copy_string(bridge_cdr->lastapp, chan->appl, sizeof(bridge_cdr->lastapp));
+			ast_copy_string(bridge_cdr->lastdata, chan->data, sizeof(bridge_cdr->lastdata));
 		} else {
 			/* better yet, in a xfer situation, find out why the chan cdr got zapped (pun unintentional) */
 			bridge_cdr = ast_cdr_alloc(); /* this should be really, really rare/impossible? */




More information about the asterisk-commits mailing list