]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4043 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 13 Apr 2012 17:47:30 +0000 (12:47 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 13 Apr 2012 17:47:30 +0000 (12:47 -0500)
src/switch_ivr.c

index 0c30c91e9e6f2bc254e60fd97c9bba690abf56b7..651193528113c74328b29763f52a1c69126d29ad 100644 (file)
@@ -535,6 +535,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
                char *loop_h = switch_event_get_header(event, "loops");
                char *hold_bleg = switch_event_get_header(event, "hold-bleg");
                int loops = 1;
+               int inner = 0;
 
                if (zstr(app_arg) && !zstr(content_type) && !strcasecmp(content_type, "text/plain")) {
                        app_arg = switch_event_get_body(event);
@@ -550,7 +551,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
                        switch_core_session_t *b_session = NULL;
 
                        switch_channel_clear_flag(channel, CF_STOP_BROADCAST);
-                       switch_channel_set_flag(channel, CF_BROADCAST);
+
+                       if (switch_channel_test_flag(channel, CF_BROADCAST)) {
+                               inner++;
+                               hold_bleg = NULL;
+                       } else {
+                               switch_channel_set_flag(channel, CF_BROADCAST);
+                       }
                        if (hold_bleg && switch_true(hold_bleg)) {
                                if ((b_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
                                        const char *stream;
@@ -592,6 +599,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
                                                                  switch_channel_get_name(channel), app_name, switch_str_nil(app_arg));
                                b4 = switch_micro_time_now();
                                if (switch_core_session_execute_application(session, app_name, app_arg) != SWITCH_STATUS_SUCCESS) {
+                                       if (!inner || switch_channel_test_flag(channel, CF_STOP_BROADCAST)) switch_channel_clear_flag(channel, CF_BROADCAST);
                                        goto done;
                                }
 
@@ -610,7 +618,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
                                }
                        }
 
-                       switch_channel_clear_flag(channel, CF_BROADCAST);
+                       if (!inner || switch_channel_test_flag(channel, CF_STOP_BROADCAST)) {
+                               switch_channel_clear_flag(channel, CF_BROADCAST); 
+                               switch_channel_set_flag(channel, CF_BREAK); 
+                       }
+                       
                }
        } else if (cmd_hash == CMD_UNICAST) {
                char *local_ip = switch_event_get_header(event, "local-ip");