[mod_conference] Add flag to destroy the conference only when all mandatory members disconnect. And set endconf to end the conference when any member with the flag disconnects (#2079)
* feature/mod_conference_mandatory_member_flag: Add flag to destroy the conference only when all mandatory members disconnect. And set endconf to end the conference when any member with the flag disconnects
This commit is contained in:
parent
244ccaa8a8
commit
b355bf21e6
|
@ -662,6 +662,9 @@ void conference_cdr_render(conference_obj_t *conference)
|
||||||
x_tag = switch_xml_add_child_d(x_flags, "end_conference", flag_off++);
|
x_tag = switch_xml_add_child_d(x_flags, "end_conference", flag_off++);
|
||||||
switch_xml_set_txt_d(x_tag, conference_cdr_test_mflag(np, MFLAG_ENDCONF) ? "true" : "false");
|
switch_xml_set_txt_d(x_tag, conference_cdr_test_mflag(np, MFLAG_ENDCONF) ? "true" : "false");
|
||||||
|
|
||||||
|
x_tag = switch_xml_add_child_d(x_flags, "mandatory_member_end_conference", flag_off++);
|
||||||
|
switch_xml_set_txt_d(x_tag, conference_cdr_test_mflag(np, MFLAG_MANDATORY_MEMBER_ENDCONF) ? "true" : "false");
|
||||||
|
|
||||||
x_tag = switch_xml_add_child_d(x_flags, "was_kicked", flag_off++);
|
x_tag = switch_xml_add_child_d(x_flags, "was_kicked", flag_off++);
|
||||||
switch_xml_set_txt_d(x_tag, conference_cdr_test_mflag(np, MFLAG_KICKED) ? "true" : "false");
|
switch_xml_set_txt_d(x_tag, conference_cdr_test_mflag(np, MFLAG_KICKED) ? "true" : "false");
|
||||||
|
|
||||||
|
|
|
@ -766,7 +766,12 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
|
||||||
conference->count++;
|
conference->count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (conference_utils_member_test_flag(member, MFLAG_ENDCONF)) {
|
if (conference_utils_member_test_flag(member, MFLAG_ENDCONF)) {
|
||||||
|
conference->endconference_time = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (conference_utils_member_test_flag(member, MFLAG_MANDATORY_MEMBER_ENDCONF)) {
|
||||||
if (conference->end_count++) {
|
if (conference->end_count++) {
|
||||||
conference->endconference_time = 0;
|
conference->endconference_time = 0;
|
||||||
}
|
}
|
||||||
|
@ -1314,9 +1319,14 @@ switch_status_t conference_member_del(conference_obj_t *conference, conference_m
|
||||||
|
|
||||||
conference_video_check_flush(member, SWITCH_FALSE);
|
conference_video_check_flush(member, SWITCH_FALSE);
|
||||||
|
|
||||||
|
/* End conference when any member with "endconf" flag disconnects */
|
||||||
if (conference_utils_member_test_flag(member, MFLAG_ENDCONF)) {
|
if (conference_utils_member_test_flag(member, MFLAG_ENDCONF)) {
|
||||||
|
conference_utils_set_flag_locked(conference, CFLAG_DESTRUCT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End conference only if all mandatory members have disconnected */
|
||||||
|
if (conference_utils_member_test_flag(member, MFLAG_MANDATORY_MEMBER_ENDCONF)) {
|
||||||
if (!--conference->end_count) {
|
if (!--conference->end_count) {
|
||||||
//conference_utils_set_flag_locked(conference, CFLAG_DESTRUCT);
|
|
||||||
conference->endconference_time = switch_epoch_time_now(NULL);
|
conference->endconference_time = switch_epoch_time_now(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,6 +132,8 @@ void conference_utils_set_mflags(const char *flags, member_flag_t *f)
|
||||||
f[MFLAG_NOMOH] = 1;
|
f[MFLAG_NOMOH] = 1;
|
||||||
} else if (!strcasecmp(argv[i], "endconf")) {
|
} else if (!strcasecmp(argv[i], "endconf")) {
|
||||||
f[MFLAG_ENDCONF] = 1;
|
f[MFLAG_ENDCONF] = 1;
|
||||||
|
} else if (!strcasecmp(argv[i], "mandatory_member_endconf")) {
|
||||||
|
f[MFLAG_MANDATORY_MEMBER_ENDCONF] = 1;
|
||||||
} else if (!strcasecmp(argv[i], "mintwo")) {
|
} else if (!strcasecmp(argv[i], "mintwo")) {
|
||||||
f[MFLAG_MINTWO] = 1;
|
f[MFLAG_MINTWO] = 1;
|
||||||
} else if (!strcasecmp(argv[i], "talk-data-events")) {
|
} else if (!strcasecmp(argv[i], "talk-data-events")) {
|
||||||
|
|
|
@ -1347,6 +1347,9 @@ void conference_xlist(conference_obj_t *conference, switch_xml_t x_conference, i
|
||||||
x_tag = switch_xml_add_child_d(x_flags, "end_conference", count++);
|
x_tag = switch_xml_add_child_d(x_flags, "end_conference", count++);
|
||||||
switch_xml_set_txt_d(x_tag, conference_utils_member_test_flag(member, MFLAG_ENDCONF) ? "true" : "false");
|
switch_xml_set_txt_d(x_tag, conference_utils_member_test_flag(member, MFLAG_ENDCONF) ? "true" : "false");
|
||||||
|
|
||||||
|
x_tag = switch_xml_add_child_d(x_flags, "mandatory_member_end_conference", count++);
|
||||||
|
switch_xml_set_txt_d(x_tag, conference_utils_member_test_flag(member, MFLAG_MANDATORY_MEMBER_ENDCONF) ? "true" : "false");
|
||||||
|
|
||||||
x_tag = switch_xml_add_child_d(x_flags, "is_ghost", count++);
|
x_tag = switch_xml_add_child_d(x_flags, "is_ghost", count++);
|
||||||
switch_xml_set_txt_d(x_tag, conference_utils_member_test_flag(member, MFLAG_GHOST) ? "true" : "false");
|
switch_xml_set_txt_d(x_tag, conference_utils_member_test_flag(member, MFLAG_GHOST) ? "true" : "false");
|
||||||
|
|
||||||
|
@ -1456,6 +1459,7 @@ void conference_jlist(conference_obj_t *conference, cJSON *json_conferences)
|
||||||
ADDBOOL(json_conference_member_flags, "has_floor", member->id == member->conference->floor_holder);
|
ADDBOOL(json_conference_member_flags, "has_floor", member->id == member->conference->floor_holder);
|
||||||
ADDBOOL(json_conference_member_flags, "is_moderator", conference_utils_member_test_flag(member, MFLAG_MOD));
|
ADDBOOL(json_conference_member_flags, "is_moderator", conference_utils_member_test_flag(member, MFLAG_MOD));
|
||||||
ADDBOOL(json_conference_member_flags, "end_conference", conference_utils_member_test_flag(member, MFLAG_ENDCONF));
|
ADDBOOL(json_conference_member_flags, "end_conference", conference_utils_member_test_flag(member, MFLAG_ENDCONF));
|
||||||
|
ADDBOOL(json_conference_member_flags, "mandatory_member_end_conference", conference_utils_member_test_flag(member, MFLAG_MANDATORY_MEMBER_ENDCONF));
|
||||||
ADDBOOL(json_conference_member_flags, "pass_digits", conference_utils_member_test_flag(member, MFLAG_DIST_DTMF));
|
ADDBOOL(json_conference_member_flags, "pass_digits", conference_utils_member_test_flag(member, MFLAG_DIST_DTMF));
|
||||||
}
|
}
|
||||||
switch_mutex_unlock(conference->member_mutex);
|
switch_mutex_unlock(conference->member_mutex);
|
||||||
|
|
|
@ -178,6 +178,7 @@ typedef enum {
|
||||||
MFLAG_NO_MINIMIZE_ENCODING,
|
MFLAG_NO_MINIMIZE_ENCODING,
|
||||||
MFLAG_FLUSH_BUFFER,
|
MFLAG_FLUSH_BUFFER,
|
||||||
MFLAG_ENDCONF,
|
MFLAG_ENDCONF,
|
||||||
|
MFLAG_MANDATORY_MEMBER_ENDCONF,
|
||||||
MFLAG_HAS_AUDIO,
|
MFLAG_HAS_AUDIO,
|
||||||
MFLAG_TALKING,
|
MFLAG_TALKING,
|
||||||
MFLAG_RESTART,
|
MFLAG_RESTART,
|
||||||
|
|
Loading…
Reference in New Issue