diff --git a/src/switch_core_session.c b/src/switch_core_session.c index fe2c0c10dd..aec6a13e7c 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -667,12 +667,12 @@ SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session, s switch_size_t has; /* clear resamplers */ + switch_mutex_lock(session->resample_mutex); switch_resample_destroy(&session->read_resampler); switch_resample_destroy(&session->write_resampler); - + switch_mutex_unlock(session->resample_mutex); /* clear indications */ switch_core_session_flush_message(session); - /* wipe theese, they will be recreated if need be */ switch_buffer_destroy(&session->raw_read_buffer); switch_buffer_destroy(&session->raw_write_buffer); @@ -736,6 +736,9 @@ SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t * switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Close Channel %s [%s]\n", switch_channel_get_name((*session)->channel), switch_channel_state_name(switch_channel_get_state((*session)->channel))); + + switch_core_session_reset(*session, TRUE); + switch_core_media_bug_remove_all(*session); switch_ivr_deactivate_unicast(*session); diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index f4aa2485f4..2707e850a8 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -115,7 +115,6 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void goto wbreak; } - switch_channel_set_state(channel, CS_SOFT_EXECUTE); switch_core_session_exec(collect->session, application_interface, app_data); if (switch_channel_get_state(channel) < CS_HANGUP) {