[asterisk-commits] mjordan: trunk r410862 - in /trunk: ./ main/cdr.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 18 10:28:48 CDT 2014


Author: mjordan
Date: Tue Mar 18 10:28:45 2014
New Revision: 410862

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=410862
Log:
cdr: Add asserts for when we don't know about a CDR for a channel

In the CDR core, every channel should either be filtered out (due to being an
'internal' channel used as an implementation detail, such as playing media
back into a bridge) or it should get a CDR. Even if that CDR ends up being
discarded, we still give the channel a CDR in case we end up needing it. If we
hit a situation where a channel does not have a CDR, we should blow up in
-dev-mode. Asserts are appropriate for that.

This patch adds those asserts, as they would have quickly caught the error
fixed by r410814.
........

Merged revisions 410861 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/main/cdr.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/cdr.c?view=diff&rev=410862&r1=410861&r2=410862
==============================================================================
--- trunk/main/cdr.c (original)
+++ trunk/main/cdr.c Tue Mar 18 10:28:45 2014
@@ -1936,6 +1936,7 @@
 
 	if (!cdr) {
 		ast_log(AST_LOG_WARNING, "No CDR for channel %s\n", caller ? caller->name : peer->name);
+		ast_assert(0);
 		return;
 	}
 
@@ -2087,6 +2088,7 @@
 	}
 	if (!cdr) {
 		ast_log(AST_LOG_WARNING, "No CDR for channel %s\n", name);
+		ast_assert(0);
 	} else {
 		ao2_lock(cdr);
 		if (new_snapshot) {
@@ -2212,6 +2214,7 @@
 
 	if (!cdr) {
 		ast_log(AST_LOG_WARNING, "No CDR for channel %s\n", channel->name);
+		ast_assert(0);
 		return;
 	}
 
@@ -2509,6 +2512,7 @@
 
 	if (!cdr) {
 		ast_log(AST_LOG_WARNING, "No CDR for channel %s\n", channel->name);
+		ast_assert(0);
 		return;
 	}
 
@@ -2559,6 +2563,7 @@
 	cdr = ao2_find(active_cdrs_by_channel, channel->uniqueid, OBJ_KEY);
 	if (!cdr) {
 		ast_log(AST_LOG_WARNING, "No CDR for channel %s\n", channel->name);
+		ast_assert(0);
 		return;
 	}
 




More information about the asterisk-commits mailing list