diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 052e949d5f..e3b5329291 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1693,10 +1693,12 @@ static switch_bool_t eavesdrop_callback(switch_media_bug_t *bug, void *user_data if (switch_buffer_inuse(ep->w_buffer) >= rframe->datalen) { uint32_t bytes; + int channels = rframe->channels ? rframe->channels : 1; + switch_buffer_lock(ep->w_buffer); bytes = (uint32_t) switch_buffer_read(ep->w_buffer, data, rframe->datalen); - rframe->datalen = switch_merge_sln(rframe->data, rframe->samples, (int16_t *) data, bytes / 2, rframe->channels) * 2 * rframe->channels; + rframe->datalen = switch_merge_sln(rframe->data, rframe->samples, (int16_t *) data, bytes / 2, channels) * 2 * channels; rframe->samples = rframe->datalen / 2; switch_buffer_unlock(ep->w_buffer); diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index d03f9d872c..27a40f537c 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1438,7 +1438,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess "Setup timer success %u bytes per %d ms! %d ch\n", len, interval, codec.implementation->number_of_channels); } write_frame.rate = fh->samplerate; - + write_frame.channels = fh->channels; if (timer_name) { /* start a thread to absorb incoming audio */ switch_core_service_session(session);