[asterisk-commits] dvossel: branch dvossel/hd_confbridge r310880 - in /team/dvossel/hd_confbridg...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 15 11:37:02 CDT 2011


Author: dvossel
Date: Tue Mar 15 11:36:57 2011
New Revision: 310880

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=310880
Log:
Addes max_members option to ConfBridge bridge profiles

Modified:
    team/dvossel/hd_confbridge/apps/app_confbridge.c
    team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
    team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
    team/dvossel/hd_confbridge/configs/confbridge.conf.sample

Modified: team/dvossel/hd_confbridge/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/app_confbridge.c?view=diff&rev=310880&r1=310879&r2=310880
==============================================================================
--- team/dvossel/hd_confbridge/apps/app_confbridge.c (original)
+++ team/dvossel/hd_confbridge/apps/app_confbridge.c Tue Mar 15 11:36:57 2011
@@ -466,6 +466,7 @@
 	struct conference_bridge *conference_bridge = NULL;
 	struct conference_bridge tmp;
 	int start_record = 0;
+	int max_members_reached = 0;
 
 	ast_copy_string(tmp.name, name, sizeof(tmp.name));
 
@@ -476,6 +477,10 @@
 
 	/* Attempt to find an existing conference bridge */
 	conference_bridge = ao2_find(conference_bridges, &tmp, OBJ_POINTER);
+
+	if (conference_bridge && conference_bridge->b_profile.max_members) {
+		max_members_reached = conference_bridge->b_profile.max_members > conference_bridge->users ? 0 : 1;
+	}
 
 	if (conference_bridge && strcasecmp(conference_bridge->b_profile.name, conference_bridge_user->b_profile.name)) {
 		ast_log(LOG_ERROR, "Conference bridge '%s' found, but user bridge profile %s does not match the conference's bridge profile %s\n",
@@ -488,7 +493,7 @@
 	}
 
 	/* When finding a conference bridge that already exists make sure that it is not locked, and if so that we are not an admin */
-	if (conference_bridge && conference_bridge->locked && !ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_ADMIN)) {
+	if (conference_bridge && (max_members_reached || conference_bridge->locked) && !ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_ADMIN)) {
 		ao2_unlock(conference_bridges);
 		ao2_ref(conference_bridge, -1);
 		ast_debug(1, "Conference bridge '%s' is locked and caller is not an admin\n", name);

Modified: team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c?view=diff&rev=310880&r1=310879&r2=310880
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c Tue Mar 15 11:36:57 2011
@@ -144,6 +144,7 @@
 	/* set defaults */
 	b_profile->internal_sample_rate = 0;
 	b_profile->flags = 0;
+	b_profile->max_members = 0;
 
 	for (var = ast_variable_browse(cfg, cat); var; var = var->next) {
 		if (!strcasecmp(var->name, "internal_sample_rate")) {
@@ -159,6 +160,11 @@
 			b_profile->flags = ast_true(var->value) ?
 				b_profile->flags | BRIDGE_OPT_RECORD_CONFERENCE :
 				b_profile->flags & ~BRIDGE_OPT_RECORD_CONFERENCE;
+		} else if (!strcasecmp(var->name, "max_members")) {
+			if (sscanf(var->value, "%30u", &b_profile->max_members) != 1) {
+				ast_log(LOG_WARNING, "max_members '%s' at line %d of %s is not supported.\n",
+						var->value, var->lineno, CONF_CONFIG);
+			}
 		} else {
 			ast_log(LOG_WARNING, "Unknown option '%s' at line %d of %s is not supported.\n",
 				var->name, var->lineno, CONF_CONFIG);
@@ -544,6 +550,11 @@
 	ast_cli(a->fd,"Record Conference:    %s\n",
 		b_profile.flags & BRIDGE_OPT_RECORD_CONFERENCE ?
 		"yes" : "no");
+	if (b_profile.max_members) {
+		ast_cli(a->fd,"Max Members:          %d\n", b_profile.max_members);
+	} else {
+		ast_cli(a->fd,"Max Members:          No Limit\n");
+	}
 	if (b_profile.internal_sample_rate) {
 		snprintf(tmp, sizeof(tmp), "%d", b_profile.internal_sample_rate);
 	} else {

Modified: team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h?view=diff&rev=310880&r1=310879&r2=310880
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h Tue Mar 15 11:36:57 2011
@@ -109,7 +109,8 @@
 struct bridge_profile {
 	char name[64];
 	unsigned int flags;
-	unsigned int internal_sample_rate;     /*!< The internal sample rate of the bridge. 0 when set to auto adjust mode. */
+	unsigned int max_members;          /*!< The maximum number of participants allowed in the conference */
+	unsigned int internal_sample_rate; /*!< The internal sample rate of the bridge. 0 when set to auto adjust mode. */
 	int delme;
 };
 

Modified: team/dvossel/hd_confbridge/configs/confbridge.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/configs/confbridge.conf.sample?view=diff&rev=310880&r1=310879&r2=310880
==============================================================================
--- team/dvossel/hd_confbridge/configs/confbridge.conf.sample (original)
+++ team/dvossel/hd_confbridge/configs/confbridge.conf.sample Tue Mar 15 11:36:57 2011
@@ -40,6 +40,13 @@
 ; --- ConfBridge Bridge Profile Options ---
 [default_bridge]
 type=bridge
+;max_members=50                ; This option limits the number of participants for a single
+                               ; conference to a specific number.  By default conferences
+                               ; have no participant limit. After the limit is reached, the
+                               ; conference will be locked until someone leaves.  Note however
+                               ; that an Admin user will always be alowed to join the conference
+                               ; regardless if this limit is reached or not.
+
 ;record_conference=yes         ; Records the conference call starting when the first user
                                ; enters the room, and ending when the last user exits the room.
                                ; The default recorded filename is




More information about the asterisk-commits mailing list