]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add resets to a few places
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 14 Feb 2007 22:41:03 +0000 (22:41 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 14 Feb 2007 22:41:03 +0000 (22:41 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4277 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_core.c
src/switch_ivr.c

index c6b31f4b1b511f205216c3cf763ff969d2c41ad3..97b947d70dbf1cf14be0212df2614431ebeddf77 100644 (file)
@@ -2177,10 +2177,13 @@ static switch_status_t perform_write(switch_core_session_t *session, switch_fram
 
 SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session)
 {
+       switch_channel_t *channel;
+       char buf[256];
+       switch_size_t has;
+
        /* sweep theese under the rug, they wont be leaked they will be reclaimed
           when the session ends.
        */
-
        session->read_resampler = NULL;
        session->write_resampler = NULL;
 
@@ -2190,6 +2193,15 @@ SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session)
        /* wipe theese, they will be recreated if need be */
        switch_buffer_destroy(&session->raw_read_buffer);
        switch_buffer_destroy(&session->raw_write_buffer);
+
+       /* reset state handlers and flush dtmf */
+       channel = switch_core_session_get_channel(session);
+       switch_channel_clear_state_handler(channel, NULL);
+
+       if ((has = switch_channel_has_dtmf(channel))) {
+        switch_channel_dequeue_dtmf(channel, buf, has);
+    }
+
 }
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_session_t *session, switch_frame_t *frame,
index 8f61739b06b27b84bb3cedf95ad8a20ba9570c14..2701b3d40b9f1d41e4ec02c8aa9ea9f1acb1d066 100644 (file)
@@ -2076,6 +2076,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
 
        switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL);
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", switch_channel_get_name(chan_a));
+       switch_core_session_reset(session_a);
 
        switch_channel_clear_flag(chan_a, CF_BRIDGED);
        switch_mutex_lock(data->mutex);
@@ -3642,6 +3643,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
        assert(session != NULL);
        assert(extension != NULL);
 
+       switch_core_session_reset(session);
+       
        channel = switch_core_session_get_channel(session);
        assert(channel != NULL);