[asterisk-commits] cdr.c: Defer misc checks. (asterisk[15])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 12 08:02:29 CDT 2017


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/6752 )

Change subject: cdr.c: Defer misc checks.
......................................................................

cdr.c: Defer misc checks.

Try to defer some checks until needed in case there is an early exit.

Change-Id: Ibc6b34c38a4f60ad4f9b67984b7d070a07257064
---
M main/cdr.c
1 file changed, 11 insertions(+), 9 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/main/cdr.c b/main/cdr.c
index 1ea2445..d34503d 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -1935,6 +1935,10 @@
 	if (!peer && !caller) {
 		return;
 	}
+	if (filter_channel_snapshot(peer) || (caller && filter_channel_snapshot(caller))) {
+		return;
+	}
+
 	dial_status_blob = ast_json_object_get(ast_multi_channel_blob_get_json(payload), "dialstatus");
 	if (dial_status_blob) {
 		dial_status = ast_json_string_get(dial_status_blob);
@@ -1946,10 +1950,6 @@
 			peer ? peer->name : "(none)",
 			(unsigned int)stasis_message_timestamp(message)->tv_sec,
 			(unsigned int)stasis_message_timestamp(message)->tv_usec);
-
-	if (filter_channel_snapshot(peer) || (caller && filter_channel_snapshot(caller))) {
-		return;
-	}
 
 	/* Figure out who is running this show */
 	if (caller) {
@@ -2080,8 +2080,6 @@
 	struct stasis_cache_update *update = stasis_message_data(message);
 	struct ast_channel_snapshot *old_snapshot;
 	struct ast_channel_snapshot *new_snapshot;
-	const char *uniqueid;
-	const char *name;
 	struct cdr_object *it_cdr;
 
 	ast_assert(update != NULL);
@@ -2089,8 +2087,6 @@
 
 	old_snapshot = stasis_message_data(update->old_snapshot);
 	new_snapshot = stasis_message_data(update->new_snapshot);
-	uniqueid = new_snapshot ? new_snapshot->uniqueid : old_snapshot->uniqueid;
-	name = new_snapshot ? new_snapshot->name : old_snapshot->name;
 
 	if (filter_channel_cache_message(old_snapshot, new_snapshot)) {
 		return;
@@ -2104,11 +2100,17 @@
 		cdr->is_root = 1;
 		ao2_link(active_cdrs_by_channel, cdr);
 	} else {
+		const char *uniqueid;
+
+		uniqueid = new_snapshot ? new_snapshot->uniqueid : old_snapshot->uniqueid;
 		cdr = ao2_find(active_cdrs_by_channel, uniqueid, OBJ_SEARCH_KEY);
 	}
 
 	/* Handle Party A */
 	if (!cdr) {
+		const char *name;
+
+		name = new_snapshot ? new_snapshot->name : old_snapshot->name;
 		ast_log(AST_LOG_WARNING, "No CDR for channel %s\n", name);
 		ast_assert(0);
 	} else {
@@ -4318,7 +4320,7 @@
 	RAII_VAR(struct module_config *, old_mod_cfg, ao2_global_obj_ref(module_configs), ao2_cleanup);
 	RAII_VAR(struct module_config *, mod_cfg, NULL, ao2_cleanup);
 
-	if (process_config(1)) {
+	if (!old_mod_cfg || process_config(1)) {
 		return -1;
 	}
 

-- 
To view, visit https://gerrit.asterisk.org/6752
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibc6b34c38a4f60ad4f9b67984b7d070a07257064
Gerrit-Change-Number: 6752
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20171012/abbd0b31/attachment-0001.html>


More information about the asterisk-commits mailing list