Summary:ASTERISK-18204: Mute All Participants
Reporter:Kevin Reeves (superkvn)Labels:
Date Opened:2011-07-28 12:45:32Date Closed:2011-11-17 12:09:53.000-0600
Versions:10.0.0-beta1 Frequency of
is related toASTERISK-20987 non-admin users, who join muted conference are not being muted
Environment:CentOSAttachments:( 0) app_confbridge.c.patch.txt
( 1) conf_config_parser.c.patch.txt
( 2) confbridge.h.patch.txt
Description:i'm working on a new menu feature in ConfBridge to allow a host to mute all participants. I have it working correctly. As I'm looping through the bridge's user list, I want to play a message to the participant saying that their line has been muted. When I play the message, it's very garbled sound quality.

Inside of the function execute_menu_entry in app_confbridge.c, I'm doing this:

   action_toggle_mute_participants(conference_bridge, conference_bridge_user);

Which calls a function that looks like this:

static int action_toggle_mute_participants(struct conference_bridge *conference_bridge, struct conference_bridge_user *conference_bridge_user)
       struct conference_bridge_user *participant = NULL;


       /* If already muted, then unmute. */
       conference_bridge->muted = (!conference_bridge->muted ? 1 : 0);

       AST_LIST_TRAVERSE(&conference_bridge->users_list, participant, list) {
               if (!ast_test_flag(&participant->u_profile, USER_OPT_ADMIN)) {
                       ast_log(LOG_WARNING, "Un/Muting channel %s of conf %s.\n", participant->chan->name, conference_bridge->name);
                       participant->features.mute = conference_bridge->muted;
                       /* for some reason this audio sounds terrible when played to the participant */
                       ast_streamfile(participant->chan, (participant->features.mute ?
                               conf_get_sound(CONF_SOUND_MUTED, participant->b_profile.sounds) :
                               conf_get_sound(CONF_SOUND_UNMUTED, participant->b_profile.sounds)),
       ast_stream_and_wait(conference_bridge_user->chan, (conference_bridge->muted ?
               "conf-participants-muted" :
               "conf-participants-unmuted" ),
               "" );

       return 0;

The ast_streamfile function runs on the proper channels (the participant channels), but the sound quality is extremely poor quality.

I've verified that the audio files play correctly in Asterisk outside of this function, so it seems almost like playing the file inside the loop is causing problems.
Comments:By: David Vossel (dvossel) 2011-07-28 13:16:04.092-0500

I think you'll have to temporarily suspend everyone from the bridge as each sound is played.  As you have it there, the sounds are getting played back and they are probably getting all messed up with the conference audio as well.

You could potentially get around this by running through the list and muting everyone, then playing a global sound to the entire conference saying everyone is muted.  

By: Kevin Reeves (superkvn) 2011-07-28 17:56:23.855-0500

I updated the code to play a global sound to the entire conference.  The code now looks like this:

<inline code snipped by lmadsen>

The problem here is that the global audio isn't played to the host.  His line is silent while the audio is played to everyone else.  Any suggestions on how to make that better?

By: David Woolley (davidw) 2011-07-29 05:25:17.626-0500

Patches need to be attached, after doing Sign Licence, not inline in comments.  They also need to be unified diffs.  In the case of a new feature, like this, they need to be diffs against he SVN trunk version.

By: Kevin Reeves (superkvn) 2011-07-29 07:30:46.116-0500

I will happily supply the diffs, but I was hoping to get the last piece fixed first.  I have one last lingering question that I'm hoping you can help me with.  I asked the question at the bottom of the comment which was a mistake because it was hard to see.  My fault.

The problem here is that the global audio isn't played to the host. His line is silent while the audio is played to everyone else. Any suggestions on how to make that better?

By: Kevin Reeves (superkvn) 2011-08-02 14:30:50.246-0500

Attached are the patch files to enable this feature.

By: Kevin Reeves (superkvn) 2011-08-02 14:32:21.580-0500

I have signed my license agreement, but have not received final word if it's been processed yet.  I went ahead and attached the patches for the feature.

By: Leif Madsen (lmadsen) 2011-08-30 15:32:21.561-0500

Everything looks good here in terms of license stuff. Just need to get someone to review / test this now. Thanks for the contribution!

By: Matt Jordan (mjordan) 2011-10-11 14:36:54.521-0500


I've reviewed your patch and submitted it to the Asterisk developer community on ReviewBoard.  The only significant modifications I made were:
1) To use the existing conference sound files conf-now-muted and conf-now-unmuted for muting / unmuting all participants
2) Reversing the order of who gets the sound played first, the bridge or the participant (admin) channel.  I noticed that when the bridge is played first, there can be (if the sound file is a few seconds long) a bit of a delay for the admin before they receive confirmation of the mute / unmute.  In order to prevent the admin from mashing the button subsequent times, I made it so they were notified first.


By: Matt Jordan (mjordan) 2011-11-03 12:09:28.163-0500


We need a piece of information before we proceed with committing the patch (see the conversation on review board here: https://reviewboard.asterisk.org/r/1518/).  Is the expected behavior to have all non-admin users muted, but the admins unmuted?  If so, that's fine, but we'll change the documentation of the feature to reflect that.  Right now, with the playback of 'the conference is now muted' to both admins and non-admins, it implies that the admins are also muted - which could lead to embarrassing situations.

By: Kevin Reeves (superkvn) 2011-11-14 16:18:18.645-0600

Sorry for my delayed response.  I had issues on the ticket that stopped me from responding immediately.

The expected behavior is to mute all the non-admins (aka. participants) and leave the admins (aka. hosts) un-muted.

This is especially useful when the host is doing a presentation to a large group of people and doesn't want them bringing noise onto the line.

By: Matt Jordan (mjordan) 2011-11-16 08:36:51.096-0600

Right now, with the way the patch is, all users (including admins) will hear a prompt saying "the conference is now muted".  The fear is that admins will think they are muted when they are not.

I see two paths forward:
1) Document that this is how it works and that admins are *not* muted, and go with the patch as is
2) Break 'admins' into two groups - the admin that pressed 'mute all' and other admins.  Other admins are muted automatically, and can unmute themselves if they want to using DTMF keys.  The admin that pressed 'mute all' however is still unmuted.

Which would you prefer?

By: Kevin Reeves (superkvn) 2011-11-16 10:23:47.376-0600

I would suggest that the recording say "All participants are now muted."  And then add documentation that says all the admins remain unmuted.