[svn-commits] kmoore: branch kmoore/bridge_construction-cel_bridging r390434 - /team/kmoore...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jun 4 15:06:37 CDT 2013


Author: kmoore
Date: Tue Jun  4 15:06:36 2013
New Revision: 390434

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390434
Log:
Address David's comments

Modified:
    team/kmoore/bridge_construction-cel_bridging/main/cel.c

Modified: team/kmoore/bridge_construction-cel_bridging/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_bridging/main/cel.c?view=diff&rev=390434&r1=390433&r2=390434
==============================================================================
--- team/kmoore/bridge_construction-cel_bridging/main/cel.c (original)
+++ team/kmoore/bridge_construction-cel_bridging/main/cel.c Tue Jun  4 15:06:36 2013
@@ -1165,15 +1165,6 @@
 	cel_channel_linkedid_change,
 };
 
-static int snapshots_share_capability(
-	struct ast_bridge_snapshot *old_snapshot,
-	struct ast_bridge_snapshot *new_snapshot,
-	uint32_t capability)
-{
-	return ((old_snapshot->capabilities | capability)
-		&& (new_snapshot->capabilities | capability));
-}
-
 static void update_bridge_primary(struct ast_channel_snapshot *snapshot)
 {
 	RAII_VAR(struct bridge_assoc *, assoc, NULL, ao2_cleanup);
@@ -1196,6 +1187,7 @@
 {
 	struct bridge_assoc *assoc = obj;
 	char *bridge_id = arg;
+	ast_assert(flags & OBJ_KEY);
 	if (!strcmp(bridge_id, assoc->bridge_id)) {
 		return CMP_MATCH;
 	}
@@ -1205,13 +1197,13 @@
 static struct bridge_assoc *find_bridge_primary_by_bridge_id(const char *bridge_id)
 {
 	char *dup_id = ast_strdupa(bridge_id);
-	return ao2_callback(bridge_primaries, 0, bridge_match_cb, dup_id);
+	return ao2_callback(bridge_primaries, OBJ_KEY, bridge_match_cb, dup_id);
 }
 
 static void clear_bridge_primary(const char *bridge_id)
 {
 	char *dup_id = ast_strdupa(bridge_id);
-	ao2_callback(bridge_primaries, OBJ_NODATA | OBJ_UNLINK | OBJ_MULTIPLE, bridge_match_cb, dup_id);
+	ao2_callback(bridge_primaries, OBJ_KEY | OBJ_NODATA | OBJ_UNLINK | OBJ_MULTIPLE, bridge_match_cb, dup_id);
 }
 
 static void cel_snapshot_update_cb(void *data, struct stasis_subscription *sub,
@@ -1232,6 +1224,7 @@
 		for (i = 0; i < ARRAY_LEN(cel_channel_monitors); ++i) {
 			cel_channel_monitors[i](old_snapshot, new_snapshot);
 		}
+	} else if (ast_bridge_snapshot_type() == update->type) {
 		RAII_VAR(struct bridge_assoc *, assoc, NULL, ao2_cleanup);
 		struct ast_bridge_snapshot *old_snapshot;
 		struct ast_bridge_snapshot *new_snapshot;
@@ -1251,13 +1244,6 @@
 		}
 
 		if (old_snapshot->capabilities == new_snapshot->capabilities) {
-			return;
-		}
-
-		if (snapshots_share_capability(old_snapshot, new_snapshot, AST_BRIDGE_CAPABILITY_HOLDING)
-			|| snapshots_share_capability(old_snapshot, new_snapshot, AST_BRIDGE_CAPABILITY_MULTIMIX)
-			|| snapshots_share_capability(old_snapshot, new_snapshot, AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_NATIVE)
-			) {
 			return;
 		}
 
@@ -1343,7 +1329,7 @@
 			add_bridge_primary(latest_primary, snapshot->uniqueid, chan_snapshot->name);
 			report_event_snapshot(latest_primary, AST_CEL_BRIDGE_START, NULL, NULL, chan_snapshot->name);
 		}
-	} else if (snapshot->capabilities | AST_BRIDGE_CAPABILITY_MULTIMIX) {
+	} else if (snapshot->capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX) {
 		report_event_snapshot(chan_snapshot, AST_CEL_CONF_ENTER, NULL, NULL, NULL);
 	}
 }
@@ -1357,8 +1343,7 @@
 	struct ast_bridge_snapshot *snapshot = blob->bridge;
 	struct ast_channel_snapshot *chan_snapshot = blob->channel;
 
-	if ((snapshot->capabilities | AST_BRIDGE_CAPABILITY_1TO1MIX)
-		|| (snapshot->capabilities | AST_BRIDGE_CAPABILITY_NATIVE)) {
+	if (snapshot->capabilities & (AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_NATIVE)) {
 		RAII_VAR(struct bridge_assoc *, assoc,
 			find_bridge_primary_by_bridge_id(snapshot->uniqueid),
 			ao2_cleanup);
@@ -1377,7 +1362,7 @@
 			remove_bridge_primary(assoc->primary_snapshot->uniqueid);
 			return;
 		}
-	} else if (snapshot->capabilities | AST_BRIDGE_CAPABILITY_MULTIMIX) {
+	} else if (snapshot->capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX) {
 		report_event_snapshot(chan_snapshot, AST_CEL_CONF_EXIT, NULL, NULL, NULL);
 	}
 }
@@ -1440,7 +1425,7 @@
 	cel_state_topic = NULL;
 	cel_channel_forwarder = stasis_unsubscribe_and_join(cel_channel_forwarder);
 	cel_bridge_forwarder = stasis_unsubscribe_and_join(cel_bridge_forwarder);
-	cel_parking_forwarder = stasis_unsubscribe(cel_parking_forwarder);
+	cel_parking_forwarder = stasis_unsubscribe_and_join(cel_parking_forwarder);
 	ao2_cleanup(linkedids);
 	linkedids = NULL;
 	ast_cli_unregister(&cli_status);
@@ -1545,7 +1530,7 @@
 		return -1;
 	}
 
-	ast_register_atexit(ast_cel_engine_term);
+	ast_register_cleanup(ast_cel_engine_term);
 
 	return 0;
 }




More information about the svn-commits mailing list