silent recovery

This commit is contained in:
Anthony Minessale 2010-10-13 16:17:36 -05:00
parent ffd28c1930
commit 93c2ed941a
6 changed files with 38 additions and 11 deletions

View File

@ -1063,6 +1063,7 @@ typedef enum {
CF_CONSUME_ON_ORIGINATE,
CF_PASSTHRU_PTIME_MISMATCH,
CF_BRIDGE_NOWRITE,
CF_RECOVERED,
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
CF_FLAG_MAX
} switch_channel_flag_t;

View File

@ -698,20 +698,21 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe
switch_clear_flag(conference, CFLAG_WAIT_MOD);
}
channel = switch_core_session_get_channel(member->session);
switch_channel_set_variable_printf(channel, "conference_member_id", "%d", member->id);
if (conference->count > 1) {
if (conference->moh_sound && !switch_test_flag(conference, CFLAG_WAIT_MOD)) {
/* stop MoH if any */
conference_stop_file(conference, FILE_STOP_ASYNC);
}
if (conference->enter_sound) {
if (conference->enter_sound && (!switch_channel_test_flag(channel, CF_RECOVERED) ||
switch_true(switch_channel_get_variable(channel, "conference_silent_entry")))) {
conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session),
switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1);
}
}
channel = switch_core_session_get_channel(member->session);
switch_channel_set_variable_printf(channel, "conference_member_id", "%d", member->id);
call_list = (call_list_t *) switch_channel_get_private(channel, "_conference_autocall_list_");
@ -720,7 +721,8 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe
switch_snprintf(saymsg, sizeof(saymsg), "Auto Calling %d parties", call_list->iteration);
conference_member_say(member, saymsg, 0);
} else {
if (zstr(conference->special_announce)) {
if (zstr(conference->special_announce) && (!switch_channel_test_flag(channel, CF_RECOVERED) ||
switch_true(switch_channel_get_variable(channel, "conference_silent_entry")))) {
/* announce the total number of members in the conference */
if (conference->count >= conference->announce_count && conference->announce_count > 1) {
switch_snprintf(msg, sizeof(msg), "There are %d callers", conference->count);
@ -750,7 +752,8 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe
switch_set_flag(conference, CFLAG_ENFORCE_MIN);
}
if (test_eflag(conference, EFLAG_ADD_MEMBER) &&
if (test_eflag(conference, EFLAG_ADD_MEMBER) && (!switch_channel_test_flag(channel, CF_RECOVERED) ||
switch_true(switch_channel_get_variable(channel, "conference_silent_entry"))) &&
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
conference_add_event_member_data(member, event);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "add-member");
@ -2408,7 +2411,8 @@ static void conference_loop_output(conference_member_t *member)
const char *prefix = switch_channel_get_variable(channel, "conference_auto_outcall_prefix");
int to = 60;
if (ann) {
if (ann && (!switch_channel_test_flag(channel, CF_RECOVERED) ||
switch_true(switch_channel_get_variable(channel, "conference_silent_entry")))) {
member->conference->special_announce = switch_core_strdup(member->conference->pool, ann);
}
@ -5657,7 +5661,8 @@ SWITCH_STANDARD_APP(conference_function)
}
}
if (conference->special_announce) {
if (conference->special_announce && (!switch_channel_test_flag(channel, CF_RECOVERED) ||
switch_true(switch_channel_get_variable(channel, "conference_silent_entry")))) {
conference_local_play_file(conference, session, conference->special_announce, CONF_DEFAULT_LEADIN, NULL, 0);
}

View File

@ -4999,7 +4999,10 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
for (param = switch_xml_child(x_extension, "application"); param; param = param->next) {
const char *var = switch_xml_attr_soft(param, "app_name");
const char *val = switch_xml_attr_soft(param, "app_data");
switch_caller_extension_add_application(session, extension, var, val);
/* skip announcement type apps */
if (strcasecmp(var, "speak") && strcasecmp(var, "playback") && strcasecmp(var, "gentones" || strcasecmp(var, "say"))) {
switch_caller_extension_add_application(session, extension, var, val);
}
}
}

View File

@ -1335,6 +1335,10 @@ SWITCH_DECLARE(void) switch_channel_set_flag_value(switch_channel_t *channel, sw
switch_channel_set_variable(channel, "is_outbound", "true");
}
if (flag == CF_RECOVERED) {
switch_channel_set_variable(channel, "recovered", "true");
}
}
SWITCH_DECLARE(void) switch_channel_set_flag_recursive(switch_channel_t *channel, switch_channel_flag_t flag)
@ -1349,6 +1353,10 @@ SWITCH_DECLARE(void) switch_channel_set_flag_recursive(switch_channel_t *channel
if (flag == CF_OUTBOUND) {
switch_channel_set_variable(channel, "is_outbound", "true");
}
if (flag == CF_RECOVERED) {
switch_channel_set_variable(channel, "recovered", "true");
}
}
@ -1461,6 +1469,10 @@ SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch
if (flag == CF_OUTBOUND) {
switch_channel_set_variable(channel, "is_outbound", NULL);
}
if (flag == CF_RECOVERED) {
switch_channel_set_variable(channel, "recovered", NULL);
}
}

View File

@ -1437,7 +1437,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_xml(switch_e
}
}
}
if ((callflow = switch_xml_child(xml, "callflow"))) {
if ((tag2 = switch_xml_child(callflow, "caller_profile"))) {
switch_caller_profile_t *caller_profile;
@ -1528,6 +1528,8 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_xml(switch_e
}
switch_channel_set_flag(channel, CF_RECOVERED);
}

View File

@ -156,9 +156,13 @@ static void switch_core_standard_on_execute(switch_core_session_t *session)
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard EXECUTE\n", switch_channel_get_name(session->channel));
if (switch_channel_get_variable(session->channel, "recovered") && !switch_channel_test_flag(session->channel, CF_RECOVERED)) {
switch_channel_set_flag(session->channel, CF_RECOVERED);
}
top:
switch_channel_clear_flag(session->channel, CF_RESET);
if ((extension = switch_channel_get_caller_extension(session->channel)) == 0) {
switch_channel_hangup(session->channel, SWITCH_CAUSE_NORMAL_CLEARING);
return;