[asterisk-commits] file: branch file/bridge_native r386842 - in /team/file/bridge_native: apps/ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 29 09:09:42 CDT 2013


Author: file
Date: Mon Apr 29 09:09:38 2013
New Revision: 386842

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386842
Log:
Incorporate review feedback from Mark and Richard.

Modified:
    team/file/bridge_native/apps/app_chanspy.c
    team/file/bridge_native/apps/app_mixmonitor.c
    team/file/bridge_native/bridges/bridge_native_rtp.c
    team/file/bridge_native/channels/chan_gulp.c
    team/file/bridge_native/channels/chan_h323.c
    team/file/bridge_native/channels/chan_jingle.c
    team/file/bridge_native/channels/chan_mgcp.c
    team/file/bridge_native/channels/chan_motif.c
    team/file/bridge_native/channels/chan_sip.c
    team/file/bridge_native/channels/chan_skinny.c
    team/file/bridge_native/channels/chan_unistim.c
    team/file/bridge_native/include/asterisk/rtp_engine.h
    team/file/bridge_native/main/bridging.c
    team/file/bridge_native/main/rtp_engine.c

Modified: team/file/bridge_native/apps/app_chanspy.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/apps/app_chanspy.c?view=diff&rev=386842&r1=386841&r2=386842
==============================================================================
--- team/file/bridge_native/apps/app_chanspy.c (original)
+++ team/file/bridge_native/apps/app_chanspy.c Mon Apr 29 09:09:38 2013
@@ -482,7 +482,6 @@
 static int start_spying(struct ast_autochan *autochan, const char *spychan_name, struct ast_audiohook *audiohook)
 {
 	int res = 0;
-	struct ast_channel *peer = NULL;
 
 	ast_log(LOG_NOTICE, "Attaching %s to %s\n", spychan_name, ast_channel_name(autochan->chan));
 
@@ -490,9 +489,7 @@
 	res = ast_audiohook_attach(autochan->chan, audiohook);
 
 	if (!res) {
-		if (ast_test_flag(ast_channel_flags(autochan->chan), AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(autochan->chan))) {
-			ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
-		} else if (ast_channel_internal_bridge(autochan->chan)) {
+		if (ast_channel_internal_bridge(autochan->chan)) {
 			ast_softhangup(autochan->chan, AST_SOFTHANGUP_UNBRIDGE);
 		}
 	}

Modified: team/file/bridge_native/apps/app_mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/apps/app_mixmonitor.c?view=diff&rev=386842&r1=386841&r2=386842
==============================================================================
--- team/file/bridge_native/apps/app_mixmonitor.c (original)
+++ team/file/bridge_native/apps/app_mixmonitor.c Mon Apr 29 09:09:38 2013
@@ -411,7 +411,6 @@
 
 static int startmon(struct ast_channel *chan, struct ast_audiohook *audiohook) 
 {
-	struct ast_channel *peer = NULL;
 	int res = 0;
 
 	if (!chan)
@@ -420,9 +419,7 @@
 	ast_audiohook_attach(chan, audiohook);
 
 	if (!res) {
-		if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan))) {
-			ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
-		} else if (ast_channel_internal_bridge(chan)) {
+		if (ast_channel_internal_bridge(chan)) {
 			ast_softhangup(chan, AST_SOFTHANGUP_UNBRIDGE);
 		}
 	}

Modified: team/file/bridge_native/bridges/bridge_native_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/bridges/bridge_native_rtp.c?view=diff&rev=386842&r1=386841&r2=386842
==============================================================================
--- team/file/bridge_native/bridges/bridge_native_rtp.c (original)
+++ team/file/bridge_native/bridges/bridge_native_rtp.c Mon Apr 29 09:09:38 2013
@@ -45,6 +45,7 @@
 #include "asterisk/bridging_technology.h"
 #include "asterisk/frame.h"
 #include "asterisk/rtp_engine.h"
+#include "asterisk/audiohook.h"
 
 /*! \brief Forward declarations for frame hook usage */
 static int native_rtp_bridge_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
@@ -76,14 +77,16 @@
 /*! \brief Internal helper function which checks whether the channels are compatible with our native bridging */
 static int native_rtp_bridge_capable(struct ast_channel *chan)
 {
-	if (ast_channel_monitor(chan) || ast_channel_audiohooks(chan) || !ast_framehook_list_is_empty(ast_channel_framehooks(chan))) {
+	if (ast_channel_monitor(chan) || (ast_channel_audiohooks(chan) &&
+		!ast_audiohook_write_list_empty(ast_channel_audiohooks(chan))) ||
+		!ast_framehook_list_is_empty(ast_channel_framehooks(chan))) {
 		return 0;
 	} else {
 		return 1;
 	}
 }
 
-/*! \brief Internal helper function which gets aspects of the channels */
+/*! \brief Internal helper function which gets all RTP information (glue and instances) relating to the given channels */
 static enum ast_rtp_glue_result native_rtp_bridge_get(struct ast_channel *c0, struct ast_channel *c1, struct ast_rtp_glue **glue0,
 	struct ast_rtp_glue **glue1, struct ast_rtp_instance **instance0, struct ast_rtp_instance **instance1,
 	struct ast_rtp_instance **vinstance0, struct ast_rtp_instance **vinstance1)
@@ -132,7 +135,7 @@
 
 	/* If any sort of bridge is forbidden just completely bail out and go back to generic bridging */
 	if (audio_glue0_res == AST_RTP_GLUE_RESULT_FORBID || (c1 && audio_glue1_res == AST_RTP_GLUE_RESULT_FORBID)) {
-		return 0;
+		return AST_RTP_GLUE_RESULT_FORBID;
 	}
 
 	return audio_glue0_res;
@@ -183,7 +186,7 @@
 
 	if (ao2_container_count(c1->features->dtmf_hooks) && ast_rtp_instance_dtmf_mode_get(instance1)) {
 		ast_debug(1, "Bridge '%s' can not use native RTP bridge as channel '%s' has DTMF hooks\n",
-			bridge->uniqueid, ast_channel_name(c0->chan));
+			bridge->uniqueid, ast_channel_name(c1->chan));
 		return 0;
 	}
 
@@ -230,7 +233,7 @@
 static int native_rtp_bridge_framehook_attach(struct ast_bridge_channel *bridge_channel)
 {
 	struct native_rtp_bridge_data *data = ao2_alloc(sizeof(*data), NULL);
-	struct ast_framehook_interface hook = {
+	static struct ast_framehook_interface hook = {
 		.version = AST_FRAMEHOOK_INTERFACE_VERSION,
 		.event_cb = native_rtp_framehook,
 	};
@@ -356,11 +359,10 @@
 
 static int native_rtp_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
 {
-	struct ast_bridge_channel *other = AST_LIST_FIRST(&bridge->channels);
-
-	/* Find the channel we actually want to write to */
-	if (other == bridge_channel) {
-		other = AST_LIST_LAST(&bridge->channels);
+	struct ast_bridge_channel *other = ast_bridge_channel_peer(bridge_channel);
+
+	if (!other) {
+		return -1;
 	}
 
 	/* The bridging core takes care of freeing the passed in frame. */

Modified: team/file/bridge_native/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/channels/chan_gulp.c?view=diff&rev=386842&r1=386841&r2=386842
==============================================================================
--- team/file/bridge_native/channels/chan_gulp.c (original)
+++ team/file/bridge_native/channels/chan_gulp.c Mon Apr 29 09:09:38 2013
@@ -132,7 +132,6 @@
 	.send_text = gulp_sendtext,
 	.send_digit_begin = gulp_digit_begin,
 	.send_digit_end = gulp_digit_end,
-	.bridge = ast_rtp_instance_bridge,
 	.call = gulp_call,
 	.hangup = gulp_hangup,
 	.answer = gulp_answer,

Modified: team/file/bridge_native/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/channels/chan_h323.c?view=diff&rev=386842&r1=386841&r2=386842
==============================================================================
--- team/file/bridge_native/channels/chan_h323.c (original)
+++ team/file/bridge_native/channels/chan_h323.c Mon Apr 29 09:09:38 2013
@@ -275,7 +275,6 @@
 	.write = oh323_write,
 	.indicate = oh323_indicate,
 	.fixup = oh323_fixup,
-	.bridge = ast_rtp_instance_bridge,
 };
 
 static const char* redirectingreason2str(int redirectingreason)

Modified: team/file/bridge_native/channels/chan_jingle.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/channels/chan_jingle.c?view=diff&rev=386842&r1=386841&r2=386842
==============================================================================
--- team/file/bridge_native/channels/chan_jingle.c (original)
+++ team/file/bridge_native/channels/chan_jingle.c Mon Apr 29 09:09:38 2013
@@ -205,7 +205,6 @@
 	.send_text = jingle_sendtext,
 	.send_digit_begin = jingle_digit_begin,
 	.send_digit_end = jingle_digit_end,
-	.bridge = ast_rtp_instance_bridge,
 	.call = jingle_call,
 	.hangup = jingle_hangup,
 	.answer = jingle_answer,

Modified: team/file/bridge_native/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/channels/chan_mgcp.c?view=diff&rev=386842&r1=386841&r2=386842
==============================================================================
--- team/file/bridge_native/channels/chan_mgcp.c (original)
+++ team/file/bridge_native/channels/chan_mgcp.c Mon Apr 29 09:09:38 2013
@@ -480,7 +480,6 @@
 	.fixup = mgcp_fixup,
 	.send_digit_begin = mgcp_senddigit_begin,
 	.send_digit_end = mgcp_senddigit_end,
-	.bridge = ast_rtp_instance_bridge,
 	.func_channel_read = acf_channel_read,
 };
 

Modified: team/file/bridge_native/channels/chan_motif.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/channels/chan_motif.c?view=diff&rev=386842&r1=386841&r2=386842
==============================================================================
--- team/file/bridge_native/channels/chan_motif.c (original)
+++ team/file/bridge_native/channels/chan_motif.c Mon Apr 29 09:09:38 2013
@@ -360,7 +360,6 @@
 	.send_text = jingle_sendtext,
 	.send_digit_begin = jingle_digit_begin,
 	.send_digit_end = jingle_digit_end,
-	.bridge = ast_rtp_instance_bridge,
 	.call = jingle_call,
 	.hangup = jingle_hangup,
 	.answer = jingle_answer,

Modified: team/file/bridge_native/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/channels/chan_sip.c?view=diff&rev=386842&r1=386841&r2=386842
==============================================================================
--- team/file/bridge_native/channels/chan_sip.c (original)
+++ team/file/bridge_native/channels/chan_sip.c Mon Apr 29 09:09:38 2013
@@ -1540,7 +1540,6 @@
 	.fixup = sip_fixup,			/* called with chan locked */
 	.send_digit_begin = sip_senddigit_begin,	/* called with chan unlocked */
 	.send_digit_end = sip_senddigit_end,
-	.bridge = ast_rtp_instance_bridge,			/* XXX chan unlocked ? */
 	.early_bridge = ast_rtp_instance_early_bridge,
 	.send_text = sip_sendtext,		/* called with chan locked */
 	.func_channel_read = sip_acf_channel_read,
@@ -32852,7 +32851,6 @@
 
 	/* Disable early RTP bridge  */
 	if ((instance || vinstance || tinstance) &&
-		!ast_bridged_channel(chan) &&
 		!ast_channel_internal_bridge(chan) &&
 		!sip_cfg.directrtpsetup) {
 		sip_pvt_unlock(p);

Modified: team/file/bridge_native/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/channels/chan_skinny.c?view=diff&rev=386842&r1=386841&r2=386842
==============================================================================
--- team/file/bridge_native/channels/chan_skinny.c (original)
+++ team/file/bridge_native/channels/chan_skinny.c Mon Apr 29 09:09:38 2013
@@ -1635,7 +1635,6 @@
 	.fixup = skinny_fixup,
 	.send_digit_begin = skinny_senddigit_begin,
 	.send_digit_end = skinny_senddigit_end,
-	.bridge = ast_rtp_instance_bridge,
 };
 
 static int skinny_extensionstate_cb(char *context, char *id, struct ast_state_cb_info *info, void *data);

Modified: team/file/bridge_native/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/channels/chan_unistim.c?view=diff&rev=386842&r1=386841&r2=386842
==============================================================================
--- team/file/bridge_native/channels/chan_unistim.c (original)
+++ team/file/bridge_native/channels/chan_unistim.c Mon Apr 29 09:09:38 2013
@@ -708,7 +708,6 @@
 	.send_digit_begin = unistim_senddigit_begin,
 	.send_digit_end = unistim_senddigit_end,
 	.send_text = unistim_sendtext,
-	.bridge = ast_rtp_instance_bridge,
 };
 
 static void send_start_rtp(struct unistim_subchannel *);

Modified: team/file/bridge_native/include/asterisk/rtp_engine.h
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/include/asterisk/rtp_engine.h?view=diff&rev=386842&r1=386841&r2=386842
==============================================================================
--- team/file/bridge_native/include/asterisk/rtp_engine.h (original)
+++ team/file/bridge_native/include/asterisk/rtp_engine.h Mon Apr 29 09:09:38 2013
@@ -1541,24 +1541,6 @@
 struct ast_rtp_glue *ast_rtp_instance_get_glue(const char *type);
 
 /*!
- * \brief Bridge two channels that use RTP instances
- *
- * \param c0 First channel part of the bridge
- * \param c1 Second channel part of the bridge
- * \param flags Bridging flags
- * \param fo If a frame needs to be passed up it is stored here
- * \param rc Channel that passed the above frame up
- * \param timeoutms How long the channels should be bridged for
- *
- * \retval Bridge result
- *
- * \note This should only be used by channel drivers in their technology declaration.
- *
- * \since 1.8
- */
-enum ast_bridge_result ast_rtp_instance_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
-
-/*!
  * \brief Get the other RTP instance that an instance is bridged to
  *
  * \param instance The RTP instance that we want

Modified: team/file/bridge_native/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/main/bridging.c?view=diff&rev=386842&r1=386841&r2=386842
==============================================================================
--- team/file/bridge_native/main/bridging.c (original)
+++ team/file/bridge_native/main/bridging.c Mon Apr 29 09:09:38 2013
@@ -929,8 +929,10 @@
 	case AST_FRAME_NULL:
 		if (ast_channel_softhangup_internal_flag(bridge_channel->chan) & AST_SOFTHANGUP_UNBRIDGE) {
 			ast_channel_clear_softhangup(bridge_channel->chan, AST_SOFTHANGUP_UNBRIDGE);
+			ast_bridge_channel_lock_bridge(bridge_channel);
 			bridge_channel->bridge->reconfigured = 1;
 			bridge_reconfigured(bridge_channel->bridge);
+			ast_bridge_unlock(bridge_channel->bridge);
 		}
 		/* Just discard it. */
 		ast_frfree(frame);

Modified: team/file/bridge_native/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/main/rtp_engine.c?view=diff&rev=386842&r1=386841&r2=386842
==============================================================================
--- team/file/bridge_native/main/rtp_engine.c (original)
+++ team/file/bridge_native/main/rtp_engine.c Mon Apr 29 09:09:38 2013
@@ -928,497 +928,6 @@
 	return glue;
 }
 
-static enum ast_bridge_result local_bridge_loop(struct ast_channel *c0, struct ast_channel *c1, struct ast_rtp_instance *instance0, struct ast_rtp_instance *instance1, int timeoutms, int flags, struct ast_frame **fo, struct ast_channel **rc, void *pvt0, void *pvt1)
-{
-	enum ast_bridge_result res = AST_BRIDGE_FAILED;
-	struct ast_channel *who = NULL, *other = NULL, *cs[3] = { NULL, };
-	struct ast_frame *fr = NULL;
-	struct timeval start;
-
-	/* Start locally bridging both instances */
-	if (instance0->engine->local_bridge && instance0->engine->local_bridge(instance0, instance1)) {
-		ast_debug(1, "Failed to locally bridge %s to %s, backing out.\n", ast_channel_name(c0), ast_channel_name(c1));
-		ast_channel_unlock(c0);
-		ast_channel_unlock(c1);
-		return AST_BRIDGE_FAILED_NOWARN;
-	}
-	if (instance1->engine->local_bridge && instance1->engine->local_bridge(instance1, instance0)) {
-		ast_debug(1, "Failed to locally bridge %s to %s, backing out.\n", ast_channel_name(c1), ast_channel_name(c0));
-		if (instance0->engine->local_bridge) {
-			instance0->engine->local_bridge(instance0, NULL);
-		}
-		ast_channel_unlock(c0);
-		ast_channel_unlock(c1);
-		return AST_BRIDGE_FAILED_NOWARN;
-	}
-
-	ast_channel_unlock(c0);
-	ast_channel_unlock(c1);
-
-	instance0->bridged = instance1;
-	instance1->bridged = instance0;
-
-	ast_poll_channel_add(c0, c1);
-
-	/* Hop into a loop waiting for a frame from either channel */
-	cs[0] = c0;
-	cs[1] = c1;
-	cs[2] = NULL;
-	start = ast_tvnow();
-	for (;;) {
-		int ms;
-		/* If the underlying formats have changed force this bridge to break */
-		if ((ast_format_cmp(ast_channel_rawreadformat(c0), ast_channel_rawwriteformat(c1)) == AST_FORMAT_CMP_NOT_EQUAL) ||
-			(ast_format_cmp(ast_channel_rawreadformat(c1), ast_channel_rawwriteformat(c0)) == AST_FORMAT_CMP_NOT_EQUAL)) {
-			ast_debug(1, "rtp-engine-local-bridge: Oooh, formats changed, backing out\n");
-			res = AST_BRIDGE_FAILED_NOWARN;
-			break;
-		}
-		/* Check if anything changed */
-		if ((ast_channel_tech_pvt(c0) != pvt0) ||
-		    (ast_channel_tech_pvt(c1) != pvt1) ||
-		    (ast_channel_masq(c0) || ast_channel_masqr(c0) || ast_channel_masq(c1) || ast_channel_masqr(c1)) ||
-		    (ast_channel_monitor(c0) || ast_channel_audiohooks(c0) || ast_channel_monitor(c1) || ast_channel_audiohooks(c1)) ||
-		    (!ast_framehook_list_is_empty(ast_channel_framehooks(c0)) || !ast_framehook_list_is_empty(ast_channel_framehooks(c1)))) {
-			ast_debug(1, "rtp-engine-local-bridge: Oooh, something is weird, backing out\n");
-			/* If a masquerade needs to happen we have to try to read in a frame so that it actually happens. Without this we risk being called again and going into a loop */
-			if ((ast_channel_masq(c0) || ast_channel_masqr(c0)) && (fr = ast_read(c0))) {
-				ast_frfree(fr);
-			}
-			if ((ast_channel_masq(c1) || ast_channel_masqr(c1)) && (fr = ast_read(c1))) {
-				ast_frfree(fr);
-			}
-			res = AST_BRIDGE_RETRY;
-			break;
-		}
-		/* Wait on a channel to feed us a frame */
-		ms = ast_remaining_ms(start, timeoutms);
-		if (!(who = ast_waitfor_n(cs, 2, &ms))) {
-			if (!ms) {
-				res = AST_BRIDGE_RETRY;
-				break;
-			}
-			ast_debug(2, "rtp-engine-local-bridge: Ooh, empty read...\n");
-			if (ast_check_hangup(c0) || ast_check_hangup(c1)) {
-				break;
-			}
-			continue;
-		}
-		/* Read in frame from channel */
-		fr = ast_read(who);
-		other = (who == c0) ? c1 : c0;
-		/* Depending on the frame we may need to break out of our bridge */
-		if (!fr || ((fr->frametype == AST_FRAME_DTMF_BEGIN || fr->frametype == AST_FRAME_DTMF_END) &&
-			    ((who == c0) && (flags & AST_BRIDGE_DTMF_CHANNEL_0)) |
-			    ((who == c1) && (flags & AST_BRIDGE_DTMF_CHANNEL_1)))) {
-			/* Record received frame and who */
-			*fo = fr;
-			*rc = who;
-			ast_debug(1, "rtp-engine-local-bridge: Ooh, got a %s\n", fr ? "digit" : "hangup");
-			res = AST_BRIDGE_COMPLETE;
-			break;
-		} else if ((fr->frametype == AST_FRAME_CONTROL) && !(flags & AST_BRIDGE_IGNORE_SIGS)) {
-			if ((fr->subclass.integer == AST_CONTROL_HOLD) ||
-			    (fr->subclass.integer == AST_CONTROL_UNHOLD) ||
-			    (fr->subclass.integer == AST_CONTROL_VIDUPDATE) ||
-			    (fr->subclass.integer == AST_CONTROL_SRCUPDATE) ||
-			    (fr->subclass.integer == AST_CONTROL_T38_PARAMETERS) ||
-			    (fr->subclass.integer == AST_CONTROL_UPDATE_RTP_PEER)) {
-				/* If we are going on hold, then break callback mode and P2P bridging */
-				if (fr->subclass.integer == AST_CONTROL_HOLD) {
-					if (instance0->engine->local_bridge) {
-						instance0->engine->local_bridge(instance0, NULL);
-					}
-					if (instance1->engine->local_bridge) {
-						instance1->engine->local_bridge(instance1, NULL);
-					}
-					instance0->bridged = NULL;
-					instance1->bridged = NULL;
-				} else if (fr->subclass.integer == AST_CONTROL_UNHOLD) {
-					if (instance0->engine->local_bridge) {
-						instance0->engine->local_bridge(instance0, instance1);
-					}
-					if (instance1->engine->local_bridge) {
-						instance1->engine->local_bridge(instance1, instance0);
-					}
-					instance0->bridged = instance1;
-					instance1->bridged = instance0;
-				}
-				/* Since UPDATE_BRIDGE_PEER is only used by the bridging code, don't forward it */
-				if (fr->subclass.integer != AST_CONTROL_UPDATE_RTP_PEER) {
-					ast_indicate_data(other, fr->subclass.integer, fr->data.ptr, fr->datalen);
-				}
-				ast_frfree(fr);
-			} else if (fr->subclass.integer == AST_CONTROL_CONNECTED_LINE) {
-				if (ast_channel_connected_line_sub(who, other, fr, 1) &&
-					ast_channel_connected_line_macro(who, other, fr, other == c0, 1)) {
-					ast_indicate_data(other, fr->subclass.integer, fr->data.ptr, fr->datalen);
-				}
-				ast_frfree(fr);
-			} else if (fr->subclass.integer == AST_CONTROL_REDIRECTING) {
-				if (ast_channel_redirecting_sub(who, other, fr, 1) &&
-					ast_channel_redirecting_macro(who, other, fr, other == c0, 1)) {
-					ast_indicate_data(other, fr->subclass.integer, fr->data.ptr, fr->datalen);
-				}
-				ast_frfree(fr);
-			} else if (fr->subclass.integer == AST_CONTROL_PVT_CAUSE_CODE) {
-				ast_channel_hangupcause_hash_set(other, fr->data.ptr, fr->datalen);
-				ast_frfree(fr);
-			} else {
-				*fo = fr;
-				*rc = who;
-				ast_debug(1, "rtp-engine-local-bridge: Got a FRAME_CONTROL (%d) frame on channel %s\n", fr->subclass.integer, ast_channel_name(who));
-				res = AST_BRIDGE_COMPLETE;
-				break;
-			}
-		} else {
-			if ((fr->frametype == AST_FRAME_DTMF_BEGIN) ||
-			    (fr->frametype == AST_FRAME_DTMF_END) ||
-			    (fr->frametype == AST_FRAME_VOICE) ||
-			    (fr->frametype == AST_FRAME_VIDEO) ||
-			    (fr->frametype == AST_FRAME_IMAGE) ||
-			    (fr->frametype == AST_FRAME_HTML) ||
-			    (fr->frametype == AST_FRAME_MODEM) ||
-			    (fr->frametype == AST_FRAME_TEXT)) {
-				ast_write(other, fr);
-			}
-
-			ast_frfree(fr);
-		}
-		/* Swap priority */
-		cs[2] = cs[0];
-		cs[0] = cs[1];
-		cs[1] = cs[2];
-	}
-
-	/* Stop locally bridging both instances */
-	if (instance0->engine->local_bridge) {
-		instance0->engine->local_bridge(instance0, NULL);
-	}
-	if (instance1->engine->local_bridge) {
-		instance1->engine->local_bridge(instance1, NULL);
-	}
-
-	instance0->bridged = NULL;
-	instance1->bridged = NULL;
-
-	ast_poll_channel_del(c0, c1);
-
-	return res;
-}
-
-static enum ast_bridge_result remote_bridge_loop(struct ast_channel *c0,
-	struct ast_channel *c1,
-	struct ast_rtp_instance *instance0,
-	struct ast_rtp_instance *instance1,
-	struct ast_rtp_instance *vinstance0,
-	struct ast_rtp_instance *vinstance1,
-	struct ast_rtp_instance *tinstance0,
-	struct ast_rtp_instance *tinstance1,
-	struct ast_rtp_glue *glue0,
-	struct ast_rtp_glue *glue1,
-	struct ast_format_cap *cap0,
-	struct ast_format_cap *cap1,
-	int timeoutms,
-	int flags,
-	struct ast_frame **fo,
-	struct ast_channel **rc,
-	void *pvt0,
-	void *pvt1)
-{
-	enum ast_bridge_result res = AST_BRIDGE_FAILED;
-	struct ast_channel *who = NULL, *other = NULL, *cs[3] = { NULL, };
-	struct ast_format_cap *oldcap0 = ast_format_cap_dup(cap0);
-	struct ast_format_cap *oldcap1 = ast_format_cap_dup(cap1);
-	struct ast_sockaddr ac1 = {{0,}}, vac1 = {{0,}}, tac1 = {{0,}}, ac0 = {{0,}}, vac0 = {{0,}}, tac0 = {{0,}};
-	struct ast_sockaddr t1 = {{0,}}, vt1 = {{0,}}, tt1 = {{0,}}, t0 = {{0,}}, vt0 = {{0,}}, tt0 = {{0,}};
-	struct ast_frame *fr = NULL;
-	struct timeval start;
-
-	if (!oldcap0 || !oldcap1) {
-		ast_channel_unlock(c0);
-		ast_channel_unlock(c1);
-		goto remote_bridge_cleanup;
-	}
-	/* Test the first channel */
-	if (!(glue0->update_peer(c0, instance1, vinstance1, tinstance1, cap1, 0))) {
-		ast_rtp_instance_get_remote_address(instance1, &ac1);
-		if (vinstance1) {
-			ast_rtp_instance_get_remote_address(vinstance1, &vac1);
-		}
-		if (tinstance1) {
-			ast_rtp_instance_get_remote_address(tinstance1, &tac1);
-		}
-	} else {
-		ast_log(LOG_WARNING, "Channel '%s' failed to talk to '%s'\n", ast_channel_name(c0), ast_channel_name(c1));
-	}
-
-	/* Test the second channel */
-	if (!(glue1->update_peer(c1, instance0, vinstance0, tinstance0, cap0, 0))) {
-		ast_rtp_instance_get_remote_address(instance0, &ac0);
-		if (vinstance0) {
-			ast_rtp_instance_get_remote_address(instance0, &vac0);
-		}
-		if (tinstance0) {
-			ast_rtp_instance_get_remote_address(instance0, &tac0);
-		}
-	} else {
-		ast_log(LOG_WARNING, "Channel '%s' failed to talk to '%s'\n", ast_channel_name(c1), ast_channel_name(c0));
-	}
-
-	ast_channel_unlock(c0);
-	ast_channel_unlock(c1);
-
-	instance0->bridged = instance1;
-	instance1->bridged = instance0;
-
-	ast_poll_channel_add(c0, c1);
-
-	/* Go into a loop handling any stray frames that may come in */
-	cs[0] = c0;
-	cs[1] = c1;
-	cs[2] = NULL;
-	start = ast_tvnow();
-	for (;;) {
-		int ms;
-		/* Check if anything changed */
-		if ((ast_channel_tech_pvt(c0) != pvt0) ||
-		    (ast_channel_tech_pvt(c1) != pvt1) ||
-		    (ast_channel_masq(c0) || ast_channel_masqr(c0) || ast_channel_masq(c1) || ast_channel_masqr(c1)) ||
-		    (ast_channel_monitor(c0) || ast_channel_audiohooks(c0) || ast_channel_monitor(c1) || ast_channel_audiohooks(c1)) ||
-		    (!ast_framehook_list_is_empty(ast_channel_framehooks(c0)) || !ast_framehook_list_is_empty(ast_channel_framehooks(c1)))) {
-			ast_debug(1, "Oooh, something is weird, backing out\n");
-			res = AST_BRIDGE_RETRY;
-			break;
-		}
-
-		/* Check if they have changed their address */
-		ast_rtp_instance_get_remote_address(instance1, &t1);
-		if (vinstance1) {
-			ast_rtp_instance_get_remote_address(vinstance1, &vt1);
-		}
-		if (tinstance1) {
-			ast_rtp_instance_get_remote_address(tinstance1, &tt1);
-		}
-		if (glue1->get_codec) {
-			ast_format_cap_remove_all(cap1);
-			glue1->get_codec(c1, cap1);
-		}
-
-		ast_rtp_instance_get_remote_address(instance0, &t0);
-		if (vinstance0) {
-			ast_rtp_instance_get_remote_address(vinstance0, &vt0);
-		}
-		if (tinstance0) {
-			ast_rtp_instance_get_remote_address(tinstance0, &tt0);
-		}
-		if (glue0->get_codec) {
-			ast_format_cap_remove_all(cap0);
-			glue0->get_codec(c0, cap0);
-		}
-
-		if ((ast_sockaddr_cmp(&t1, &ac1)) ||
-		    (vinstance1 && ast_sockaddr_cmp(&vt1, &vac1)) ||
-		    (tinstance1 && ast_sockaddr_cmp(&tt1, &tac1)) ||
-		    (!ast_format_cap_identical(cap1, oldcap1))) {
-			char tmp_buf[512] = { 0, };
-			ast_debug(1, "Oooh, '%s' changed end address to %s (format %s)\n",
-				  ast_channel_name(c1), ast_sockaddr_stringify(&t1),
-				  ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), cap1));
-			ast_debug(1, "Oooh, '%s' changed end vaddress to %s (format %s)\n",
-				  ast_channel_name(c1), ast_sockaddr_stringify(&vt1),
-				  ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), cap1));
-			ast_debug(1, "Oooh, '%s' changed end taddress to %s (format %s)\n",
-				  ast_channel_name(c1), ast_sockaddr_stringify(&tt1),
-				  ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), cap1));
-			ast_debug(1, "Oooh, '%s' was %s/(format %s)\n",
-				  ast_channel_name(c1), ast_sockaddr_stringify(&ac1),
-				  ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), oldcap1));
-			ast_debug(1, "Oooh, '%s' was %s/(format %s)\n",
-				  ast_channel_name(c1), ast_sockaddr_stringify(&vac1),
-				  ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), oldcap1));
-			ast_debug(1, "Oooh, '%s' was %s/(format %s)\n",
-				  ast_channel_name(c1), ast_sockaddr_stringify(&tac1),
-				  ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), oldcap1));
-			if (glue0->update_peer(c0,
-					       ast_sockaddr_isnull(&t1)  ? NULL : instance1,
-					       ast_sockaddr_isnull(&vt1) ? NULL : vinstance1,
-					       ast_sockaddr_isnull(&tt1) ? NULL : tinstance1,
-					       cap1, 0)) {
-				ast_log(LOG_WARNING, "Channel '%s' failed to update to '%s'\n", ast_channel_name(c0), ast_channel_name(c1));
-			}
-			ast_sockaddr_copy(&ac1, &t1);
-			ast_sockaddr_copy(&vac1, &vt1);
-			ast_sockaddr_copy(&tac1, &tt1);
-			ast_format_cap_copy(oldcap1, cap1);
-		}
-		if ((ast_sockaddr_cmp(&t0, &ac0)) ||
-		    (vinstance0 && ast_sockaddr_cmp(&vt0, &vac0)) ||
-		    (tinstance0 && ast_sockaddr_cmp(&tt0, &tac0)) ||
-		    (!ast_format_cap_identical(cap0, oldcap0))) {
-			char tmp_buf[512] = { 0, };
-			ast_debug(1, "Oooh, '%s' changed end address to %s (format %s)\n",
-				  ast_channel_name(c0), ast_sockaddr_stringify(&t0),
-				  ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), cap0));
-			ast_debug(1, "Oooh, '%s' was %s/(format %s)\n",
-				  ast_channel_name(c0), ast_sockaddr_stringify(&ac0),
-				  ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), oldcap0));
-			if (glue1->update_peer(c1, t0.len ? instance0 : NULL,
-						vt0.len ? vinstance0 : NULL,
-						tt0.len ? tinstance0 : NULL,
-						cap0, 0)) {
-				ast_log(LOG_WARNING, "Channel '%s' failed to update to '%s'\n", ast_channel_name(c1), ast_channel_name(c0));
-			}
-			ast_sockaddr_copy(&ac0, &t0);
-			ast_sockaddr_copy(&vac0, &vt0);
-			ast_sockaddr_copy(&tac0, &tt0);
-			ast_format_cap_copy(oldcap0, cap0);
-		}
-
-		ms = ast_remaining_ms(start, timeoutms);
-		/* Wait for frame to come in on the channels */
-		if (!(who = ast_waitfor_n(cs, 2, &ms))) {
-			if (!ms) {
-				res = AST_BRIDGE_RETRY;
-				break;
-			}
-			ast_debug(1, "Ooh, empty read...\n");
-			if (ast_check_hangup(c0) || ast_check_hangup(c1)) {
-				break;
-			}
-			continue;
-		}
-		fr = ast_read(who);
-		other = (who == c0) ? c1 : c0;
-		if (!fr || ((fr->frametype == AST_FRAME_DTMF_BEGIN || fr->frametype == AST_FRAME_DTMF_END) &&
-			    (((who == c0) && (flags & AST_BRIDGE_DTMF_CHANNEL_0)) ||
-			     ((who == c1) && (flags & AST_BRIDGE_DTMF_CHANNEL_1))))) {
-			/* Break out of bridge */
-			*fo = fr;
-			*rc = who;
-			ast_debug(1, "Oooh, got a %s\n", fr ? "digit" : "hangup");
-			res = AST_BRIDGE_COMPLETE;
-			break;
-		} else if ((fr->frametype == AST_FRAME_CONTROL) && !(flags & AST_BRIDGE_IGNORE_SIGS)) {
-			if ((fr->subclass.integer == AST_CONTROL_HOLD) ||
-			    (fr->subclass.integer == AST_CONTROL_UNHOLD) ||
-			    (fr->subclass.integer == AST_CONTROL_VIDUPDATE) ||
-			    (fr->subclass.integer == AST_CONTROL_SRCUPDATE) ||
-			    (fr->subclass.integer == AST_CONTROL_T38_PARAMETERS) ||
-				(fr->subclass.integer == AST_CONTROL_UPDATE_RTP_PEER)) {
-				if (fr->subclass.integer == AST_CONTROL_HOLD) {
-					/* If we someone went on hold we want the other side to reinvite back to us */
-					if (who == c0) {
-						glue1->update_peer(c1, NULL, NULL, NULL, 0, 0);
-					} else {
-						glue0->update_peer(c0, NULL, NULL, NULL, 0, 0);
-					}
-				} else if (fr->subclass.integer == AST_CONTROL_UNHOLD ||
-					fr->subclass.integer == AST_CONTROL_UPDATE_RTP_PEER) {
-					/* If they went off hold they should go back to being direct, or if we have
-					 * been told to force a peer update, go ahead and do it. */
-					if (who == c0) {
-						glue1->update_peer(c1, instance0, vinstance0, tinstance0, cap0, 0);
-					} else {
-						glue0->update_peer(c0, instance1, vinstance1, tinstance1, cap1, 0);
-					}
-				}
-				/* Update local address information */
-				ast_rtp_instance_get_remote_address(instance0, &t0);
-				ast_sockaddr_copy(&ac0, &t0);
-				ast_rtp_instance_get_remote_address(instance1, &t1);
-				ast_sockaddr_copy(&ac1, &t1);
-				/* Update codec information */
-				if (glue0->get_codec && ast_channel_tech_pvt(c0)) {
-					ast_format_cap_remove_all(cap0);
-					ast_format_cap_remove_all(oldcap0);
-					glue0->get_codec(c0, cap0);
-					ast_format_cap_append(oldcap0, cap0);
-
-				}
-				if (glue1->get_codec && ast_channel_tech_pvt(c1)) {
-					ast_format_cap_remove_all(cap1);
-					ast_format_cap_remove_all(oldcap1);
-					glue1->get_codec(c1, cap1);
-					ast_format_cap_append(oldcap1, cap1);
-				}
-				/* Since UPDATE_BRIDGE_PEER is only used by the bridging code, don't forward it */
-				if (fr->subclass.integer != AST_CONTROL_UPDATE_RTP_PEER) {
-					ast_indicate_data(other, fr->subclass.integer, fr->data.ptr, fr->datalen);
-				}
-				ast_frfree(fr);
-			} else if (fr->subclass.integer == AST_CONTROL_CONNECTED_LINE) {
-				if (ast_channel_connected_line_sub(who, other, fr, 1) &&
-					ast_channel_connected_line_macro(who, other, fr, other == c0, 1)) {
-					ast_indicate_data(other, fr->subclass.integer, fr->data.ptr, fr->datalen);
-				}
-				ast_frfree(fr);
-			} else if (fr->subclass.integer == AST_CONTROL_REDIRECTING) {
-				if (ast_channel_redirecting_sub(who, other, fr, 1) &&
-					ast_channel_redirecting_macro(who, other, fr, other == c0, 1)) {
-					ast_indicate_data(other, fr->subclass.integer, fr->data.ptr, fr->datalen);
-				}
-				ast_frfree(fr);
-			} else if (fr->subclass.integer == AST_CONTROL_PVT_CAUSE_CODE) {
-				ast_channel_hangupcause_hash_set(other, fr->data.ptr, fr->datalen);
-				ast_frfree(fr);
-			} else {
-				*fo = fr;
-				*rc = who;
-				ast_debug(1, "Got a FRAME_CONTROL (%d) frame on channel %s\n", fr->subclass.integer, ast_channel_name(who));
-				res = AST_BRIDGE_COMPLETE;
-				goto remote_bridge_cleanup;
-			}
-		} else {
-			if ((fr->frametype == AST_FRAME_DTMF_BEGIN) ||
-			    (fr->frametype == AST_FRAME_DTMF_END) ||
-			    (fr->frametype == AST_FRAME_VOICE) ||
-			    (fr->frametype == AST_FRAME_VIDEO) ||
-			    (fr->frametype == AST_FRAME_IMAGE) ||
-			    (fr->frametype == AST_FRAME_HTML) ||
-			    (fr->frametype == AST_FRAME_MODEM) ||
-			    (fr->frametype == AST_FRAME_TEXT)) {
-				ast_write(other, fr);
-			}
-			ast_frfree(fr);
-		}
-		/* Swap priority */
-		cs[2] = cs[0];
-		cs[0] = cs[1];
-		cs[1] = cs[2];
-	}
-
-	if (ast_test_flag(ast_channel_flags(c0), AST_FLAG_ZOMBIE)) {
-		ast_debug(1, "Channel '%s' Zombie cleardown from bridge\n", ast_channel_name(c0));
-	} else if (ast_channel_tech_pvt(c0) != pvt0) {
-		ast_debug(1, "Channel c0->'%s' pvt changed, in bridge with c1->'%s'\n", ast_channel_name(c0), ast_channel_name(c1));
-	} else if (glue0 != ast_rtp_instance_get_glue(ast_channel_tech(c0)->type)) {
-		ast_debug(1, "Channel c0->'%s' technology changed, in bridge with c1->'%s'\n", ast_channel_name(c0), ast_channel_name(c1));
-	} else if (glue0->update_peer(c0, NULL, NULL, NULL, 0, 0)) {
-		ast_log(LOG_WARNING, "Channel '%s' failed to break RTP bridge\n", ast_channel_name(c0));
-	}
-	if (ast_test_flag(ast_channel_flags(c1), AST_FLAG_ZOMBIE)) {
-		ast_debug(1, "Channel '%s' Zombie cleardown from bridge\n", ast_channel_name(c1));
-	} else if (ast_channel_tech_pvt(c1) != pvt1) {
-		ast_debug(1, "Channel c1->'%s' pvt changed, in bridge with c0->'%s'\n", ast_channel_name(c1), ast_channel_name(c0));
-	} else if (glue1 != ast_rtp_instance_get_glue(ast_channel_tech(c1)->type)) {
-		ast_debug(1, "Channel c1->'%s' technology changed, in bridge with c0->'%s'\n", ast_channel_name(c1), ast_channel_name(c0));
-	} else if (glue1->update_peer(c1, NULL, NULL, NULL, 0, 0)) {
-		ast_log(LOG_WARNING, "Channel '%s' failed to break RTP bridge\n", ast_channel_name(c1));
-	}
-
-	instance0->bridged = NULL;
-	instance1->bridged = NULL;
-
-	ast_poll_channel_del(c0, c1);
-
-remote_bridge_cleanup:
-	ast_format_cap_destroy(oldcap0);
-	ast_format_cap_destroy(oldcap1);
-
-	return res;
-}
-
 /*!
  * \brief Conditionally unref an rtp instance
  */
