#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"
}
if (bchannel->b_sock < 0)
{
- CERROR(bchannel->call, NULL, "Failed to open bchannel-socket for handle 0x%x with mISDN-DSP layer. Did you load mISDNdsp.ko?\n", bchannel->handle);
+ CERROR(bchannel->call, NULL, "Failed to open bchannel-socket for handle 0x%x with mISDN-DSP layer. Did you load mISDN_dsp.ko?\n", bchannel->handle);
return(0);
}
/* bind socket to bchannel */
addr.family = AF_ISDN;
- addr.dev = (bchannel->handle>>8)-1;
+ addr.dev = (bchannel->handle>>8);
addr.channel = bchannel->handle & 0xff;
ret = bind(bchannel->b_sock, (struct sockaddr *)&addr, sizeof(addr));
if (ret < 0)
{
- CERROR(bchannel->call, NULL, "Failed to bind bchannel-socket for handle 0x%x with mISDN-DSP layer. (port %d, channel %d) Did you load mISDNdsp.ko?\n", bchannel->handle, addr.dev + 1, addr.channel);
+ CERROR(bchannel->call, NULL, "Failed to bind bchannel-socket for handle 0x%x with mISDN-DSP layer. (port %d, channel %d) Did you load mISDN_dsp.ko?\n", bchannel->handle, addr.dev, addr.channel);
close(bchannel->b_sock);
bchannel->b_sock = -1;
return(0);
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;
}
{
close(bchannel->b_sock);
bchannel->b_sock = -1;
- bchannel->rebuffer_usage = 0;
}
bchannel->b_state = BSTATE_IDLE;
}
}
}
- /* 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");
}