提交 c39fbb29 authored 作者: Eliot Gable's avatar Eliot Gable

FS-8704: Add min-members, wait-min-members-timeout, wait-mod-timeout,…

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.
上级 de5bbefd
......@@ -89,7 +89,7 @@ api_command_t conference_api_sub_commands[] = {
{"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", ""},
{"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#>"},
{"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]"},
......@@ -2594,6 +2594,15 @@ switch_status_t conference_api_sub_get(conference_obj_t *conference,
} else if (strcasecmp(argv[2], "count_ghosts") == 0) {
stream->write_function(stream, "%d",
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) {
stream->write_function(stream, "%d",
conference->max_members);
......@@ -2648,6 +2657,30 @@ switch_status_t conference_api_sub_set(conference_obj_t *conference,
} else {
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) {
stream->write_function(stream, "%s",conference->sound_prefix);
conference->sound_prefix = switch_core_strdup(conference->pool, argv[3]);
......
......@@ -960,7 +960,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 */
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)
&& (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;
void *data;
uint32_t datalen;
......@@ -1368,6 +1369,25 @@ void conference_loop_output(conference_member_t *member)
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 */
end:
......
......@@ -724,6 +724,9 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
conference->count_ghosts++;
} else {
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)) {
......@@ -808,7 +811,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
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)) ||
(conference_utils_test_flag(conference, CFLAG_WAIT_MOD) && !switch_true(switch_channel_get_variable(channel, "conference_permanent_wait_mod_moh")))) {
/* stop MoH if any */
......@@ -820,9 +823,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 (!zstr(enter_sound)) {
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 {
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);
}
}
}
......@@ -1185,6 +1188,13 @@ switch_status_t conference_member_del(conference_obj_t *conference, conference_m
if (!--conference->end_count) {
//conference_utils_set_flag_locked(conference, CFLAG_DESTRUCT);
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);
}
}
}
}
......@@ -1202,7 +1212,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)) {
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_play(conference, conference->alone_sound, 0, channel, 0);
}
......
......@@ -247,6 +247,7 @@ typedef enum {
CFLAG_PERSONAL_CANVAS,
CFLAG_REFRESH_LAYOUT,
CFLAG_VIDEO_MUTE_EXIT_CANVAS,
CFLAG_WAIT_MIN_MEMBERS,
/////////////////////////////////
CFLAG_MAX
} conference_flag_t;
......@@ -552,6 +553,13 @@ typedef struct conference_obj {
int auto_record_canvas;
char *record_filename;
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_group;
char *video_canvas_bgcolor;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论