Merge pull request #656 in FS/freeswitch from mod_conf_enhancements to master

* commit 'c39fbb295f6b9bc01baa5dbfc578e12022c088ae':
  FS-8704: Add min-members, wait-min-members-timeout, wait-mod-timeout, wait-min-members-timeout-message, wait-mod-timeout-message, endconf-mod-exit-message, and endconf-message parameters and functionality to mod_conference.
This commit is contained in:
Mike Jerris 2016-04-11 12:00:37 -05:00
commit beada9b0cb
5 changed files with 206 additions and 17 deletions

View File

@ -91,7 +91,7 @@ api_command_t conference_api_sub_commands[] = {
{"pin", (void_fn_t) & conference_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "pin", "<pin#>"}, {"pin", (void_fn_t) & conference_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "pin", "<pin#>"},
{"nopin", (void_fn_t) & conference_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "nopin", ""}, {"nopin", (void_fn_t) & conference_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "nopin", ""},
{"get", (void_fn_t) & conference_api_sub_get, CONF_API_SUB_ARGS_SPLIT, "get", "<parameter-name>"}, {"get", (void_fn_t) & conference_api_sub_get, CONF_API_SUB_ARGS_SPLIT, "get", "<parameter-name>"},
{"set", (void_fn_t) & conference_api_sub_set, CONF_API_SUB_ARGS_SPLIT, "set", "<max_members|sound_prefix|caller_id_name|caller_id_number|endconference_grace_time> <value>"}, {"set", (void_fn_t) & conference_api_sub_set, CONF_API_SUB_ARGS_SPLIT, "set", "<max_members|min_members|wait_min_members_timeout|wait_mod_timeout|sound_prefix|caller_id_name|caller_id_number|endconference_grace_time> <value>"},
{"file-vol", (void_fn_t) & conference_api_sub_file_vol, CONF_API_SUB_ARGS_SPLIT, "file-vol", "<vol#>"}, {"file-vol", (void_fn_t) & conference_api_sub_file_vol, CONF_API_SUB_ARGS_SPLIT, "file-vol", "<vol#>"},
{"floor", (void_fn_t) & conference_api_sub_floor, CONF_API_SUB_MEMBER_TARGET, "floor", "<member_id|last>"}, {"floor", (void_fn_t) & conference_api_sub_floor, CONF_API_SUB_MEMBER_TARGET, "floor", "<member_id|last>"},
{"vid-floor", (void_fn_t) & conference_api_sub_vid_floor, CONF_API_SUB_MEMBER_TARGET, "vid-floor", "<member_id|last> [force]"}, {"vid-floor", (void_fn_t) & conference_api_sub_vid_floor, CONF_API_SUB_MEMBER_TARGET, "vid-floor", "<member_id|last> [force]"},
@ -2738,6 +2738,15 @@ switch_status_t conference_api_sub_get(conference_obj_t *conference,
} else if (strcasecmp(argv[2], "count_ghosts") == 0) { } else if (strcasecmp(argv[2], "count_ghosts") == 0) {
stream->write_function(stream, "%d", stream->write_function(stream, "%d",
conference->count_ghosts); conference->count_ghosts);
} else if (strcasecmp(argv[2], "min_members") == 0) {
stream->write_function(stream, "%d",
conference->min_members);
} else if (strcasecmp(argv[2], "wait_min_members_timeout") == 0) {
stream->write_function(stream, "%d",
conference->wait_min_members_timeout);
} else if (strcasecmp(argv[2], "wait_mod_timeout") == 0) {
stream->write_function(stream, "%d",
conference->wait_mod_timeout);
} else if (strcasecmp(argv[2], "max_members") == 0) { } else if (strcasecmp(argv[2], "max_members") == 0) {
stream->write_function(stream, "%d", stream->write_function(stream, "%d",
conference->max_members); conference->max_members);
@ -2792,6 +2801,30 @@ switch_status_t conference_api_sub_set(conference_obj_t *conference,
} else { } else {
ret_status = SWITCH_STATUS_FALSE; ret_status = SWITCH_STATUS_FALSE;
} }
} else if (strcasecmp(argv[2], "min_members") == 0) {
int new_min = atoi(argv[3]);
if (new_min >= 0 && (!conference->count || conference_utils_test_flag(conference, CFLAG_WAIT_MIN_MEMBERS))) {
stream->write_function(stream, "%d", conference->min_members);
conference->min_members = new_min;
} else {
ret_status = SWITCH_STATUS_FALSE;
}
} else if (strcasecmp(argv[2], "wait_min_members_timeout") == 0) {
int32_t new_min = atoll(argv[3]);
if (new_min >= 0 && (!conference->count || conference_utils_test_flag(conference, CFLAG_WAIT_MIN_MEMBERS))) {
stream->write_function(stream, "%d", conference->wait_min_members_timeout);
conference->wait_min_members_timeout = new_min;
} else {
ret_status = SWITCH_STATUS_FALSE;
}
} else if (strcasecmp(argv[2], "wait_mod_timeout") == 0) {
int32_t new_timeout = atoll(argv[3]);
if (new_timeout >= 0 && conference_utils_test_flag(conference, CFLAG_WAIT_MOD)) {
stream->write_function(stream, "%d", conference->wait_mod_timeout);
conference->wait_mod_timeout = new_timeout;
} else {
ret_status = SWITCH_STATUS_FALSE;
}
} else if (strcasecmp(argv[2], "sound_prefix") == 0) { } else if (strcasecmp(argv[2], "sound_prefix") == 0) {
stream->write_function(stream, "%s",conference->sound_prefix); stream->write_function(stream, "%s",conference->sound_prefix);
conference->sound_prefix = switch_core_strdup(conference->pool, argv[3]); conference->sound_prefix = switch_core_strdup(conference->pool, argv[3]);

View File

@ -969,7 +969,8 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
/* skip frames that are not actual media or when we are muted or silent */ /* skip frames that are not actual media or when we are muted or silent */
if ((conference_utils_member_test_flag(member, MFLAG_TALKING) || member->energy_level == 0 || conference_utils_test_flag(member->conference, CFLAG_AUDIO_ALWAYS)) if ((conference_utils_member_test_flag(member, MFLAG_TALKING) || member->energy_level == 0 || conference_utils_test_flag(member->conference, CFLAG_AUDIO_ALWAYS))
&& conference_utils_member_test_flag(member, MFLAG_CAN_SPEAK) && !conference_utils_test_flag(member->conference, CFLAG_WAIT_MOD) && conference_utils_member_test_flag(member, MFLAG_CAN_SPEAK) && !conference_utils_test_flag(member->conference, CFLAG_WAIT_MOD)
&& (member->conference->count > 1 || (member->conference->record_count && member->conference->count >= member->conference->min_recording_participants))) { && (!conference_utils_test_flag(member->conference, CFLAG_WAIT_MIN_MEMBERS) || (member->conference->record_count && member->conference->count >= member->conference->min_recording_participants))) {
switch_audio_resampler_t *read_resampler = member->read_resampler; switch_audio_resampler_t *read_resampler = member->read_resampler;
void *data; void *data;
uint32_t datalen; uint32_t datalen;
@ -1377,6 +1378,25 @@ void conference_loop_output(conference_member_t *member)
switch_cond_next(); switch_cond_next();
} }
if (member->conference->wait_min_members_timeout && switch_epoch_time_now(NULL) - member->join_time >= member->conference->wait_min_members_timeout &&
conference_utils_test_flag(member->conference, CFLAG_WAIT_MIN_MEMBERS))
{
if (!zstr(member->conference->wait_min_members_timeout_message)) {
conference_member_play_file(member, member->conference->wait_min_members_timeout_message, 0, SWITCH_TRUE);
}
member->loop_loop = SWITCH_FALSE;
break;
}
if (member->conference->wait_mod_timeout && switch_epoch_time_now(NULL) - member->join_time >= member->conference->wait_mod_timeout &&
conference_utils_test_flag(member->conference, CFLAG_WAIT_MOD))
{
if (!zstr(member->conference->wait_mod_timeout_message)) {
conference_member_play_file(member, member->conference->wait_mod_timeout_message, 0, SWITCH_TRUE);
}
member->loop_loop = SWITCH_FALSE;
break;
}
} /* Rinse ... Repeat */ } /* Rinse ... Repeat */
end: end:

