提交 bc414df5 authored 作者: Stefan Knoblich's avatar Stefan Knoblich

ftmod_misdn: Discard incoming audio data if b-channel is not active

Silences the "Device or resource busy" error messages caused by the RX pipe
filling up.
Signed-off-by: 's avatarStefan Knoblich <stkn@openisdn.net>
上级 e561709f
...@@ -2265,18 +2265,21 @@ static ftdm_status_t handle_b_channel_event(ftdm_channel_t *chan) ...@@ -2265,18 +2265,21 @@ static ftdm_status_t handle_b_channel_event(ftdm_channel_t *chan)
int datalen = retval - MISDN_HEADER_LEN; int datalen = retval - MISDN_HEADER_LEN;
char *data = buf + MISDN_HEADER_LEN; char *data = buf + MISDN_HEADER_LEN;
/* Convert audio data */ /* Discard incoming audio if not active */
misdn_convert_audio_bits(data, datalen); if (!priv->active) {
/* Convert audio data */
misdn_convert_audio_bits(data, datalen);
/* Write audio into receive pipe */ /* Write audio into receive pipe */
if ((retval = write(priv->rx_audio_pipe_in, data, datalen)) < 0) { if ((retval = write(priv->rx_audio_pipe_in, data, datalen)) < 0) {
ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN failed to write audio data into rx pipe: %s\n", ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN failed to write audio data into rx pipe: %s\n",
strerror(errno)); strerror(errno));
return FTDM_FAIL; return FTDM_FAIL;
} else if (retval < datalen) { } else if (retval < datalen) {
ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN short write into rx pipe, written: %d, expected: %d\n", ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN short write into rx pipe, written: %d, expected: %d\n",
retval, datalen); retval, datalen);
return FTDM_FAIL; return FTDM_FAIL;
}
} }
/* Get receive buffer usage */ /* Get receive buffer usage */
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论