[asterisk-commits] mmichelson: branch mmichelson/bridged_channel r395811 - in /team/mmichelson/b...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 30 17:16:17 CDT 2013


Author: mmichelson
Date: Tue Jul 30 17:16:14 2013
New Revision: 395811

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395811
Log:
Remove ast_bridged_channel function calls from several places.


Modified:
    team/mmichelson/bridged_channel/funcs/func_channel.c
    team/mmichelson/bridged_channel/main/abstract_jb.c
    team/mmichelson/bridged_channel/main/channel.c
    team/mmichelson/bridged_channel/main/channel_internal_api.c
    team/mmichelson/bridged_channel/main/features.c

Modified: team/mmichelson/bridged_channel/funcs/func_channel.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/bridged_channel/funcs/func_channel.c?view=diff&rev=395811&r1=395810&r2=395811
==============================================================================
--- team/mmichelson/bridged_channel/funcs/func_channel.c (original)
+++ team/mmichelson/bridged_channel/funcs/func_channel.c Tue Jul 30 17:16:14 2013
@@ -495,10 +495,10 @@
 		}
 		ast_channel_unlock(chan);
 	} else if (!strcasecmp(data, "peer")) {
-		struct ast_channel *p;
-
-		ast_channel_lock(chan);
-		p = ast_bridged_channel(chan);
+		RAII_VAR(struct ast_channel *, p, NULL, ast_channel_cleanup);
+
+		ast_channel_lock(chan);
+		p = ast_channel_bridge_peer(chan);
 		if (p || ast_channel_tech(chan)) /* dummy channel? if so, we hid the peer name in the language */
 			ast_copy_string(buf, (p ? ast_channel_name(p) : ""), len);
 		else {

Modified: team/mmichelson/bridged_channel/main/abstract_jb.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/bridged_channel/main/abstract_jb.c?view=diff&rev=395811&r1=395810&r2=395811
==============================================================================
--- team/mmichelson/bridged_channel/main/abstract_jb.c (original)
+++ team/mmichelson/bridged_channel/main/abstract_jb.c Tue Jul 30 17:16:14 2013
@@ -409,7 +409,6 @@
 	struct ast_jb_conf *jbconf = &jb->conf;
 	const struct ast_jb_impl *jbimpl = jb->impl;
 	void *jbobj;
-	struct ast_channel *bridged;
 	long now;
 	char logfile_pathname[20 + AST_JB_IMPL_NAME_SIZE + 2*AST_CHANNEL_NAME + 1];
 	char name1[AST_CHANNEL_NAME], name2[AST_CHANNEL_NAME], *tmp;
@@ -442,14 +441,15 @@
 
 	/* Create a frame log file */
 	if (ast_test_flag(jbconf, AST_JB_LOG)) {
+		RAII_VAR(struct ast_channel *, bridged, ast_channel_bridge_peer(chan), ast_channel_cleanup);
 		char safe_logfile[30] = "/tmp/logfile-XXXXXX";
 		int safe_fd;
+
 		snprintf(name2, sizeof(name2), "%s", ast_channel_name(chan));
 		if ((tmp = strchr(name2, '/'))) {
 			*tmp = '#';
 		}
 
-		bridged = ast_bridged_channel(chan);
 		/* We should always have bridged chan if a jitterbuffer is in use */
 		ast_assert(bridged != NULL);
 

Modified: team/mmichelson/bridged_channel/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/bridged_channel/main/channel.c?view=diff&rev=395811&r1=395810&r2=395811
==============================================================================
--- team/mmichelson/bridged_channel/main/channel.c (original)
+++ team/mmichelson/bridged_channel/main/channel.c Tue Jul 30 17:16:14 2013
@@ -2606,15 +2606,11 @@
 
 void ast_set_hangupsource(struct ast_channel *chan, const char *source, int force)
 {
-	struct ast_channel *bridge;
+	RAII_VAR(struct ast_channel *, bridge, ast_channel_bridge_peer(chan), ast_channel_cleanup);
 
 	ast_channel_lock(chan);
 	if (force || ast_strlen_zero(ast_channel_hangupsource(chan))) {
 		ast_channel_hangupsource_set(chan, source);
-	}
-	bridge = ast_bridged_channel(chan);
-	if (bridge) {
-		ast_channel_ref(bridge);
 	}
 	ast_channel_unlock(chan);
 
@@ -2624,7 +2620,6 @@
 			ast_channel_hangupsource_set(bridge, source);
 		}
 		ast_channel_unlock(bridge);
-		ast_channel_unref(bridge);
 	}
 }
 
@@ -3942,7 +3937,7 @@
 					ast_debug(1, "Ignoring answer on an inbound call!\n");
 					ast_frfree(f);
 					f = &ast_null_frame;
-				} else if (prestate == AST_STATE_UP && ast_bridged_channel(chan)) {
+				} else if (prestate == AST_STATE_UP && ast_channel_is_bridged(chan)) {
 					ast_debug(1, "Dropping duplicate answer!\n");
 					ast_frfree(f);
 					f = &ast_null_frame;
@@ -6766,8 +6761,7 @@
 
 	ast_debug(1, "Done Masquerading %s (%d)\n", ast_channel_name(original), ast_channel_state(original));
 
-	if ((bridged = ast_bridged_channel(original))) {
-		ast_channel_ref(bridged);
+	if ((bridged = ast_channel_bridge_peer(original))) {
 		ast_channel_unlock(original);
 		ast_indicate(bridged, AST_CONTROL_SRCCHANGE);
 		ast_channel_unref(bridged);

Modified: team/mmichelson/bridged_channel/main/channel_internal_api.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/bridged_channel/main/channel_internal_api.c?view=diff&rev=395811&r1=395810&r2=395811
==============================================================================
--- team/mmichelson/bridged_channel/main/channel_internal_api.c (original)
+++ team/mmichelson/bridged_channel/main/channel_internal_api.c Tue Jul 30 17:16:14 2013
@@ -289,7 +289,6 @@
 int ast_channel_data_add_structure(struct ast_data *tree,
 	struct ast_channel *chan, int add_bridged)
 {
-	struct ast_channel *bc;
 	struct ast_data *data_bridged;
 	struct ast_data *data_cdr;
 	struct ast_data *data_flags;
@@ -308,7 +307,7 @@
 	ast_data_add_structure(ast_channel, tree, chan);
 
 	if (add_bridged) {
-		bc = ast_bridged_channel(chan);
+		RAII_VAR(struct ast_channel *, bc, ast_channel_bridge_peer(chan), ast_channel_cleanup);
 		if (bc) {
 			data_bridged = ast_data_add_node(tree, "bridged");
 			if (!data_bridged) {

Modified: team/mmichelson/bridged_channel/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/bridged_channel/main/features.c?view=diff&rev=395811&r1=395810&r2=395811
==============================================================================
--- team/mmichelson/bridged_channel/main/features.c (original)
+++ team/mmichelson/bridged_channel/main/features.c Tue Jul 30 17:16:14 2013
@@ -1247,7 +1247,7 @@
 		 * channel from the other side of the local.
 		 */
 		if (!strcasecmp(ast_channel_tech(peer)->type, "Local")) {
-			struct ast_channel *tmpchan, *base_peer;
+			struct ast_channel *tmpchan;
 			char other_side[AST_CHANNEL_NAME];
 			char *c;
 
@@ -1256,11 +1256,11 @@
 				*++c = '1';
 			}
 			if ((tmpchan = ast_channel_get_by_name(other_side))) {
-				ast_channel_lock(tmpchan);
-				if ((base_peer = ast_bridged_channel(tmpchan))) {
+				RAII_VAR(struct ast_channel *, base_peer, ast_channel_bridge_peer(tmpchan), ast_channel_cleanup);
+
+				if (base_peer) {
 					ast_copy_string(pu->peername, ast_channel_name(base_peer), sizeof(pu->peername));
 				}
-				ast_channel_unlock(tmpchan);
 				tmpchan = ast_channel_unref(tmpchan);
 			}
 		} else {




More information about the asterisk-commits mailing list