Added display of current active TEI values (L2) at lcradmin.
[lcr.git] / bchannel.c
index c25d770..187409f 100644 (file)
 #define MISDN_OLD_AF_COMPATIBILITY 1
 #include <compat_af_isdn.h>
 
+#define HAVE_ATTRIBUTE_always_inline 1
+#define HAVE_ARPA_INET_H 1
+#define HAVE_TIMERSUB 1
+
+#include <asterisk/compiler.h>
 #include <asterisk/frame.h>
 
+/* Choose if you want to have chan_lcr for Asterisk 1.4.x or CallWeaver 1.2.x */
+/* #define LCR_FOR_CALLWEAVER */
+
+#ifdef LCR_FOR_CALLWEAVER
+#include <asterisk/phone_no_utils.h>
+#include <asterisk/logger.h>
+#include <asterisk/module.h>
+#include <asterisk/channel.h>
+#endif
 
 #include "extension.h"
 #include "message.h"
@@ -205,7 +219,6 @@ void bchannel_activate(struct bchannel *bchannel, int activate)
                CERROR(bchannel->call, NULL, "Failed to send to socket %d\n", bchannel->b_sock);
 
        bchannel->b_state = (activate)?BSTATE_ACTIVATING:BSTATE_DEACTIVATING;
-       bchannel->rebuffer_usage = 0;
 }
 
 
@@ -260,7 +273,6 @@ void bchannel_destroy(struct bchannel *bchannel)
        {
                close(bchannel->b_sock);
                bchannel->b_sock = -1;
-               bchannel->rebuffer_usage = 0;
        }
        bchannel->b_state = BSTATE_IDLE;
 }
@@ -385,52 +397,15 @@ static void bchannel_receive(struct bchannel *bchannel, unsigned char *buffer, i
                }
        }
 
-       /* no hdlc and rebuffer */
-       if (bchannel->call->rebuffer && !bchannel->call->hdlc) {
-               int u = bchannel->rebuffer_usage;
-               unsigned char * b = bchannel->rebuffer;
-               int l = len;
-               int fd = bchannel->call->pipe[1];
-
-               d = data;
-
-               if (u > 0) {
-                       if (u + l >= 160) {
-                               memcpy(b + u, d, 160 - u);
-                               d += 160 - u;
-                               l -= 160 - u;
-                               u = 0;
-                               if (write(fd, b, 160) < 0)
-                                       goto errout;
-                       } else {
-                               memcpy(b + u, d, l);
-                               u += l;
-                               l = 0;
-                       }
-               }
-
-               while (l >= 160) {
-                       if (write(fd, d, 160) < 0)
-                               goto errout;
-                       d += 160;
-                       l -= 160;
-               }
-
-               if (l > 0) {
-                       memcpy(b, d, l);
-               } 
-               bchannel->rebuffer_usage = u + l;
-       } else {
-               len = write(bchannel->call->pipe[1], data, len);
-               if (len < 0)
-                       goto errout;
-       }
+       
+       len = write(bchannel->call->pipe[1], data, len);
+       if (len < 0)
+               goto errout;
 
        return;
  errout:
        close(bchannel->call->pipe[1]);
        bchannel->call->pipe[1] = -1;
-       bchannel->rebuffer_usage = 0;
        CDEBUG(bchannel->call, NULL, "broken pipe on bchannel pipe\n");
 }