From b71a3176bac04aeb5039a3811782f7d94db65900 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 11 Dec 2009 02:24:41 +0000 Subject: [PATCH] FSCORE-510 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15896 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_ivr_async.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 73a02768b9..5b5e49fc43 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1553,23 +1553,23 @@ static switch_bool_t inband_dtmf_generate_callback(switch_media_bug_t *bug, void frame = switch_core_media_bug_get_write_replace_frame(bug); } - while (switch_queue_trypop(pvt->digit_queue, &pop) == SWITCH_STATUS_SUCCESS) { - switch_dtmf_t *dtmf = (switch_dtmf_t *) pop; - char buf[2] = ""; - int duration = dtmf->duration; + if (!switch_buffer_inuse(pvt->audio_buffer)) { + while (switch_queue_trypop(pvt->digit_queue, &pop) == SWITCH_STATUS_SUCCESS) { + switch_dtmf_t *dtmf = (switch_dtmf_t *) pop; + char buf[2] = ""; + int duration = dtmf->duration; - buf[0] = dtmf->digit; - if (duration > 8000) { - duration = 4000; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_WARNING, "%s Truncating ridiculous DTMF duration %d ms to 1/2 second.\n", - switch_channel_get_name(switch_core_session_get_channel(pvt->session)), dtmf->duration / 8); + buf[0] = dtmf->digit; + if (duration > 8000) { + duration = 4000; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_WARNING, "%s Truncating ridiculous DTMF duration %d ms to 1/2 second.\n", + switch_channel_get_name(switch_core_session_get_channel(pvt->session)), dtmf->duration / 8); + } + pvt->ts.duration = duration; + teletone_run(&pvt->ts, buf); + free(pop); } - pvt->ts.duration = duration; - teletone_run(&pvt->ts, buf); - free(pop); - } - - if (switch_buffer_inuse(pvt->audio_buffer) && (bytes = switch_buffer_read(pvt->audio_buffer, frame->data, frame->datalen))) { + } else if (switch_buffer_inuse(pvt->audio_buffer) && (bytes = switch_buffer_read(pvt->audio_buffer, frame->data, frame->datalen))) { if (bytes < frame->datalen) { switch_byte_t *dp = frame->data; memset(dp + bytes, 0, frame->datalen - bytes);