[asterisk-commits] mjordan: branch mjordan/AST_18204 r340930 - in /team/mjordan/AST_18204: ./ ap...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 14 13:14:07 CDT 2011


Author: mjordan
Date: Fri Oct 14 13:14:02 2011
New Revision: 340930

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=340930
Log:
Branched

Added:
    team/mjordan/AST_18204/
      - copied from r340880, trunk/
Modified:
    team/mjordan/AST_18204/CHANGES
    team/mjordan/AST_18204/apps/app_confbridge.c
    team/mjordan/AST_18204/apps/confbridge/conf_config_parser.c
    team/mjordan/AST_18204/apps/confbridge/include/confbridge.h
    team/mjordan/AST_18204/configs/confbridge.conf.sample

Modified: team/mjordan/AST_18204/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/AST_18204/CHANGES?view=diff&rev=340930&r1=340880&r2=340930
==============================================================================
--- team/mjordan/AST_18204/CHANGES (original)
+++ team/mjordan/AST_18204/CHANGES Fri Oct 14 13:14:02 2011
@@ -11,6 +11,15 @@
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 10 to Asterisk 11 --------------------
 ------------------------------------------------------------------------------
+
+ConfBridge
+-------------------
+ * Added menu action admin_toggle_mute_participants.  This will mute / unmute
+   all participants on a conference.  The confbridge configuration file also
+   allows for the default sounds played to all conference users when this occurs
+   to be overriden using sound_participants_unmuted and sound_participants_muted.
+ * Added menu action participant_count.  This will playback the number of current
+   participants in a conference.
 
 SIP Changes
 -----------

Modified: team/mjordan/AST_18204/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/AST_18204/apps/app_confbridge.c?view=diff&rev=340930&r1=340880&r2=340930
==============================================================================
--- team/mjordan/AST_18204/apps/app_confbridge.c (original)
+++ team/mjordan/AST_18204/apps/app_confbridge.c Fri Oct 14 13:14:02 2011
@@ -340,6 +340,10 @@
 		return S_OR(custom_sounds->join, "confbridge-join");
 	case CONF_SOUND_LEAVE:
 		return S_OR(custom_sounds->leave, "confbridge-leave");
+	case CONF_SOUND_PARTICIPANTS_MUTED:
+		return S_OR(custom_sounds->participantsmuted, "conf-now-muted");
+	case CONF_SOUND_PARTICIPANTS_UNMUTED:
+		return S_OR(custom_sounds->participantsunmuted, "conf-now-unmuted");
 	}
 
 	return "";
@@ -1548,6 +1552,37 @@
 		"");
 }
 
+static int action_toggle_mute_participants(struct conference_bridge *conference_bridge, struct conference_bridge_user *conference_bridge_user)
+{
+	struct conference_bridge_user *participant = NULL;
+
+	ao2_lock(conference_bridge);
+
+	/* 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)) {
+			participant->features.mute = conference_bridge->muted;
+		}
+	}
+
+	/* The host needs to hear it seperately, as they don't get the audio from play_sound_helper */
+	ast_stream_and_wait(conference_bridge_user->chan, (conference_bridge->muted ?
+		conf_get_sound(CONF_SOUND_PARTICIPANTS_MUTED, conference_bridge_user->b_profile.sounds) :
+		conf_get_sound(CONF_SOUND_PARTICIPANTS_UNMUTED, conference_bridge_user->b_profile.sounds)),
+		"");
+
+	/* Announce to the group that all participants are muted. */
+	play_sound_helper(conference_bridge, (conference_bridge->muted ?
+		conf_get_sound(CONF_SOUND_PARTICIPANTS_MUTED, conference_bridge_user->b_profile.sounds) :
+		conf_get_sound(CONF_SOUND_PARTICIPANTS_UNMUTED, conference_bridge_user->b_profile.sounds)),
+		0);
+
+	ao2_unlock(conference_bridge);
+	return 0;
+}
+
 static int action_playback(struct ast_bridge_channel *bridge_channel, const char *playback_file)
 {
 	char *file_copy = ast_strdupa(playback_file);
@@ -1726,6 +1761,15 @@
 			res |= action_toggle_mute(conference_bridge,
 				conference_bridge_user,
 				bridge_channel->chan);
+			break;
+		case MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS:
+			if (!isadmin) {
+				break;
+			}
+			action_toggle_mute_participants(conference_bridge, conference_bridge_user);
+			break;
+		case MENU_ACTION_PARTICIPANT_COUNT:
+			announce_user_count(conference_bridge, conference_bridge_user);
 			break;
 		case MENU_ACTION_PLAYBACK:
 			if (!stop_prompts) {
@@ -1944,14 +1988,15 @@
 			ast_cli(a->fd, "No conference bridge named '%s' found!\n", a->argv[2]);
 			return CLI_SUCCESS;
 		}
-		ast_cli(a->fd, "Channel                       User Profile     Bridge Profile   Menu\n");
-		ast_cli(a->fd, "============================= ================ ================ ================\n");
+		ast_cli(a->fd, "Channel                       User Profile     Bridge Profile   Menu             CallerID\n");
+		ast_cli(a->fd, "============================= ================ ================ ================ ================\n");
 		ao2_lock(bridge);
 		AST_LIST_TRAVERSE(&bridge->users_list, participant, list) {
 			ast_cli(a->fd, "%-29s ", participant->chan->name);
 			ast_cli(a->fd, "%-17s", participant->u_profile.name);
 			ast_cli(a->fd, "%-17s", participant->b_profile.name);
 			ast_cli(a->fd, "%-17s", participant->menu_name);
+			ast_cli(a->fd, "%-17s", S_COR(participant->chan->caller.id.number.valid, participant->chan->caller.id.number.str, "<unknown>"));
 			ast_cli(a->fd, "\n");
 		}
 		ao2_unlock(bridge);

Modified: team/mjordan/AST_18204/apps/confbridge/conf_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/AST_18204/apps/confbridge/conf_config_parser.c?view=diff&rev=340930&r1=340880&r2=340930
==============================================================================
--- team/mjordan/AST_18204/apps/confbridge/conf_config_parser.c (original)
+++ team/mjordan/AST_18204/apps/confbridge/conf_config_parser.c Fri Oct 14 13:14:02 2011
@@ -253,6 +253,10 @@
 		ast_string_field_set(sounds, join, sound_file);
 	} else if (!strcasecmp(sound_name, "sound_leave")) {
 		ast_string_field_set(sounds, leave, sound_file);
+	} else if (!strcasecmp(sound_name, "sound_participants_muted")) {
+		ast_string_field_set(sounds, participantsmuted, sound_file);
+	} else if (!strcasecmp(sound_name, "sound_participants_unmuted")) {
+		ast_string_field_set(sounds, participantsunmuted, sound_file);
 	} else {
 		return -1;
 	}
