git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7199 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-01-13 18:39:51 +00:00
parent 3993d8aa16
commit 58a8979c6e
12 changed files with 39 additions and 37 deletions

View File

@ -797,7 +797,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(_In_ switc
\brief Reset the buffers and resampler on a session
\param session the session to reset
*/
SWITCH_DECLARE(void) switch_core_session_reset(_In_ switch_core_session_t *session);
SWITCH_DECLARE(void) switch_core_session_reset(_In_ switch_core_session_t *session, switch_bool_t flush_dtmf);
/*!
\brief Write a frame to a session

View File

@ -4369,7 +4369,7 @@ SWITCH_STANDARD_APP(conference_function)
switch_safe_free(dfile);
}
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
/* release the readlock */
if (rl) {

View File

@ -624,7 +624,7 @@ SWITCH_STANDARD_APP(rss_function)
}
switch_xml_free(xml);
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
}

View File

@ -37,8 +37,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amr_load);
SWITCH_MODULE_DEFINITION(mod_amr, mod_amr_load, NULL, NULL);
#ifndef AMR_PASSTHROUGH
#include "amr/interf_enc.h"
#include "amr/interf_dec.h"
#include "interf_enc.h"
#include "interf_dec.h"
/*
* Check section 8.1 of rfc3267 for possible sdp options.

View File

@ -1016,7 +1016,7 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
tech_pvt->read_codec.implementation->iananame, tech_pvt->rm_encoding);
switch_core_codec_destroy(&tech_pvt->read_codec);
switch_core_codec_destroy(&tech_pvt->write_codec);
switch_core_session_reset(tech_pvt->session);
switch_core_session_reset(tech_pvt->session, SWITCH_TRUE);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Already using %s\n", tech_pvt->read_codec.implementation->iananame);
return SWITCH_STATUS_SUCCESS;

View File

@ -575,11 +575,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_private_event(switch
}
SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session)
SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session, switch_bool_t flush_dtmf)
{
switch_channel_t *channel;
switch_size_t has;
channel = switch_core_session_get_channel(session);
switch_assert(channel != NULL);
/* clear resamplers*/
switch_resample_destroy(&session->read_resampler);
switch_resample_destroy(&session->write_resampler);
@ -590,12 +593,11 @@ 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);
/* flush dtmf */
channel = switch_core_session_get_channel(session);
while ((has = switch_channel_has_dtmf(channel))) {
switch_channel_flush_dtmf(channel);
if (flush_dtmf) {
while ((has = switch_channel_has_dtmf(channel))) {
switch_channel_flush_dtmf(channel);
}
}
switch_ivr_deactivate_unicast(session);

View File

@ -220,7 +220,7 @@ static void switch_core_standard_on_park(switch_core_session_t *session)
switch_assert(session != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard PARK\n");
switch_channel_clear_flag(session->channel, CF_TRANSFER);
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
switch_ivr_park(session, NULL);
}

View File

@ -882,7 +882,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
const char *uuid = NULL;
switch_assert(session != NULL);
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
channel = switch_core_session_get_channel(session);
switch_assert(channel != NULL);

View File

@ -300,7 +300,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
return SWITCH_STATUS_GENERR;
}
@ -664,7 +664,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
status = SWITCH_STATUS_SUCCESS;
switch_core_session_set_read_codec(session, read_codec);
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
}
return status;
@ -720,7 +720,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s\n", file);
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
return SWITCH_STATUS_GENERR;
}

View File

@ -222,7 +222,7 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
end:
switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
switch_core_session_reset(session_a);
switch_core_session_reset(session_a, SWITCH_TRUE);
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_channel_clear_flag(chan_a, CF_BRIDGED);
@ -353,8 +353,8 @@ static switch_status_t uuid_bridge_on_transmit(switch_core_session_t *session)
switch_channel_clear_flag(channel, CF_TRANSFER);
switch_channel_clear_flag(other_channel, CF_TRANSFER);
switch_core_session_reset(session);
switch_core_session_reset(other_session);
switch_core_session_reset(session, SWITCH_TRUE);
switch_core_session_reset(other_session, SWITCH_TRUE);
ready_a = switch_channel_ready(channel);
ready_b = switch_channel_ready(other_channel);

View File

@ -448,7 +448,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
if (!pass && write_codec.implementation) {
if (read_codec && !ringback.asis) {
switch_core_session_set_read_codec(session, read_codec);
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
}
switch_core_codec_destroy(&write_codec);
}
@ -1116,7 +1116,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
}
if (session && (ringback_data || !switch_channel_test_flag(caller_channel, CF_BYPASS_MEDIA))) {
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_FALSE);
}
for (i = 0; i < and_argc; i++) {
@ -1243,7 +1243,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
if (!pass && write_codec.implementation) {
if (read_codec && !ringback.asis) {
switch_core_session_set_read_codec(session, read_codec);
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_FALSE);
}
switch_core_codec_destroy(&write_codec);
}

View File

@ -371,7 +371,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
read_codec->implementation->actual_samples_per_second,
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
return SWITCH_STATUS_GENERR;
}
@ -429,7 +429,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
"Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, fh->samplerate,
fh->channels, read_codec->implementation->microseconds_per_frame / 1000);
switch_core_file_close(fh);
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
return SWITCH_STATUS_GENERR;
}
@ -551,7 +551,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
switch_core_session_set_read_codec(session, read_codec);
switch_core_file_close(fh);
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
return status;
}
@ -747,7 +747,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
read_codec->implementation->number_of_channels,
read_codec->implementation->actual_samples_per_second,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
status = SWITCH_STATUS_NOTFOUND;
goto end;
}
@ -812,7 +812,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup buffer failed\n");
switch_core_file_close(fh);
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
status = SWITCH_STATUS_GENERR;
goto end;
@ -839,7 +839,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, fh->channels, interval);
switch_core_file_close(fh);
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
status = SWITCH_STATUS_GENERR;
goto end;
}
@ -856,7 +856,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");
switch_core_codec_destroy(&codec);
switch_core_file_close(fh);
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
status = SWITCH_STATUS_GENERR;
goto end;
}
@ -1103,7 +1103,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
end:
free(abuf);
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
return status;
}
@ -1566,7 +1566,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
timer_name = switch_channel_get_variable(channel, "timer_name");
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
read_codec = switch_core_session_get_read_codec(session);
rate = read_codec->implementation->actual_samples_per_second;
@ -1577,7 +1577,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
if (switch_core_speech_open(sh, tts_name, voice_name, (uint32_t) rate, interval,
&flags, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module!\n");
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
if (cache_obj) {
switch_channel_set_private(channel, SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME, NULL);
}
@ -1603,7 +1603,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed %s@%uhz 1 channel %dms\n", codec_name, rate, interval);
flags = 0;
switch_core_speech_close(sh, &flags);
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
if (cache_obj) {
switch_channel_set_private(channel, SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME, NULL);
}
@ -1620,7 +1620,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
switch_core_codec_destroy(write_frame.codec);
flags = 0;
switch_core_speech_close(sh, &flags);
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
if (cache_obj) {
switch_channel_set_private(channel, SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME, NULL);
}
@ -1650,6 +1650,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
}
}
switch_core_session_reset(session);
switch_core_session_reset(session, SWITCH_TRUE);
return status;
}