]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
silent recovery
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 13 Oct 2010 21:17:36 +0000 (16:17 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 13 Oct 2010 21:17:43 +0000 (16:17 -0500)
src/include/switch_types.h
src/mod/applications/mod_conference/mod_conference.c
src/mod/endpoints/mod_sofia/sofia_glue.c
src/switch_channel.c
src/switch_core_session.c
src/switch_core_state_machine.c

index d027549bce09eb8ed3e962b678e232e7d2ec6034..cf27cb747ed792cf13257932327e3a9bccac9877 100644 (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;
index ac57dc0c1545e7f99be5412b4965f214cdc3e9c7..64a76d4226d699e24165cbd7ce646ff354875eaa 100644 (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);
                }
 
index cb8b257e585e060aef24f07b5953e1216256e1ea..13d323f02c8ef004e8a8ce43484124ebe23bfd3d 100644 (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);
+                                       }
                                }
                        }
 
index 9e76b46a5ac95f9c62e854609f1be8700b388843..0b1b6e8f8222e245f5513199b9bea4cb13c751f1 100644 (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);
+       }
 }
 
 
index c8aca7dbc6de4954620cf76649c1c84ba371a07b..1589bebb672e6e88a3890c26424260092ec0ea46 100644 (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);
        }
 
 
index 2b8a6ced163062ca23c58d167a8a776e6742cd09..27579c2fb4857cdb65e3309067cf765b8e49a58f 100644 (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;