]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
deal with timeout better in rare bind_meta_app misuse
authorAnthony Minessale <anthm@freeswitch.org>
Sat, 12 Nov 2011 01:27:02 +0000 (19:27 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Sat, 12 Nov 2011 01:27:02 +0000 (19:27 -0600)
src/switch_ivr.c

index bb3886e341c0b8ce06f4bdd3d7eae93d7482c4f7..4622f1f684d2a9a39bb8e45f4e4db57be537361c 100644 (file)
@@ -561,8 +561,20 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
                                        if (stream && switch_is_moh(stream)) {
                                                if ((b_session = switch_core_session_locate(b_uuid))) {
                                                        switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
+                                                       switch_status_t st;
+                                                       
                                                        switch_ivr_broadcast(b_uuid, stream, SMF_ECHO_ALEG | SMF_LOOP);
-                                                       switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_TRUE, 5000, NULL);
+                                                       st = switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_TRUE, 5000, NULL);
+                                                       if (st != SWITCH_STATUS_SUCCESS && 
+                                                               switch_channel_ready(channel) && switch_channel_ready(b_channel) && !switch_channel_test_flag(b_channel, CF_BROADCAST)) {
+                                                               switch_core_session_kill_channel(b_session, SWITCH_SIG_BREAK);
+                                                               st = switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_TRUE, 5000, NULL);
+                                                       
+                                                               if (st != SWITCH_STATUS_SUCCESS && 
+                                                                       switch_channel_ready(channel) && switch_channel_ready(b_channel) && !switch_channel_test_flag(b_channel, CF_BROADCAST)) {
+                                                                       switch_core_session_flush_private_events(b_session);
+                                                               }
+                                                       }
                                                        switch_core_session_rwunlock(b_session);
                                                }
                                        } else {