@@ -315,7 +319,7 @@
 		}
 		/* Using a bridge profile as a template is a little complicated due to the sounds. Since the sounds
 		 * structure of a dynamic profile will need to be altered, a completely new sounds structure must be
-		 * create instead of simply holding a reference to the one built by the config file. */
+		 * created instead of simply holding a reference to the one built by the config file. */
 		ast_string_field_set(sounds, onlyperson, tmp->sounds->onlyperson);
 		ast_string_field_set(sounds, hasjoin, tmp->sounds->hasjoin);
 		ast_string_field_set(sounds, hasleft, tmp->sounds->hasleft);
@@ -332,6 +336,8 @@
 		ast_string_field_set(sounds, unlockednow, tmp->sounds->unlockednow);
 		ast_string_field_set(sounds, lockednow, tmp->sounds->lockednow);
 		ast_string_field_set(sounds, errormenu, tmp->sounds->errormenu);
+		ast_string_field_set(sounds, participantsmuted, tmp->sounds->participantsmuted);
+		ast_string_field_set(sounds, participantsunmuted, tmp->sounds->participantsunmuted);
 
 		ao2_ref(tmp->sounds, -1); /* sounds struct copied over to it from the template by reference only. */
 		ao2_ref(oldsounds,-1);    /* original sounds struct we don't need anymore */
@@ -540,6 +546,8 @@
 	case MENU_ACTION_RESET_LISTENING:
 	case MENU_ACTION_RESET_TALKING:
 	case MENU_ACTION_ADMIN_TOGGLE_LOCK:
+	case MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS:
+	case MENU_ACTION_PARTICIPANT_COUNT:
 	case MENU_ACTION_ADMIN_KICK_LAST:
 	case MENU_ACTION_LEAVE:
 	case MENU_ACTION_SET_SINGLE_VIDEO_SRC:
@@ -655,6 +663,10 @@
 			res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_DECREASE_TALKING, NULL);
 		} else if (!strcasecmp(action, "admin_toggle_conference_lock")) {
 			res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_ADMIN_TOGGLE_LOCK, NULL);
