diff --git a/bridges/bridge_native_rtp.c b/bridges/bridge_native_rtp.c index adb85ffd4b703936c83bcb3c2b45fcd673e274d3..f6b0e68fae35c8cc1b3e2bb94466ed9657a912a3 100644 --- a/bridges/bridge_native_rtp.c +++ b/bridges/bridge_native_rtp.c @@ -229,10 +229,7 @@ static void native_rtp_bridge_stop(struct ast_bridge *bridge, struct ast_channel } break; case AST_RTP_GLUE_RESULT_REMOTE: - if (!target) { - glue0->update_peer(bc0->chan, NULL, NULL, NULL, NULL, 0); - glue1->update_peer(bc1->chan, NULL, NULL, NULL, NULL, 0); - } else { + if (target) { /* * If a target was provided, it is being put on hold and should expect to * receive media from Asterisk instead of what it was previously connected to. @@ -248,6 +245,11 @@ static void native_rtp_bridge_stop(struct ast_bridge *bridge, struct ast_channel break; } + if (!target && native_type != AST_RTP_GLUE_RESULT_FORBID) { + glue0->update_peer(bc0->chan, NULL, NULL, NULL, NULL, 0); + glue1->update_peer(bc1->chan, NULL, NULL, NULL, NULL, 0); + } + ast_debug(2, "Discontinued RTP bridging of '%s' and '%s' - media will flow through Asterisk core\n", ast_channel_name(bc0->chan), ast_channel_name(bc1->chan));