[commit] r11430 - in freeswitch/branches/1.0/src: . mod/formats/mod_local_stream mod/languages/mod_managed mod/languages/mod_managed/managed
Author: mikej Date: Thu Jan 22 17:14:07 2009 New Revision: 11430 Log: core: fix double close of file handles and add recording of native files (r:11108-11113) Modified: freeswitch/branches/1.0/src/mod/formats/mod_local_stream/mod_local_stream.c freeswitch/branches/1.0/src/mod/languages/mod_managed/freeswitch_wrap.cxx freeswitch/branches/1.0/src/mod/languages/mod_managed/managed/swig.cs freeswitch/branches/1.0/src/switch_core_file.c freeswitch/branches/1.0/src/switch_ivr_play_say.c Modified: freeswitch/branches/1.0/src/mod/formats/mod_local_stream/mod_local_stream.c ============================================================================== --- freeswitch/branches/1.0/src/mod/formats/mod_local_stream/mod_local_stream.c (original) +++ freeswitch/branches/1.0/src/mod/formats/mod_local_stream/mod_local_stream.c Thu Jan 22 17:14:07 2009 @@ -251,7 +251,7 @@ done: - if (fh.file_interface) { + if (switch_test_flag((&fh), SWITCH_FILE_OPEN)) { switch_core_file_close(&fh); } Modified: freeswitch/branches/1.0/src/mod/languages/mod_managed/freeswitch_wrap.cxx ============================================================================== --- freeswitch/branches/1.0/src/mod/languages/mod_managed/freeswitch_wrap.cxx (original) +++ freeswitch/branches/1.0/src/mod/languages/mod_managed/freeswitch_wrap.cxx Thu Jan 22 17:14:07 2009 @@ -1510,6 +1510,17 @@ } +SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_DEFAULT_FILE_BUFFER_LEN_get() { + int jresult ; + int result; + + result = (int) 65536; + + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_dtmf_t_digit_set(void * jarg1, char jarg2) { switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ; char arg2 ; @@ -6143,13 +6154,15 @@ } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_reset(void * jarg1, int jarg2) { +SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_reset(void * jarg1, int jarg2, int jarg3) { switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; switch_bool_t arg2 ; + switch_bool_t arg3 ; arg1 = (switch_core_session_t *)jarg1; arg2 = (switch_bool_t)jarg2; - switch_core_session_reset(arg1,arg2); + arg3 = (switch_bool_t)jarg3; + switch_core_session_reset(arg1,arg2,arg3); } @@ -13093,6 +13106,81 @@ } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_set(void * jarg1, void * jarg2) { + switch_file_handle *arg1 = (switch_file_handle *) 0 ; + switch_buffer_t *arg2 = (switch_buffer_t *) 0 ; + + arg1 = (switch_file_handle *)jarg1; + arg2 = (switch_buffer_t *)jarg2; + if (arg1) (arg1)->pre_buffer = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_get(void * jarg1) { + void * jresult ; + switch_file_handle *arg1 = (switch_file_handle *) 0 ; + switch_buffer_t *result = 0 ; + + arg1 = (switch_file_handle *)jarg1; + result = (switch_buffer_t *) ((arg1)->pre_buffer); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_data_set(void * jarg1, void * jarg2) { + switch_file_handle *arg1 = (switch_file_handle *) 0 ; + unsigned char *arg2 = (unsigned char *) 0 ; + + arg1 = (switch_file_handle *)jarg1; + arg2 = (unsigned char *)jarg2; + if (arg1) (arg1)->pre_buffer_data = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_data_get(void * jarg1) { + void * jresult ; + switch_file_handle *arg1 = (switch_file_handle *) 0 ; + unsigned char *result = 0 ; + + arg1 = (switch_file_handle *)jarg1; + result = (unsigned char *) ((arg1)->pre_buffer_data); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_datalen_set(void * jarg1, void * jarg2) { + switch_file_handle *arg1 = (switch_file_handle *) 0 ; + switch_size_t arg2 ; + switch_size_t *argp2 ; + + arg1 = (switch_file_handle *)jarg1; + argp2 = (switch_size_t *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0); + return ; + } + arg2 = *argp2; + if (arg1) (arg1)->pre_buffer_datalen = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_datalen_get(void * jarg1) { + void * jresult ; + switch_file_handle *arg1 = (switch_file_handle *) 0 ; + switch_size_t result; + + arg1 = (switch_file_handle *)jarg1; + result = ((arg1)->pre_buffer_datalen); + jresult = new switch_size_t((switch_size_t &)result); + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_file_set(void * jarg1, char * jarg2) { switch_file_handle *arg1 = (switch_file_handle *) 0 ; char *arg2 = (char *) 0 ; @@ -18377,6 +18465,26 @@ } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_event_set_basic_data(void * jarg1, void * jarg2) { + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_event_t *arg2 = (switch_event_t *) 0 ; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (switch_event_t *)jarg2; + switch_channel_event_set_basic_data(arg1,arg2); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_event_set_extended_data(void * jarg1, void * jarg2) { + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_event_t *arg2 = (switch_event_t *) 0 ; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (switch_event_t *)jarg2; + switch_channel_event_set_extended_data(arg1,arg2); +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_expand_variables(void * jarg1, char * jarg2) { char * jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; Modified: freeswitch/branches/1.0/src/mod/languages/mod_managed/managed/swig.cs ============================================================================== --- freeswitch/branches/1.0/src/mod/languages/mod_managed/managed/swig.cs (original) +++ freeswitch/branches/1.0/src/mod/languages/mod_managed/managed/swig.cs Thu Jan 22 17:14:07 2009 @@ -1344,8 +1344,8 @@ return ret; } - public static void switch_core_session_reset(SWIGTYPE_p_switch_core_session session, switch_bool_t flush_dtmf) { - freeswitchPINVOKE.switch_core_session_reset(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)flush_dtmf); + public static void switch_core_session_reset(SWIGTYPE_p_switch_core_session session, switch_bool_t flush_dtmf, switch_bool_t reset_read_codec) { + freeswitchPINVOKE.switch_core_session_reset(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)flush_dtmf, (int)reset_read_codec); } public static switch_status_t switch_core_session_write_frame(SWIGTYPE_p_switch_core_session session, switch_frame frame, uint flags, int stream_id) { @@ -2581,6 +2581,14 @@ freeswitchPINVOKE.switch_channel_event_set_data(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_event.getCPtr(arg1)); } + public static void switch_channel_event_set_basic_data(SWIGTYPE_p_switch_channel channel, switch_event arg1) { + freeswitchPINVOKE.switch_channel_event_set_basic_data(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_event.getCPtr(arg1)); + } + + public static void switch_channel_event_set_extended_data(SWIGTYPE_p_switch_channel channel, switch_event arg1) { + freeswitchPINVOKE.switch_channel_event_set_extended_data(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_event.getCPtr(arg1)); + } + public static string switch_channel_expand_variables(SWIGTYPE_p_switch_channel channel, string arg1) { string ret = freeswitchPINVOKE.switch_channel_expand_variables(SWIGTYPE_p_switch_channel.getCPtr(channel), arg1); return ret; @@ -4109,6 +4117,7 @@ public static readonly string SWITCH_SPEECH_KEY = freeswitchPINVOKE.SWITCH_SPEECH_KEY_get(); public static readonly string SWITCH_UUID_BRIDGE = freeswitchPINVOKE.SWITCH_UUID_BRIDGE_get(); public static readonly int SWITCH_BITS_PER_BYTE = freeswitchPINVOKE.SWITCH_BITS_PER_BYTE_get(); + public static readonly int SWITCH_DEFAULT_FILE_BUFFER_LEN = freeswitchPINVOKE.SWITCH_DEFAULT_FILE_BUFFER_LEN_get(); public static readonly int SWITCH_MAX_STACKS = freeswitchPINVOKE.SWITCH_MAX_STACKS_get(); public static readonly int SWITCH_THREAD_STACKSIZE = freeswitchPINVOKE.SWITCH_THREAD_STACKSIZE_get(); public static readonly int SWITCH_SYSTEM_THREAD_STACKSIZE = freeswitchPINVOKE.SWITCH_SYSTEM_THREAD_STACKSIZE_get(); @@ -4690,6 +4699,9 @@ [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BITS_PER_BYTE_get")] public static extern int SWITCH_BITS_PER_BYTE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_DEFAULT_FILE_BUFFER_LEN_get")] + public static extern int SWITCH_DEFAULT_FILE_BUFFER_LEN_get(); + [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_digit_set")] public static extern void switch_dtmf_t_digit_set(HandleRef jarg1, char jarg2); @@ -5798,7 +5810,7 @@ public static extern int switch_core_session_write_video_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_reset")] - public static extern void switch_core_session_reset(HandleRef jarg1, int jarg2); + public static extern void switch_core_session_reset(HandleRef jarg1, int jarg2, int jarg3); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_write_frame")] public static extern int switch_core_session_write_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4); @@ -7438,6 +7450,24 @@ [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_dbuflen_get")] public static extern IntPtr switch_file_handle_dbuflen_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_set")] + public static extern void switch_file_handle_pre_buffer_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_get")] + public static extern IntPtr switch_file_handle_pre_buffer_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_data_set")] + public static extern void switch_file_handle_pre_buffer_data_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_data_get")] + public static extern IntPtr switch_file_handle_pre_buffer_data_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_datalen_set")] + public static extern void switch_file_handle_pre_buffer_datalen_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_datalen_get")] + public static extern IntPtr switch_file_handle_pre_buffer_datalen_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_file_set")] public static extern void switch_file_handle_file_set(HandleRef jarg1, string jarg2); @@ -8743,6 +8773,12 @@ [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_event_set_data")] public static extern void switch_channel_event_set_data(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_event_set_basic_data")] + public static extern void switch_channel_event_set_basic_data(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_event_set_extended_data")] + public static extern void switch_channel_event_set_extended_data(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_expand_variables")] public static extern string switch_channel_expand_variables(HandleRef jarg1, string jarg2); @@ -19956,7 +19992,9 @@ SWITCH_FILE_NATIVE = (1 << 9), SWITCH_FILE_SEEK = (1 << 10), SWITCH_FILE_OPEN = (1 << 11), - SWITCH_FILE_CALLBACK = (1 << 12) + SWITCH_FILE_CALLBACK = (1 << 12), + SWITCH_FILE_DONE = (1 << 13), + SWITCH_FILE_BUFFER_DONE = (1 << 14) } } @@ -20304,6 +20342,40 @@ } } + public SWIGTYPE_p_switch_buffer pre_buffer { + set { + freeswitchPINVOKE.switch_file_handle_pre_buffer_set(swigCPtr, SWIGTYPE_p_switch_buffer.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_pre_buffer_get(swigCPtr); + SWIGTYPE_p_switch_buffer ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_buffer(cPtr, false); + return ret; + } + } + + public SWIGTYPE_p_unsigned_char pre_buffer_data { + set { + freeswitchPINVOKE.switch_file_handle_pre_buffer_data_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_pre_buffer_data_get(swigCPtr); + SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false); + return ret; + } + } + + public SWIGTYPE_p_switch_size_t pre_buffer_datalen { + set { + freeswitchPINVOKE.switch_file_handle_pre_buffer_datalen_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + } + get { + SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_file_handle_pre_buffer_datalen_get(swigCPtr), true); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public string file { set { freeswitchPINVOKE.switch_file_handle_file_set(swigCPtr, value); Modified: freeswitch/branches/1.0/src/switch_core_file.c ============================================================================== --- freeswitch/branches/1.0/src/switch_core_file.c (original) +++ freeswitch/branches/1.0/src/switch_core_file.c Thu Jan 22 17:14:07 2009 @@ -132,7 +132,7 @@ { switch_status_t status = SWITCH_STATUS_FALSE; switch_size_t want, got, orig_len = *len; - + switch_assert(fh != NULL); switch_assert(fh->file_interface != NULL); @@ -155,19 +155,21 @@ if (fh->pre_buffer) { switch_size_t rlen; + int asis = switch_test_flag(fh, SWITCH_FILE_NATIVE); + if (!switch_test_flag(fh, SWITCH_FILE_BUFFER_DONE)) { if (!switch_buffer_inuse(fh->pre_buffer)) { - rlen = fh->pre_buffer_datalen / 2; + rlen = asis ? fh->pre_buffer_datalen : fh->pre_buffer_datalen / 2; if ((status = fh->file_interface->file_read(fh, fh->pre_buffer_data, &rlen)) != SWITCH_STATUS_SUCCESS || !rlen) { switch_set_flag(fh, SWITCH_FILE_BUFFER_DONE); } else { - switch_buffer_write(fh->pre_buffer, fh->pre_buffer_data, rlen * 2); + switch_buffer_write(fh->pre_buffer, fh->pre_buffer_data, asis ? rlen : rlen * 2); } } } - rlen = switch_buffer_read(fh->pre_buffer, data, *len * 2); - *len = rlen / 2; + rlen = switch_buffer_read(fh->pre_buffer, data, asis ? *len : *len * 2); + *len = asis ? rlen : rlen / 2; if (*len == 0) { switch_set_flag(fh, SWITCH_FILE_DONE); @@ -278,13 +280,14 @@ if (fh->pre_buffer) { switch_size_t rlen, blen; switch_status_t status = SWITCH_STATUS_SUCCESS; + int asis = switch_test_flag(fh, SWITCH_FILE_NATIVE); - switch_buffer_write(fh->pre_buffer, data, *len * 2); + switch_buffer_write(fh->pre_buffer, data, asis ? *len : *len * 2); rlen = switch_buffer_inuse(fh->pre_buffer); if (rlen >= fh->pre_buffer_datalen) { blen = switch_buffer_read(fh->pre_buffer, fh->pre_buffer_data, fh->pre_buffer_datalen); - blen /= 2; + if (!asis) blen /= 2; if ((status = fh->file_interface->file_write(fh, fh->pre_buffer_data, &blen)) != SWITCH_STATUS_SUCCESS) { *len = 0; } @@ -346,6 +349,10 @@ switch_assert(fh != NULL); switch_assert(fh->file_interface != NULL); + if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) { + return SWITCH_STATUS_FALSE; + } + switch_clear_flag(fh, SWITCH_FILE_OPEN); status = fh->file_interface->file_close(fh); @@ -356,9 +363,11 @@ if (fh->pre_buffer) { if (switch_test_flag(fh, SWITCH_FILE_FLAG_WRITE)) { switch_size_t rlen, blen; + int asis = switch_test_flag(fh, SWITCH_FILE_NATIVE); + while((rlen = switch_buffer_inuse(fh->pre_buffer))) { blen = switch_buffer_read(fh->pre_buffer, fh->pre_buffer_data, fh->pre_buffer_datalen); - blen /= 2; + if (asis) blen /= 2; if (fh->file_interface->file_write(fh, fh->pre_buffer_data, &blen) != SWITCH_STATUS_SUCCESS) { break; } Modified: freeswitch/branches/1.0/src/switch_ivr_play_say.c ============================================================================== --- freeswitch/branches/1.0/src/switch_ivr_play_say.c (original) +++ freeswitch/branches/1.0/src/switch_ivr_play_say.c Thu Jan 22 17:14:07 2009 @@ -384,6 +384,7 @@ const char *vval; time_t start = 0; uint32_t org_silence_hits = 0; + int asis = 0; switch_assert(read_codec != NULL); @@ -396,6 +397,30 @@ fh->channels = read_codec->implementation->number_of_channels; fh->native_rate = read_codec->implementation->actual_samples_per_second; + + + if (!strstr(file, SWITCH_URL_SEPARATOR)) { + char *ext; + const char *prefix; + + prefix = switch_channel_get_variable(channel, "sound_prefix"); + if (!prefix) { + prefix = SWITCH_GLOBAL_dirs.base_dir; + } + + if (!switch_is_file_path(file)) { + file = switch_core_session_sprintf(session, "%s%s%s", prefix, SWITCH_PATH_SEPARATOR, file); + } + if ((ext = strrchr(file, '.'))) { + ext++; + } else { + ext = read_codec->implementation->iananame; + file = switch_core_session_sprintf(session, "%s.%s", file, ext); + asis = 1; + } + } + + if (switch_core_file_open(fh, file, fh->channels, @@ -406,6 +431,10 @@ return SWITCH_STATUS_GENERR; } + if (switch_test_flag(fh, SWITCH_FILE_NATIVE)) { + asis = 1; + } + switch_channel_pre_answer(channel); if ((p = switch_channel_get_variable(channel, "RECORD_TITLE"))) { @@ -444,37 +473,43 @@ switch_channel_set_variable(channel, "RECORD_DATE", NULL); } - codec_name = "L16"; - if (switch_core_codec_init(&codec, - codec_name, - NULL, - read_codec->implementation->actual_samples_per_second, - read_codec->implementation->microseconds_per_packet / 1000, - read_codec->implementation->number_of_channels, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, - switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activated\n"); - switch_core_session_set_read_codec(session, &codec); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, - fh->channels, read_codec->implementation->microseconds_per_packet / 1000); - switch_core_file_close(fh); - switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); - return SWITCH_STATUS_GENERR; + if (!asis) { + codec_name = "L16"; + if (switch_core_codec_init(&codec, + codec_name, + NULL, + read_codec->implementation->actual_samples_per_second, + read_codec->implementation->microseconds_per_packet / 1000, + read_codec->implementation->number_of_channels, + SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, + switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activated\n"); + switch_core_session_set_read_codec(session, &codec); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, + fh->channels, read_codec->implementation->microseconds_per_packet / 1000); + switch_core_file_close(fh); + switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); + return SWITCH_STATUS_GENERR; + } } if (limit) { start = switch_timestamp(NULL); } - + if (fh->thresh) { - if (fh->silence_hits) { - fh->silence_hits = fh->samplerate * fh->silence_hits / read_codec->implementation->samples_per_packet; + if (asis) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't detect silence on a native recording.\n"); } else { - fh->silence_hits = fh->samplerate * 3 / read_codec->implementation->samples_per_packet; + if (fh->silence_hits) { + fh->silence_hits = fh->samplerate * fh->silence_hits / read_codec->implementation->samples_per_packet; + } else { + fh->silence_hits = fh->samplerate * 3 / read_codec->implementation->samples_per_packet; + } + org_silence_hits = fh->silence_hits; } - org_silence_hits = fh->silence_hits; } for (;;) { @@ -543,7 +578,7 @@ } } - if (fh->thresh) { + if (!asis && fh->thresh) { int16_t *fdata = (int16_t *) read_frame->data; uint32_t samples = read_frame->datalen / sizeof(*fdata); uint32_t score, count = 0, j = 0; @@ -571,8 +606,8 @@ if (!switch_test_flag(fh, SWITCH_FILE_PAUSE) && !switch_test_flag(read_frame, SFF_CNG)) { int16_t *data = read_frame->data; - len = (switch_size_t) read_frame->datalen / 2; - + len = (switch_size_t) asis ? read_frame->datalen : read_frame->datalen / 2; + if (switch_core_file_write(fh, data, &len) != SWITCH_STATUS_SUCCESS) { break; }
participants (1)
-
FreeSWITCH SVN