Revision
16597
Author
mikej
Date
2010-02-09 22:50:31 -0600 (Tue, 09 Feb 2010)

Log Message

mod_conference add conference_max_members channel variable that can be set on the first channel calling a conference to override the profiles max-members param

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (16596 => 16597)


--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	2010-02-10 03:26:29 UTC (rev 16596)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	2010-02-10 04:50:31 UTC (rev 16597)
@@ -5234,6 +5234,8 @@
 
 		/* if the conference exists, get the pointer to it */
 		if (!conference) {
+			const char *max_members_str;
+
 			/* couldn't find the conference, create one */
 			conference = conference_new(conf_name, xml_cfg, NULL);
 
@@ -5260,6 +5262,19 @@
 			/* Set the minimum number of members (once you go above it you cannot go below it) */
 			conference->min = 1;
 
+			/* check for variable used to specify override for max_members */
+			if (!zstr(max_members_str = switch_channel_get_variable(channel, "conference_max_members"))) {
+				uint32_t max_members_val;
+				errno = 0;		/* sanity first */
+				max_members_val = strtol(max_members_str, NULL, 0);	/* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */
+				if (errno == ERANGE || errno == EINVAL || max_members_val < 0 || max_members_val == 1) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+									  "conference_max_members variable %s is invalid, not setting a limit\n", max_members_str);
+				} else {
+					conference->max_members = max_members_val;
+				}
+			}
+
 			/* Indicate the conference is dynamic */
 			switch_set_flag_locked(conference, CFLAG_DYNAMIC);