]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
ftmod_misdn: Discard incoming audio data if b-channel is not active
authorStefan Knoblich <stkn@openisdn.net>
Mon, 17 Sep 2012 19:40:59 +0000 (21:40 +0200)
committerStefan Knoblich <stkn@openisdn.net>
Mon, 17 Sep 2012 19:40:59 +0000 (21:40 +0200)
Silences the "Device or resource busy" error messages caused by the RX pipe
filling up.

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c

index 84133601f3b13b928409dc1168d6dd653d683441..d5fdc54bfc2d2c120f2cdf2c3146deab5131fa7b 100644 (file)
@@ -2265,18 +2265,21 @@ static ftdm_status_t handle_b_channel_event(ftdm_channel_t *chan)
                int datalen = retval - MISDN_HEADER_LEN;
                char *data  = buf    + MISDN_HEADER_LEN;
 
-               /* Convert audio data */
-               misdn_convert_audio_bits(data, datalen);
+               /* Discard incoming audio if not active */
+               if (!priv->active) {
+                       /* Convert audio data */
+                       misdn_convert_audio_bits(data, datalen);
 
-               /* Write audio into receive pipe */
-               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",
-                               strerror(errno));
-                       return FTDM_FAIL;
-               } else if (retval < datalen) {
-                       ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN short write into rx pipe, written: %d, expected: %d\n",
-                               retval, datalen);
-                       return FTDM_FAIL;
+                       /* Write audio into receive pipe */
+                       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",
+                                       strerror(errno));
+                               return FTDM_FAIL;
+                       } else if (retval < datalen) {
+                               ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN short write into rx pipe, written: %d, expected: %d\n",
+                                       retval, datalen);
+                               return FTDM_FAIL;
+                       }
                }
 
                /* Get receive buffer usage */