[asterisk-commits] mnicholson: branch mnicholson/oldcdr r192629 - /team/mnicholson/oldcdr/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 5 17:53:29 CDT 2009


Author: mnicholson
Date: Tue May  5 17:53:26 2009
New Revision: 192629

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=192629
Log:
moved cdr posting logic to cdr.c from ast_hangup() in channel.c and made the
code a little more verbose

Modified:
    team/mnicholson/oldcdr/main/cdr.c
    team/mnicholson/oldcdr/main/channel.c

Modified: team/mnicholson/oldcdr/main/cdr.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/mnicholson/oldcdr/main/cdr.c?view=diff&rev=192629&r1=192628&r2=192629
==============================================================================
--- team/mnicholson/oldcdr/main/cdr.c (original)
+++ team/mnicholson/oldcdr/main/cdr.c Tue May  5 17:53:26 2009
@@ -1010,13 +1010,35 @@
 	struct ast_cdr_beitem *i;
 
 	for ( ; cdr ; cdr = cdr->next) {
+		chan = S_OR(cdr->channel, "<unknown>");
+
+		if (ast_test_flag(cdr, AST_CDR_FLAG_POST_DISABLED)) {
+			ast_log(LOG_DEBUG, "[%s] CDR not posted because AST_CDR_FLAG_POST_DISABLED set\n", chan);
+			continue;
+		}
+
+		if (ast_test_flag(cdr, AST_CDR_FLAG_BRIDGED)) {
+			ast_log(LOG_DEBUG, "[%s] CDR not posted because AST_CDR_FLAG_BRIDGED set\n", chan);
+			continue;
+		}
+
+		if (cdr->disposition == AST_CDR_NULL) {
+			ast_log(LOG_DEBUG, "[%s] CDR not posted because disposition is NULL\n", chan);
+			continue;
+		}
+
+		if (ast_test_flag(cdr, AST_CDR_FLAG_DIALED)) {
+			ast_log(LOG_DEBUG, "[%s] CDR not posted because AST_CDR_FLAG_DIALED is set\n", chan);
+			continue;
+		}
+
 		if (!unanswered && cdr->disposition < AST_CDR_ANSWERED && (ast_strlen_zero(cdr->channel) || ast_strlen_zero(cdr->dstchannel))) {
 			/* For people, who don't want to see unanswered single-channel events */
 			ast_set_flag(cdr, AST_CDR_FLAG_POST_DISABLED);
+			ast_log(LOG_DEBUG, "[%s] CDR not posted because disposition < ANSWERED\n", chan);
 			continue;
 		}
 
-		chan = S_OR(cdr->channel, "<unknown>");
 		check_post(cdr);
 		if (option_verbose > 1 && ast_tvzero(cdr->end))
 			ast_verbose(VERBOSE_PREFIX_2 "CDR on channel '%s' lacks end\n", chan);

Modified: team/mnicholson/oldcdr/main/channel.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/mnicholson/oldcdr/main/channel.c?view=diff&rev=192629&r1=192628&r2=192629
==============================================================================
--- team/mnicholson/oldcdr/main/channel.c (original)
+++ team/mnicholson/oldcdr/main/channel.c Tue May  5 17:53:26 2009
@@ -1537,14 +1537,9 @@
 			ast_cause2str(chan->hangupcause)
 			);
 
-	if (chan->cdr && !ast_test_flag(chan->cdr, AST_CDR_FLAG_BRIDGED) && 
-		!ast_test_flag(chan->cdr, AST_CDR_FLAG_POST_DISABLED) && 
-	    (chan->cdr->disposition != AST_CDR_NULL || ast_test_flag(chan->cdr, AST_CDR_FLAG_DIALED))) {
-			
-		ast_cdr_end(chan->cdr);
-		ast_cdr_detach(chan->cdr);
-		chan->cdr = NULL;
-	}
+	ast_cdr_end(chan->cdr);
+	ast_cdr_detach(chan->cdr);
+	chan->cdr = NULL;
 	
 	ast_channel_free(chan);
 




More information about the asterisk-commits mailing list