--- apps/app_confbridge.c.ori 2012-04-27 17:37:15.077849768 -0600 +++ apps/app_confbridge.c 2012-04-27 18:16:52.785763010 -0600 @@ -748,9 +748,7 @@ conference_bridge_user->playing_moh = 0; ast_moh_stop(conference_bridge_user->chan); ast_bridge_unsuspend(conference_bridge->bridge, conference_bridge_user->chan); - if (!conference_bridge_user->forced_mute) { - conference_bridge_user->features.mute = 0; - } + conference_bridge_user->features.mute = conference_bridge_user->forced_mute; } else { return -1; } @@ -1191,7 +1189,7 @@ continue; /* Waiting for marked user and one's already here */ } } - if (!other_participant->forced_moh && !other_participant->playing_moh) { + if (!other_participant->playing_moh && !other_participant->forced_moh) { if (!ast_bridge_suspend(conference_bridge->bridge, other_participant->chan)) { ast_moh_start(other_participant->chan, other_participant->u_profile.moh_class, NULL); other_participant->playing_moh = 1; @@ -1591,6 +1589,9 @@ ast_autoservice_stop(chan); if (conference_bridge_user.playing_moh || conference_bridge_user.forced_moh) { ast_moh_start(chan, conference_bridge_user.u_profile.moh_class, NULL); + conference_bridge_user.features.mute = 1; + }else{ + conference_bridge_user.features.mute = conference_bridge_user.forced_mute; } } @@ -1996,6 +1997,9 @@ ao2_lock(conference_bridge); if (conference_bridge_user->playing_moh || conference_bridge_user->forced_moh) { ast_moh_start(bridge_channel->chan, conference_bridge_user->u_profile.moh_class, NULL); + conference_bridge_user->features.mute = 1; + }else{ + conference_bridge_user->features.mute = conference_bridge_user->forced_mute; } ao2_unlock(conference_bridge); @@ -2185,23 +2189,23 @@ } } if (participant) { - if (moh && (!participant->playing_moh && !participant->forced_moh)) { - if (!ast_bridge_suspend(bridge->bridge, participant->chan)) { - ast_moh_start(participant->chan, participant->u_profile.moh_class, NULL); - participant->playing_moh = 1; - ast_bridge_unsuspend(bridge->bridge, participant->chan); - } - } else if (!moh && participant->playing_moh) { - if (!ast_bridge_suspend(bridge->bridge, participant->chan)) { - ast_moh_stop(participant->chan); - ast_bridge_unsuspend(bridge->bridge, participant->chan); - } - } - participant->forced_moh = moh; - if (!participant->forced_mute) { - participant->features.mute = moh; + if (!participant->playing_moh) { /* If the participant is playing MoH naturally, let it do its thing */ + if (moh && !participant->forced_moh) { + if (!ast_bridge_suspend(bridge->bridge, participant->chan)) { + ast_moh_start(participant->chan, participant->u_profile.moh_class, NULL); + ast_bridge_unsuspend(bridge->bridge, participant->chan); + } + } else if (!moh && participant->forced_moh) { + if (!ast_bridge_suspend(bridge->bridge, participant->chan)) { + ast_moh_stop(participant->chan); + ast_bridge_unsuspend(bridge->bridge, participant->chan); + } + } } - ast_test_suite_event_notify("CONF_HOLD", "Message: participant %s %s\r\nConference: %s\r\nChannel: %s", ast_channel_name(participant->chan), participant->forced_moh ? "moh-on" : "moh-off", bridge->b_profile.name, ast_channel_name(participant->chan)); + /* Set flags regardless of natural state */ + participant->forced_moh = moh; + participant->features.mute = moh | participant->forced_mute; + ast_test_suite_event_notify("CONF_HOLD", "Message: participant %s %s\r\nConference: %s\r\nChannel: %s", ast_channel_name(participant->chan), moh ? "moh-on" : "moh-off", bridge->b_profile.name, ast_channel_name(participant->chan)); } else { res = -2;; } @@ -2323,10 +2327,14 @@ if (!ast_bridge_suspend(specifier->bridge->bridge, specifier->participant->chan)) { if(specifier->participant->playing_moh || specifier->participant->forced_moh){ ast_moh_stop(specifier->participant->chan); + specifier->participant->features.mute = specifier->participant->forced_mute; } ast_stream_and_wait(specifier->participant->chan, (const char *)&specifier->file, ""); if(specifier->participant->playing_moh || specifier->participant->forced_moh){ ast_moh_start(specifier->participant->chan, specifier->participant->u_profile.moh_class, NULL); + specifier->participant->features.mute = 1; + }else{ + specifier->participant->features.mute = specifier->participant->forced_mute; } ast_bridge_unsuspend(specifier->bridge->bridge, specifier->participant->chan); }