From 962b78bca19ec8caa8b60efdf792f1bb44aff21a Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Sun, 1 Jun 2014 15:32:34 +0000 Subject: bridge_native_rtp: Take the bridge type choice of both channels into account. The bridge_native_rtp module currently uses the bridge result of the first channel that joins a bridge as the ultimate result. This means that if the first channel has direct media enabled but the second does not a direct media bridge will still occur. This change makes it so that both sides are taken into account. If either side forbids the bridge or responds with a local bridge result then either a generic or local bridge occurs. ASTERISK-23541 #close Reported by: Justin E Review: https://reviewboard.asterisk.org/r/3577/ ........ Merged revisions 414975 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414976 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- bridges/bridge_native_rtp.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'bridges') diff --git a/bridges/bridge_native_rtp.c b/bridges/bridge_native_rtp.c index 7e48ab92f..2be2dbf42 100644 --- a/bridges/bridge_native_rtp.c +++ b/bridges/bridge_native_rtp.c @@ -103,13 +103,17 @@ static enum ast_rtp_glue_result native_rtp_bridge_get(struct ast_channel *c0, st 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) { + /* The order of preference is: forbid, local, and remote. */ + if (audio_glue0_res == AST_RTP_GLUE_RESULT_FORBID || + 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 */ return AST_RTP_GLUE_RESULT_FORBID; + } else if (audio_glue0_res == AST_RTP_GLUE_RESULT_LOCAL || + audio_glue1_res == AST_RTP_GLUE_RESULT_LOCAL) { + return AST_RTP_GLUE_RESULT_LOCAL; + } else { + return AST_RTP_GLUE_RESULT_REMOTE; } - - return audio_glue0_res; } /*! -- cgit v1.2.3