+		} else if (!strcasecmp(action, "admin_toggle_mute_participants")) {
+			res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS, NULL);
+		} else if (!strcasecmp(action, "participant_count")) {
+			res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_PARTICIPANT_COUNT, NULL);
 		} else if (!strcasecmp(action, "admin_kick_last")) {
 			res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_ADMIN_KICK_LAST, NULL);
 		} else if (!strcasecmp(action, "leave_conference")) {
@@ -1025,6 +1037,8 @@
 	ast_cli(a->fd,"sound_unlocked_now:   %s\n", conf_get_sound(CONF_SOUND_UNLOCKED_NOW, b_profile.sounds));
 	ast_cli(a->fd,"sound_lockednow:      %s\n", conf_get_sound(CONF_SOUND_LOCKED_NOW, b_profile.sounds));
 	ast_cli(a->fd,"sound_error_menu:     %s\n", conf_get_sound(CONF_SOUND_ERROR_MENU, b_profile.sounds));
+	ast_cli(a->fd,"sound_participants_muted:     %s\n", conf_get_sound(CONF_SOUND_PARTICIPANTS_MUTED, b_profile.sounds));
+	ast_cli(a->fd,"sound_participants_unmuted:     %s\n", conf_get_sound(CONF_SOUND_PARTICIPANTS_UNMUTED, b_profile.sounds));
 	ast_cli(a->fd,"\n");
 
 	conf_bridge_profile_destroy(&b_profile);
@@ -1160,6 +1174,12 @@
 			case MENU_ACTION_ADMIN_TOGGLE_LOCK:
 				ast_cli(a->fd, "admin_toggle_conference_lock");
 				break;
+			case MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS:
+				ast_cli(a->fd, "admin_toggle_mute_participants");
+				break;
+			case MENU_ACTION_PARTICIPANT_COUNT:
+				ast_cli(a->fd, "participant_count");
+				break;
 			case MENU_ACTION_ADMIN_KICK_LAST:
 				ast_cli(a->fd, "admin_kick_last");
 				break;

Modified: team/mjordan/AST_18204/apps/confbridge/include/confbridge.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/AST_18204/apps/confbridge/include/confbridge.h?view=diff&rev=340930&r1=340880&r2=340930
==============================================================================
--- team/mjordan/AST_18204/apps/confbridge/include/confbridge.h (original)
+++ team/mjordan/AST_18204/apps/confbridge/include/confbridge.h Fri Oct 14 13:14:02 2011
@@ -83,6 +83,8 @@
 	MENU_ACTION_NOOP,
 	MENU_ACTION_SET_SINGLE_VIDEO_SRC,
 	MENU_ACTION_RELEASE_SINGLE_VIDEO_SRC,
+	MENU_ACTION_PARTICIPANT_COUNT,
+	MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS,
 };
 
 /*! The conference menu action contains both
@@ -156,6 +158,8 @@
 	CONF_SOUND_ERROR_MENU,
 	CONF_SOUND_JOIN,
 	CONF_SOUND_LEAVE,
+	CONF_SOUND_PARTICIPANTS_MUTED,
+	CONF_SOUND_PARTICIPANTS_UNMUTED,
 };
 
 struct bridge_profile_sounds {
@@ -180,6 +184,8 @@
 		AST_STRING_FIELD(errormenu);
 		AST_STRING_FIELD(leave);
 		AST_STRING_FIELD(join);
+		AST_STRING_FIELD(participantsmuted);
+		AST_STRING_FIELD(participantsunmuted);
 	);
 };
 
@@ -202,6 +208,7 @@
 	unsigned int users;                                               /*!< Number of users present */
 	unsigned int markedusers;                                         /*!< Number of marked users present */
 	unsigned int locked:1;                                            /*!< Is this conference bridge locked? */
+	unsigned int muted:1;                                            /*!< Is this conference bridge muted? */
 	struct ast_channel *playback_chan;                                /*!< Channel used for playback into the conference bridge */
 	struct ast_channel *record_chan;                                  /*!< Channel used for recording the conference */
 	pthread_t record_thread;                                          /*!< The thread the recording chan lives in */

Modified: team/mjordan/AST_18204/configs/confbridge.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/AST_18204/configs/confbridge.conf.sample?view=diff&rev=340930&r1=340880&r2=340930
==============================================================================
--- team/mjordan/AST_18204/configs/confbridge.conf.sample (original)
+++ team/mjordan/AST_18204/configs/confbridge.conf.sample Fri Oct 14 13:14:02 2011
@@ -229,6 +229,8 @@
 ;sound_locked_now ; The sound played to an admin after toggling the conference to locked mode.
 ;sound_unlocked_now; The sound played to an admin after toggling the conference to unlocked mode.
 ;sound_error_menu ; The sound played when an invalid menu option is entered.
+;sound_participants_muted ; The sound played when all participants are muted
+;sound_participants_unmuted ; The sound played when all participants are unmuted
 
 ; --- ConfBridge Menu Options ---
 ; The ConfBridge application also has the ability to
@@ -288,7 +290,13 @@
 ; admin_toggle_conference_lock ; This action allows an Admin to toggle locking and
                                ; unlocking the conference.  Non admins can not use
                                ; this action even if it is in their menu.
-
+;
+; admin_toggle_mute_participants ; This action allows an Admin to mute or unmute
+                                 ; all participants on the conference
+;
+; participant_count ; This action plays the number of participants currently
+                    ; on the conference
+;
 ; set_as_single_video_src   ; This action allows any user to set themselves as the
                             ; single video source distributed to all participants.
                             ; This will make the video feed stick to them regardless




More information about the asterisk-commits mailing list