Skip to content

[mod_conference] Refactor alone sound playback. #2730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions src/mod/applications/mod_conference/conference_member.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,14 @@ switch_status_t conference_member_del_relationship(conference_member_t *member,
return status;
}


switch_status_t conference_member_play_alone_sound(conference_member_t *member)
{
char *sound = member->conference->alone_sound ? member->conference->alone_sound : "say:You are currently the only person in this conference.";
if (!strcasecmp(sound, "none")) {
return SWITCH_STATUS_SUCCESS;
}
return conference_member_play_file(member, sound, 0, SWITCH_TRUE);
}

/* Gain exclusive access and add the member to the list */
switch_status_t conference_member_add(conference_obj_t *conference, conference_member_t *member)
Expand Down Expand Up @@ -940,15 +947,8 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
} else if (conference->count == 1 && !conference->perpetual_sound && !conference_utils_test_flag(conference, CFLAG_WAIT_MOD)) {
/* as long as its not a bridge_to conference, announce if person is alone */
if (!conference_utils_test_flag(conference, CFLAG_BRIDGE_TO)) {
if (conference->alone_sound && !conference_utils_member_test_flag(member, MFLAG_GHOST)) {
conference_file_stop(conference, FILE_STOP_ASYNC);
conference_file_play(conference, conference->alone_sound, CONF_DEFAULT_LEADIN,
switch_core_session_get_channel(member->session), 0);
} else {
switch_snprintf(msg, sizeof(msg), "You are currently the only person in this conference.");
conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
}
if (!conference_utils_test_flag(conference, CFLAG_BRIDGE_TO) && !conference_utils_member_test_flag(member, MFLAG_GHOST)) {
conference_member_play_alone_sound(member);
}
}
}
Expand Down Expand Up @@ -1346,8 +1346,13 @@ switch_status_t conference_member_del(conference_obj_t *conference, conference_m
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)) {
conference_file_stop(conference, FILE_STOP_ASYNC);
conference_file_play(conference, conference->alone_sound, 0, channel, 0);
/* play file to single member that was left in the conference */
for (imember = conference->members; imember; imember = imember->next) {
if (!conference_utils_member_test_flag(imember, MFLAG_GHOST)) {
conference_member_play_alone_sound(imember);
break;
}
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/mod/applications/mod_conference/mod_conference.h
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
switch_status_t conference_file_local_play(conference_obj_t *conference, switch_core_session_t *session, char *path, uint32_t leadin, void *buf,
uint32_t buflen);
switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin, switch_bool_t mux);
switch_status_t conference_member_play_alone_sound(conference_member_t *member);
switch_status_t conference_member_say(conference_member_t *member, char *text, uint32_t leadin);
uint32_t conference_member_stop_file(conference_member_t *member, file_stop_t stop);
conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_core_session_t *session, switch_memory_pool_t *pool);
Expand Down