[Freeswitch-svn] [commit] r4277 - freeswitch/trunk/src

Freeswitch SVN anthm at freeswitch.org
Wed Feb 14 17:41:03 EST 2007


Author: anthm
Date: Wed Feb 14 17:41:03 2007
New Revision: 4277

Modified:
   freeswitch/trunk/src/switch_core.c
   freeswitch/trunk/src/switch_ivr.c

Log:
add resets to a few places

Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c	(original)
+++ freeswitch/trunk/src/switch_core.c	Wed Feb 14 17:41:03 2007
@@ -2177,10 +2177,13 @@
 
 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 @@
 	/* 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,

Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c	(original)
+++ freeswitch/trunk/src/switch_ivr.c	Wed Feb 14 17:41:03 2007
@@ -2076,6 +2076,7 @@
 
 	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 @@
 	assert(session != NULL);
 	assert(extension != NULL);
 
+	switch_core_session_reset(session);
+	
 	channel = switch_core_session_get_channel(session);
 	assert(channel != NULL);
 



More information about the Freeswitch-svn mailing list