@@ -1428,181 +937,6 @@
 		ao2_ref(*instance, -1);
 		*instance = NULL;
 	}
-}
-
-enum ast_bridge_result ast_rtp_instance_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms)
-{
-	struct ast_rtp_instance *instance0 = NULL, *instance1 = NULL,
-			*vinstance0 = NULL, *vinstance1 = NULL,
-			*tinstance0 = NULL, *tinstance1 = NULL;
-	struct ast_rtp_glue *glue0, *glue1;
-	struct ast_sockaddr addr1 = { {0, }, }, addr2 = { {0, }, };
-	enum ast_rtp_glue_result audio_glue0_res = AST_RTP_GLUE_RESULT_FORBID, video_glue0_res = AST_RTP_GLUE_RESULT_FORBID;
-	enum ast_rtp_glue_result audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID, video_glue1_res = AST_RTP_GLUE_RESULT_FORBID;
-	enum ast_bridge_result res = AST_BRIDGE_FAILED;
-	enum ast_rtp_dtmf_mode dmode;
-	struct ast_format_cap *cap0 = ast_format_cap_alloc_nolock();
-	struct ast_format_cap *cap1 = ast_format_cap_alloc_nolock();
-	int unlock_chans = 1;
-	int read_ptime0, read_ptime1, write_ptime0, write_ptime1;
-
-	if (!cap0 || !cap1) {
-		unlock_chans = 0;
-		goto done;
-	}
-
-	/* Lock both channels so we can look for the glue that binds them together */
-	ast_channel_lock_both(c0, c1);
-
-	/* Ensure neither channel got hungup during lock avoidance */
-	if (ast_check_hangup(c0) || ast_check_hangup(c1)) {
-		ast_log(LOG_WARNING, "Got hangup while attempting to bridge '%s' and '%s'\n", ast_channel_name(c0), ast_channel_name(c1));
-		goto done;
-	}
-
-	/* Grab glue that binds each channel to something using the RTP engine */
-	if (!(glue0 = ast_rtp_instance_get_glue(ast_channel_tech(c0)->type)) || !(glue1 = ast_rtp_instance_get_glue(ast_channel_tech(c1)->type))) {
-		ast_debug(1, "Can't find native functions for channel '%s'\n", glue0 ? ast_channel_name(c1) : ast_channel_name(c0));
-		goto done;
-	}
-
-	audio_glue0_res = glue0->get_rtp_info(c0, &instance0);
-	video_glue0_res = glue0->get_vrtp_info ? glue0->get_vrtp_info(c0, &vinstance0) : AST_RTP_GLUE_RESULT_FORBID;
-
-	audio_glue1_res = glue1->get_rtp_info(c1, &instance1);
-	video_glue1_res = glue1->get_vrtp_info ? glue1->get_vrtp_info(c1, &vinstance1) : AST_RTP_GLUE_RESULT_FORBID;
-
-	/* Apply any limitations on direct media bridging that may be present */
-	if (audio_glue0_res == audio_glue1_res && audio_glue1_res == AST_RTP_GLUE_RESULT_REMOTE) {
-		if (glue0->allow_rtp_remote && !(glue0->allow_rtp_remote(c0, instance1))) {
-			/* If the allow_rtp_remote indicates that remote isn't allowed, revert to local bridge */
-			audio_glue0_res = audio_glue1_res = AST_RTP_GLUE_RESULT_LOCAL;
-		} else if (glue1->allow_rtp_remote && !(glue1->allow_rtp_remote(c1, instance0))) {
-			audio_glue0_res = audio_glue1_res = AST_RTP_GLUE_RESULT_LOCAL;
-		}
-	}
-	if (video_glue0_res == video_glue1_res && video_glue1_res == AST_RTP_GLUE_RESULT_REMOTE) {
-		if (glue0->allow_vrtp_remote && !(glue0->allow_vrtp_remote(c0, instance1))) {
-			/* if the allow_vrtp_remote indicates that remote isn't allowed, revert to local bridge */
-			video_glue0_res = video_glue1_res = AST_RTP_GLUE_RESULT_LOCAL;
-		} else if (glue1->allow_vrtp_remote && !(glue1->allow_vrtp_remote(c1, instance0))) {
-			video_glue0_res = video_glue1_res = AST_RTP_GLUE_RESULT_LOCAL;
-		}
-	}
-
-	/* If we are carrying video, and both sides are not going to remotely bridge... fail the native bridge */
-	if (video_glue0_res != AST_RTP_GLUE_RESULT_FORBID && (audio_glue0_res != AST_RTP_GLUE_RESULT_REMOTE || video_glue0_res != AST_RTP_GLUE_RESULT_REMOTE)) {
-		audio_glue0_res = AST_RTP_GLUE_RESULT_FORBID;
-	}
-	if (video_glue1_res != AST_RTP_GLUE_RESULT_FORBID && (audio_glue1_res != AST_RTP_GLUE_RESULT_REMOTE || video_glue1_res != AST_RTP_GLUE_RESULT_REMOTE)) {
-		audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID;
-	}
-
-	/* If any sort of bridge is forbidden just completely bail out and go back to generic bridging */
-	if (audio_glue0_res == AST_RTP_GLUE_RESULT_FORBID || audio_glue1_res == AST_RTP_GLUE_RESULT_FORBID) {
-		res = AST_BRIDGE_FAILED_NOWARN;
-		goto done;
-	}
-
-
-	/* If address families differ, force a local bridge */
-	ast_rtp_instance_get_remote_address(instance0, &addr1);
-	ast_rtp_instance_get_remote_address(instance1, &addr2);
-
-	if (addr1.ss.ss_family != addr2.ss.ss_family ||
-	   (ast_sockaddr_is_ipv4_mapped(&addr1) != ast_sockaddr_is_ipv4_mapped(&addr2))) {
-		audio_glue0_res = AST_RTP_GLUE_RESULT_LOCAL;
-		audio_glue1_res = AST_RTP_GLUE_RESULT_LOCAL;
-	}
-
-	/* If we need to get DTMF see if we can do it outside of the RTP stream itself */
-	dmode = ast_rtp_instance_dtmf_mode_get(instance0);
-	if ((flags & AST_BRIDGE_DTMF_CHANNEL_0) && dmode) {
-		res = AST_BRIDGE_FAILED_NOWARN;
-		goto done;
-	}
-	dmode = ast_rtp_instance_dtmf_mode_get(instance1);
-	if ((flags & AST_BRIDGE_DTMF_CHANNEL_1) && dmode) {
-		res = AST_BRIDGE_FAILED_NOWARN;
-		goto done;
-	}
-
-	/* If we have gotten to a local bridge make sure that both sides have the same local bridge callback and that they are DTMF compatible */
-	if ((audio_glue0_res == AST_RTP_GLUE_RESULT_LOCAL || audio_glue1_res == AST_RTP_GLUE_RESULT_LOCAL)
-		&& (instance0->engine->local_bridge != instance1->engine->local_bridge
-			|| (instance0->engine->dtmf_compatible && !instance0->engine->dtmf_compatible(c0, instance0, c1, instance1)))) {
-		res = AST_BRIDGE_FAILED_NOWARN;

[... 75 lines stripped ...]



More information about the asterisk-commits mailing list