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: Stefan Knoblich <stkn@openisdn.net>
This commit is contained in:
Stefan Knoblich 2012-09-17 21:40:59 +02:00
parent e561709f5a
commit bc414df510
1 changed files with 14 additions and 11 deletions

View File

@ -2265,6 +2265,8 @@ 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;
/* Discard incoming audio if not active */
if (!priv->active) {
/* Convert audio data */ /* Convert audio data */
misdn_convert_audio_bits(data, datalen); misdn_convert_audio_bits(data, datalen);
@ -2278,6 +2280,7 @@ static ftdm_status_t handle_b_channel_event(ftdm_channel_t *chan)
retval, datalen); retval, datalen);
return FTDM_FAIL; return FTDM_FAIL;
} }
}
/* Get receive buffer usage */ /* Get receive buffer usage */
if (ioctl(priv->tx_audio_pipe_out, FIONREAD, &retval) < 0) { if (ioctl(priv->tx_audio_pipe_out, FIONREAD, &retval) < 0) {