From 25dd668af269ed9221556f155feb4dd9c0e223ad Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 21 Feb 2012 10:51:18 -0600 Subject: [PATCH] allow enable_file_write_buffering to alternatively allow you to set the exact size of the pre buffer --- src/switch_ivr_async.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 1620086e62..6e3385ff23 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1639,10 +1639,19 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t fh->channels = channels; - vval = switch_channel_get_variable(channel, "enable_file_write_buffering"); - if (!vval || switch_true(vval)) { + if ((vval = switch_channel_get_variable(channel, "enable_file_write_buffering"))) { + int tmp = atoi(vval); + + if (tmp > 0) { + fh->pre_buffer_datalen = tmp; + } else if (switch_true(vval)) { + fh->pre_buffer_datalen = SWITCH_DEFAULT_FILE_BUFFER_LEN; + } + + } else { fh->pre_buffer_datalen = SWITCH_DEFAULT_FILE_BUFFER_LEN; } + if (!switch_is_file_path(file)) { char *tfile = NULL;