View File

@ -724,6 +724,9 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
conference->count_ghosts++; conference->count_ghosts++;
} else { } else {
conference->count++; conference->count++;
if (conference->min_members && conference->count >= conference->min_members) {
conference_utils_clear_flag_locked(conference, CFLAG_WAIT_MIN_MEMBERS);
}
} }
if (conference_utils_member_test_flag(member, MFLAG_ENDCONF)) { if (conference_utils_member_test_flag(member, MFLAG_ENDCONF)) {
@ -814,7 +817,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
conference_utils_clear_flag(conference, CFLAG_WAIT_MOD); conference_utils_clear_flag(conference, CFLAG_WAIT_MOD);
} }
if (conference->count > 1) { if (!conference_utils_test_flag(conference, CFLAG_WAIT_MIN_MEMBERS)) {
if ((conference->moh_sound && !conference_utils_test_flag(conference, CFLAG_WAIT_MOD)) || if ((conference->moh_sound && !conference_utils_test_flag(conference, CFLAG_WAIT_MOD)) ||
(conference_utils_test_flag(conference, CFLAG_WAIT_MOD) && !switch_true(switch_channel_get_variable(channel, "conference_permanent_wait_mod_moh")))) { (conference_utils_test_flag(conference, CFLAG_WAIT_MOD) && !switch_true(switch_channel_get_variable(channel, "conference_permanent_wait_mod_moh")))) {
/* stop MoH if any */ /* stop MoH if any */
@ -826,9 +829,9 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
if (conference_utils_test_flag(conference, CFLAG_ENTER_SOUND) && !conference_utils_member_test_flag(member, MFLAG_SILENT)) { if (conference_utils_test_flag(conference, CFLAG_ENTER_SOUND) && !conference_utils_member_test_flag(member, MFLAG_SILENT)) {
if (!zstr(enter_sound)) { if (!zstr(enter_sound)) {
conference_file_play(conference, (char *)enter_sound, CONF_DEFAULT_LEADIN, conference_file_play(conference, (char *)enter_sound, CONF_DEFAULT_LEADIN,
switch_core_session_get_channel(member->session), 0); switch_core_session_get_channel(member->session), !conference_utils_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1);
} else { } else {
conference_file_play(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 0); conference_file_play(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), !conference_utils_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1);
} }
} }
} }
@ -1191,6 +1194,13 @@ switch_status_t conference_member_del(conference_obj_t *conference, conference_m
if (!--conference->end_count) { if (!--conference->end_count) {
//conference_utils_set_flag_locked(conference, CFLAG_DESTRUCT); //conference_utils_set_flag_locked(conference, CFLAG_DESTRUCT);
conference->endconference_time = switch_epoch_time_now(NULL); conference->endconference_time = switch_epoch_time_now(NULL);
if (conference_utils_member_test_flag(member, MFLAG_MOD) && !zstr(conference->endconf_mod_exit_message)) {
conference_file_play(conference, conference->endconf_mod_exit_message, 0, channel, 0);
} else {
if (!zstr(conference->endconf_message)) {
conference_file_play(conference, conference->endconf_message, 0, channel, 0);
}
}
} }
} }
@ -1208,7 +1218,7 @@ switch_status_t conference_member_del(conference_obj_t *conference, conference_m
if (!exit_sound && conference->exit_sound && conference_utils_test_flag(conference, CFLAG_EXIT_SOUND) && !conference_utils_member_test_flag(member, MFLAG_SILENT)) { if (!exit_sound && conference->exit_sound && conference_utils_test_flag(conference, CFLAG_EXIT_SOUND) && !conference_utils_member_test_flag(member, MFLAG_SILENT)) {
conference_file_play(conference, conference->exit_sound, 0, channel, 0); conference_file_play(conference, conference->exit_sound, 0, channel, 0);
} }
if (conference->count == 1 && conference->alone_sound && !conference_utils_test_flag(conference, CFLAG_WAIT_MOD) && !conference_utils_member_test_flag(member, MFLAG_GHOST)) { if (!conference_utils_test_flag(conference, CFLAG_WAIT_MIN_MEMBERS) && conference->alone_sound && !conference_utils_test_flag(conference, CFLAG_WAIT_MOD) && !conference_utils_member_test_flag(member, MFLAG_GHOST)) {
conference_file_stop(conference, FILE_STOP_ASYNC); conference_file_stop(conference, FILE_STOP_ASYNC);
conference_file_play(conference, conference->alone_sound, 0, channel, 0); conference_file_play(conference, conference->alone_sound, 0, channel, 0);
} }

View File

@ -318,14 +318,14 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
if (conference->perpetual_sound && !conference->async_fnode) { if (conference->perpetual_sound && !conference->async_fnode) {
conference_file_play(conference, conference->perpetual_sound, CONF_DEFAULT_LEADIN, NULL, 1); conference_file_play(conference, conference->perpetual_sound, CONF_DEFAULT_LEADIN, NULL, 1);
} else if (conference->moh_sound && ((nomoh == 0 && conference->count == 1) } else if (conference->moh_sound && ((nomoh == 0 && conference_utils_test_flag(conference, CFLAG_WAIT_MIN_MEMBERS))
|| conference_utils_test_flag(conference, CFLAG_WAIT_MOD)) && !conference->async_fnode && !conference->fnode) { || conference_utils_test_flag(conference, CFLAG_WAIT_MOD)) && !conference->async_fnode && !conference->fnode) {
conference_file_play(conference, conference->moh_sound, CONF_DEFAULT_LEADIN, NULL, 1); conference_file_play(conference, conference->moh_sound, CONF_DEFAULT_LEADIN, NULL, 1);
} }
/* Find if no one talked for more than x number of second */ /* Find if no one talked for more than x number of second */
if (conference->terminate_on_silence && conference->count > 1) { if (conference->terminate_on_silence && !conference_utils_test_flag(conference, CFLAG_WAIT_MIN_MEMBERS)) {
int is_talking = 0; int is_talking = 0;
for (imember = conference->members; imember; imember = imember->next) { for (imember = conference->members; imember; imember = imember->next) {
@ -1102,6 +1102,21 @@ void conference_xlist(conference_obj_t *conference, switch_xml_t x_conference, i
switch_xml_set_attr_d(x_conference, "enter_sound", "true"); switch_xml_set_attr_d(x_conference, "enter_sound", "true");
} }
if (conference->min_members > 0) {
switch_snprintf(i, sizeof(i), "%d", conference->min_members);
switch_xml_set_attr_d(x_conference, "min_members", ival);
}
if (conference->wait_min_members_timeout > 0) {
switch_snprintf(i, sizeof(i), "%d", conference->wait_min_members_timeout);
switch_xml_set_attr_d(x_conference, "wait_min_members_timeout", ival);
}
if (conference->wait_mod_timeout > 0) {
switch_snprintf(i, sizeof(i), "%d", conference->wait_mod_timeout);
switch_xml_set_attr_d(x_conference, "wait_mod_timeout", ival);
}
if (conference->max_members > 0) { if (conference->max_members > 0) {
switch_snprintf(i, sizeof(i), "%d", conference->max_members); switch_snprintf(i, sizeof(i), "%d", conference->max_members);
switch_xml_set_attr_d(x_conference, "max_members", ival); switch_xml_set_attr_d(x_conference, "max_members", ival);
@ -1823,9 +1838,12 @@ SWITCH_STANDARD_APP(conference_function)
/* if the conference exists, get the pointer to it */ /* if the conference exists, get the pointer to it */
if (!conference) { if (!conference) {
const char *max_members_str; const char *max_members_str = NULL;
const char *endconference_grace_time_str; const char *endconference_grace_time_str = NULL;
const char *auto_record_str; const char *auto_record_str = NULL;
const char *min_members_str = NULL;
const char *wait_min_members_timeout_str = NULL;
const char *wait_mod_timeout_str = NULL;
/* no conference yet, so check for join-only flag */ /* no conference yet, so check for join-only flag */
if (flags_str) { if (flags_str) {
@ -1838,9 +1856,9 @@ SWITCH_STANDARD_APP(conference_function)
} }
if (mflags[MFLAG_JOIN_ONLY]) { if (mflags[MFLAG_JOIN_ONLY]) {
switch_event_t *event; switch_event_t *event = NULL;
switch_xml_t jos_xml; switch_xml_t jos_xml = NULL;
char *val; char *val = NULL;
/* send event */ /* send event */
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT); switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT);
switch_channel_event_set_basic_data(channel, event); switch_channel_event_set_basic_data(channel, event);
@ -1899,9 +1917,48 @@ SWITCH_STANDARD_APP(conference_function)
/* Set the minimum number of members (once you go above it you cannot go below it) */ /* Set the minimum number of members (once you go above it you cannot go below it) */
conference->min = 1; conference->min = 1;
/* check for variable used to specify override for min_members */
if (!zstr(min_members_str = switch_channel_get_variable(channel, "conference_min_members"))) {
uint32_t min_members_val = 0;
errno = 0; /* sanity first */
min_members_val = strtol(min_members_str, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */
if (errno == ERANGE || errno == EINVAL || (int32_t) min_members_val < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"conference_min_members variable %s is invalid, not setting a limit\n", min_members_str);
} else {
conference->min_members = min_members_val;
}
}
/* check for variable used to specify override for wait_min_members_timeout */
if (!zstr(wait_min_members_timeout_str = switch_channel_get_variable(channel, "conference_wait_min_members_timeout"))) {
int32_t wait_min_members_timeout_val = 0;
errno = 0; /* sanity first */
wait_min_members_timeout_val = strtol(wait_min_members_timeout_str, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */
if (errno == ERANGE || errno == EINVAL || (int32_t) wait_min_members_timeout_val < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"conference_wait_min_members_timeout variable %s is invalid, not setting a limit\n", wait_min_members_timeout_str);
} else {
conference->wait_min_members_timeout = wait_min_members_timeout_val;
}
}
/* check for variable used to specify override for wait_min_members_timeout */
if (!zstr(wait_mod_timeout_str = switch_channel_get_variable(channel, "conference_wait_mod_timeout"))) {
int32_t wait_mod_timeout_val = 0;
errno = 0; /* sanity first */
wait_mod_timeout_val = strtol(wait_mod_timeout_str, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */
if (errno == ERANGE || errno == EINVAL || (int32_t) wait_mod_timeout_val < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"conference_wait_mod_timeout variable %s is invalid, not setting a limit\n", wait_mod_timeout_str);
} else {
conference->wait_mod_timeout = wait_mod_timeout_val;
}
}
/* check for variable used to specify override for max_members */ /* check for variable used to specify override for max_members */
if (!zstr(max_members_str = switch_channel_get_variable(channel, "conference_max_members"))) { if (!zstr(max_members_str = switch_channel_get_variable(channel, "conference_max_members"))) {
uint32_t max_members_val; uint32_t max_members_val = 0;
errno = 0; /* sanity first */ 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 */ 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 || (int32_t) max_members_val < 0 || max_members_val == 1) { if (errno == ERANGE || errno == EINVAL || (int32_t) max_members_val < 0 || max_members_val == 1) {
@ -1914,7 +1971,7 @@ SWITCH_STANDARD_APP(conference_function)
/* check for variable to override endconference_grace_time profile value */ /* check for variable to override endconference_grace_time profile value */
if (!zstr(endconference_grace_time_str = switch_channel_get_variable(channel, "conference_endconference_grace_time"))) { if (!zstr(endconference_grace_time_str = switch_channel_get_variable(channel, "conference_endconference_grace_time"))) {
uint32_t grace_time_val; uint32_t grace_time_val = 0;
errno = 0; /* sanity first */ errno = 0; /* sanity first */
grace_time_val = strtol(endconference_grace_time_str, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */ grace_time_val = strtol(endconference_grace_time_str, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */
if (errno == ERANGE || errno == EINVAL || (int32_t) grace_time_val < 0) { if (errno == ERANGE || errno == EINVAL || (int32_t) grace_time_val < 0) {
@ -1930,6 +1987,10 @@ SWITCH_STANDARD_APP(conference_function)
/* Indicate the conference is dynamic */ /* Indicate the conference is dynamic */
conference_utils_set_flag_locked(conference, CFLAG_DYNAMIC); conference_utils_set_flag_locked(conference, CFLAG_DYNAMIC);
if (conference->min_members) {
conference_utils_set_flag_locked(conference, CFLAG_WAIT_MIN_MEMBERS);
}
/* acquire a read lock on the thread so it can't leave without us */ /* acquire a read lock on the thread so it can't leave without us */
if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) { if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Read Lock Fail\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Read Lock Fail\n");
@ -1963,7 +2024,7 @@ SWITCH_STANDARD_APP(conference_function)
int pin_retries = conference->pin_retries; int pin_retries = conference->pin_retries;
int pin_valid = 0; int pin_valid = 0;
switch_status_t status = SWITCH_STATUS_SUCCESS; switch_status_t status = SWITCH_STATUS_SUCCESS;
char *supplied_pin_value; char *supplied_pin_value = NULL;
/* Answer the channel */ /* Answer the channel */
switch_channel_answer(channel); switch_channel_answer(channel);
@ -2383,6 +2444,13 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
char *perpetual_sound = NULL; char *perpetual_sound = NULL;
char *moh_sound = NULL; char *moh_sound = NULL;
char *outcall_templ = NULL; char *outcall_templ = NULL;
char *wait_min_members_timeout_message = NULL;
char *wait_mod_timeout_message = NULL;
char *endconf_mod_exit_message = NULL;
char *endconf_message = NULL;
uint32_t min_members = 0;
int32_t wait_min_members_timeout = 0;
int32_t wait_mod_timeout = 0;
char *video_layout_name = NULL; char *video_layout_name = NULL;
char *video_layout_group = NULL; char *video_layout_group = NULL;
char *video_canvas_size = NULL; char *video_canvas_size = NULL;
@ -2612,6 +2680,14 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
kicked_sound = val; kicked_sound = val;
} else if (!strcasecmp(var, "join-only-sound") && !zstr(val)) { } else if (!strcasecmp(var, "join-only-sound") && !zstr(val)) {
join_only_sound = val; join_only_sound = val;
} else if (!strcasecmp(var, "wait-min-members-timeout-message") && !zstr(val)) {
wait_min_members_timeout_message = val;
} else if (!strcasecmp(var, "wait-mod-timeout-message") && !zstr(val)) {
wait_mod_timeout_message = val;
} else if (!strcasecmp(var, "endconf-mod-exit-message") && !zstr(val)) {
endconf_mod_exit_message = val;
} else if (!strcasecmp(var, "endconf-message") && !zstr(val)) {
endconf_message = val;
} else if (!strcasecmp(var, "pin") && !zstr(val)) { } else if (!strcasecmp(var, "pin") && !zstr(val)) {
pin = val; pin = val;
} else if (!strcasecmp(var, "moderator-pin") && !zstr(val)) { } else if (!strcasecmp(var, "moderator-pin") && !zstr(val)) {
@ -2669,6 +2745,27 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
} else if (!strcasecmp(var, "sound-prefix") && !zstr(val)) { } else if (!strcasecmp(var, "sound-prefix") && !zstr(val)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "override sound-prefix with: %s\n", val); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "override sound-prefix with: %s\n", val);
sound_prefix = val; sound_prefix = val;
} else if (!strcasecmp(var, "min-members") && !zstr(val)) {
errno = 0; /* sanity first */
min_members = strtol(val, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */
if (errno == ERANGE || errno == EINVAL || (int32_t) min_members < 0) {
min_members = 0; /* set to 0 to disable min counts */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "min-members %s is invalid, not setting a limit\n", val);
}
} else if (!strcasecmp(var, "wait-min-members-timeout") && !zstr(val)) {
errno = 0; /* sanity first */
wait_min_members_timeout = strtoll(val, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */
if (errno == ERANGE || errno == EINVAL || (int32_t) wait_min_members_timeout < 0) {
wait_min_members_timeout = 0; /* set to 0 to disable timeout waiting for min_members */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "wait-min-members-timeout %s is invalid, not setting a limit\n", val);
}
} else if (!strcasecmp(var, "wait-mod-timeout") && !zstr(val)) {
errno = 0; /* sanity first */
wait_mod_timeout = strtoll(val, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */
if (errno == ERANGE || errno == EINVAL || (int32_t) wait_mod_timeout < 0) {
wait_mod_timeout = 0; /* set to 0 to disable timeout waiting for moderator */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "wait-mod-timeout %s is invalid, not setting a limit\n", val);
}
} else if (!strcasecmp(var, "max-members") && !zstr(val)) { } else if (!strcasecmp(var, "max-members") && !zstr(val)) {
errno = 0; /* sanity first */ errno = 0; /* sanity first */
max_members = strtol(val, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */ max_members = strtol(val, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */
@ -3076,6 +3173,22 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
conference->is_unlocked_sound = switch_core_strdup(conference->pool, is_unlocked_sound); conference->is_unlocked_sound = switch_core_strdup(conference->pool, is_unlocked_sound);
} }
if (!zstr(wait_min_members_timeout_message)) {
conference->wait_min_members_timeout_message = switch_core_strdup(conference->pool, wait_min_members_timeout_message);
}
if (!zstr(wait_mod_timeout_message)) {
conference->wait_mod_timeout_message = switch_core_strdup(conference->pool, wait_mod_timeout_message);
}
if (!zstr(endconf_mod_exit_message)) {
conference->endconf_mod_exit_message = switch_core_strdup(conference->pool, endconf_mod_exit_message);
}
if (!zstr(endconf_message)) {
conference->endconf_message = switch_core_strdup(conference->pool, endconf_message);
}
if (!zstr(energy_level)) { if (!zstr(energy_level)) {
conference->energy_level = atoi(energy_level); conference->energy_level = atoi(energy_level);
if (conference->energy_level < 0) { if (conference->energy_level < 0) {
@ -3097,6 +3210,11 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
} }
} }
/* its going to be 0 by default, set to a value otherwise so this should be safe */
conference->min_members = min_members;
conference->wait_min_members_timeout = wait_min_members_timeout;
conference->wait_mod_timeout = wait_mod_timeout;
if (!zstr(maxmember_sound)) { if (!zstr(maxmember_sound)) {
conference->maxmember_sound = switch_core_strdup(conference->pool, maxmember_sound); conference->maxmember_sound = switch_core_strdup(conference->pool, maxmember_sound);
} }

View File

@ -249,6 +249,7 @@ typedef enum {
CFLAG_PERSONAL_CANVAS, CFLAG_PERSONAL_CANVAS,
CFLAG_REFRESH_LAYOUT, CFLAG_REFRESH_LAYOUT,
CFLAG_VIDEO_MUTE_EXIT_CANVAS, CFLAG_VIDEO_MUTE_EXIT_CANVAS,
CFLAG_WAIT_MIN_MEMBERS,
///////////////////////////////// /////////////////////////////////
CFLAG_MAX CFLAG_MAX
} conference_flag_t; } conference_flag_t;
@ -557,6 +558,13 @@ typedef struct conference_obj {
int auto_record_canvas; int auto_record_canvas;
char *record_filename; char *record_filename;
char *outcall_templ; char *outcall_templ;
char *wait_min_members_timeout_message;
char *wait_mod_timeout_message;
char *endconf_mod_exit_message;
char *endconf_message;
uint32_t min_members;
int32_t wait_min_members_timeout;
int32_t wait_mod_timeout;
char *video_layout_name; char *video_layout_name;
char *video_layout_group; char *video_layout_group;
char *video_canvas_bgcolor; char *video_canvas_bgcolor;