* Added mISDN/mISDNuser Echo cancel Patch

* Fixed Makefiles so that chan_misdn can be compiled again
* added some hints, that mISDN cannot be compiled against gcc-4, SMP, Spinlock Debug
* fixed some Minor issues in chan_misdn, regarding Type Of Number and Presentation






git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@7490 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Christian Richter
2005-12-15 10:52:30 +00:00
parent 5a06af4d57
commit 8b352fcb94
13 changed files with 3028 additions and 175 deletions

View File

@@ -5,41 +5,68 @@
#
# Verify those options with main Makefile
ifndef LINUX
LINUX=/lib/modules/$(shell uname -r)/build
endif
CFLAGS += -pipe -c
CFLAGS += -pipe -c -DMISDNUSER_JOLLY
SOURCES = isdn_lib.c isdn_msg_parser.c
OBJDIR = .
OBJS = isdn_lib.o isdn_msg_parser.o
ifndef MISDNUSER
MISDNUSER=/usr/src/install-misdn/mISDNuser
endif
MISDNCFLAGS += -I$(MISDNUSER)/include -I$(MISDNUSER)/i4lnet -I$(MISDNUSER)/lib
MISDNCFLAGS += -DMISDNUSER_JOLLY -I$(LINUX)/include
all: chan_misdn_lib.a Makefile.ast
all: chan_misdn_lib.a
%.o: %.c
$(CC) $(MISDNCFLAGS) $(CFLAGS) -o $@ $<
$(CC) $(CFLAGS) -o $@ $<
chan_misdn_lib.a: $(OBJS)
ar crv $@ $(OBJS)
Makefile.ast: FORCE
@echo CFLAGS+=$(MISDNCFLAGS) -Imisdn/ -DCHAN_MISDN_VERSION=\\\"0.2.0\\\" >$@.tmp
@echo MISDNUSER = $(MISDNUSER) >>$@.tmp
@if [ -r $@ ] && cmp -s $@ $@.tmp; then rm -f $@.tmp; else mv -f $@.tmp $@; fi
misdn: test_preempt
if [ ! -d lib ] ; then \
mkdir lib; \
cd lib ; \
wget http://isdn.jolly.de/download/v3.1/mISDN_for_PBX4Linux-3.0.tar.gz ;\
tar xzf mISDN_for_PBX4Linux-3.0.tar.gz; \
wget http://isdn.jolly.de/download/v3.1/mISDNuser_for_PBX4Linux-3.0.tar.gz ;\
tar xzf mISDNuser_for_PBX4Linux-3.0.tar.gz ;\
cd mISDN; patch -p1 <../../mISDN.patch; \
cd ../mISDNuser ; patch -p1 <../../mISDNuser.patch; \
fi
cd lib/mISDN ; make install
cd lib/mISDNuser ; make install
LINUX=/lib/modules/$(uname -r)/build
GCCVERSION=$(shell $(CC) --version | grep GCC | cut -d " " -f 3 | cut -d "." -f 1)
test_preempt:
@if grep 'CONFIG_DEBUG_SPINLOCK=y' $(LINUX)/.config ; then \
echo -e "\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!\nDisable the DEBUG_SPINLOCK Setting in your Kernel Config.\n with this option set, mISDN will not work! \n\n" ;\
read ; \
exit 1 ; \
fi
@if grep 'CONFIG_DEBUG_SPINLOCK_SLEEP=y' $(LINUX)/.config ; then \
echo -e "\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!\nDisable the DEBUG_SPINLOCK_SLEEP Setting in your Kernel Config.\n with this option set, mISDN will not work! \n\n" ;\
read ; \
exit 1 ; \
fi
@if grep 'CONFIG_SMP=y' $(LINUX)/.config ; then \
echo -e "\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!\nDisable the SMP Setting in your Kernel Config.\n\n" ; \
read ; \
exit 1 ; \
fi
@if test "$(GCCVERSION)" -gt 3 ; then \
echo -e "\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!\nYou're using GCC 4! Please downgrade to gcc-3.x and type:\nexport CC=gcc-3.x\nbefore issuing make again.\nyou won't have success with gcc-4!\n\n" ; \
read ; \
exit 1 ; \
fi
FORCE:
clean:
rm *.a *.o Makefile.ast
rm -rf *.a *.o *.so
misdn_clean:
rm -rf lib

View File

@@ -32,6 +32,7 @@ enum misdn_cfg_elements {
MISDN_CFG_CALLERID, /* char[] */
MISDN_CFG_METHOD, /* char[] */
MISDN_CFG_DIALPLAN, /* int */
MISDN_CFG_LOCALDIALPLAN, /* int */
MISDN_CFG_NATPREFIX, /* char[] */
MISDN_CFG_INTERNATPREFIX, /* char[] */
MISDN_CFG_PRES, /* int (bool) */

View File

@@ -26,10 +26,10 @@
#include "isdn_lib_intern.h"
#include <mISDNlib.h>
#include <isdn_net.h>
#include <l3dss1.h>
#include <net_l3.h>
#include <mISDNuser/mISDNlib.h>
#include <mISDNuser/isdn_net.h>
#include <mISDNuser/l3dss1.h>
#include <mISDNuser/net_l3.h>
#define CENTREX_FAC 0x88

View File

@@ -91,8 +91,8 @@ enum global_states {
static enum global_states global_state=MISDN_INITIALIZING;
#include <../i4lnet/net_l2.h>
#include <tone.h>
#include <mISDNuser/net_l2.h>
#include <mISDNuser/tone.h>
#include <unistd.h>
#include <semaphore.h>
#include <pthread.h>
@@ -341,6 +341,10 @@ int misdn_cap_is_speech(int cap)
int misdn_inband_avail(struct misdn_bchannel *bc)
{
/*if ! early_bconnect we have never inband available*/
if ( ! bc->early_bconnect ) return 0;
switch (bc->progress_indicator) {
case INFO_PI_INBAND_AVAILABLE:
case INFO_PI_CALL_NOT_E2E_ISDN:
@@ -421,7 +425,7 @@ void empty_bc(struct misdn_bchannel *bc)
bc->curptx=0; bc->curprx=0;
bc->crypt_key[0] = 0;
bc->tone=TONE_NONE;
bc->tone_cnt2 = bc->tone_cnt=0;
@@ -429,12 +433,15 @@ void empty_bc(struct misdn_bchannel *bc)
bc->onumplan=NUMPLAN_UNKNOWN;
bc->rnumplan=NUMPLAN_UNKNOWN;
bc->active = 0;
bc->early_bconnect = 1;
bc->ec_enable = 0;
bc->ec_deftaps = 128;
bc->ec_whenbridged = 0;
bc->ec_training = 400;
bc->ec_training = 1;
bc->orig=0;
@@ -3240,7 +3247,7 @@ void manager_ec_enable(struct misdn_bchannel *bc)
struct misdn_stack *stack=get_stack_by_bc(bc);
cb_log(1, stack?stack->port:0,"Sending Control ECHOCAN_ON enblock\n");
cb_log(1, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d training:%d\n",bc->ec_deftaps, bc->ec_training);
switch (bc->ec_deftaps) {
case 4:
@@ -3266,6 +3273,7 @@ void manager_ec_enable(struct misdn_bchannel *bc)
}
void manager_ec_disable(struct misdn_bchannel *bc)
{
struct misdn_stack *stack=get_stack_by_bc(bc);

View File

@@ -184,6 +184,7 @@ struct misdn_bchannel {
int te_choose_channel;
int early_bconnect;
/* dtmf digit */
int dtmf;

View File

@@ -2,10 +2,10 @@
#define ISDN_LIB_INTER
#include <mISDNlib.h>
#include <isdn_net.h>
#include <l3dss1.h>
#include <net_l3.h>
#include <mISDNuser/mISDNlib.h>
#include <mISDNuser/isdn_net.h>
#include <mISDNuser/l3dss1.h>
#include <mISDNuser/net_l3.h>
#include <pthread.h>

View File

@@ -284,31 +284,30 @@ msg_t *build_setup (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
{
int coding=0, capability, mode=0 /* 2 for packet ! */
,user, rate=0x10;
switch (bc->capability) {
case INFO_CAPABILITY_SPEECH: capability = 0;
// cb_log(2, bc->stack->port, " --> Speech\n");
break;
case INFO_CAPABILITY_DIGITAL_UNRESTRICTED: capability = 8;
// cb_log(2, bc->stack->port, " --> cap unres Digital\n");
break;
case INFO_CAPABILITY_DIGITAL_RESTRICTED: capability = 9;
// cb_log(2, bc->stack->port, " --> cap res Digital\n");
break;
default:
// cb_log(2, bc->stack->port, " --> cap Speech\n");
capability=bc->capability;
}
switch (bc->law) {
case INFO_CODEC_ULAW: user=2;
// cb_log(2, bc->stack->port, " --> Codec Ulaw\n");
break;
case INFO_CODEC_ALAW: user=3;
// cb_log(2, bc->stack->port, " --> Codec Alaw\n");
break;
default:
user=3;
}
switch (bc->capability) {
case INFO_CAPABILITY_SPEECH: capability = 0;
break;
case INFO_CAPABILITY_DIGITAL_UNRESTRICTED: capability = 8;
user=-1;
break;
case INFO_CAPABILITY_DIGITAL_RESTRICTED: capability = 9;
user=-1;
break;
default:
capability=bc->capability;
}
enc_ie_bearer(&setup->BEARER, msg, coding, capability, mode, rate, -1, user, nt,bc);
}

2500
channels/misdn/mISDN.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,271 @@
diff -u -r -P /tmp/mISDNuser/example/Makefile mISDNuser/example/Makefile
--- /tmp/mISDNuser/example/Makefile 2004-08-28 14:31:02.000000000 +0200
+++ mISDNuser/example/Makefile 2005-12-05 18:57:10.000000000 +0100
@@ -3,6 +3,11 @@
all: $(PROGS)
+install:
+ for i in $(PROGS) ; do \
+ install -m 755 $$i $(INSTALL_PREFIX)/usr/bin ;\
+ done
+
testcon: testcon.o $(mISDNLIB)
testnet: testnet.o $(mISDNLIB)
@@ -26,7 +31,7 @@
clean:
- rm -f *.o *~ DEADJOE
+ rm -f *.o *.so *~ DEADJOE
rm -f loadfirm logger testcon testcon_l2 testnet
distclean: clean
diff -u -r -P /tmp/mISDNuser/i4lnet/Makefile mISDNuser/i4lnet/Makefile
--- /tmp/mISDNuser/i4lnet/Makefile 2004-08-28 14:27:53.000000000 +0200
+++ mISDNuser/i4lnet/Makefile 2005-12-05 18:57:40.000000000 +0100
@@ -1,9 +1,18 @@
-all: libisdnnet.a
+all: libisdnnet.a libisdnnet.so
+
+install:
+ install -m 644 libisdnnet.so $(INSTALL_PREFIX)/usr/lib/
+ cp *.h $(INSTALL_PREFIX)/usr/include/mISDNuser/
+
ISDNNETOBJ = net_if.o isdn_debug.o isdn_msg.o fsm.o net_l2.o tei.o net_l3.o \
manager.o tone.o bchannel.o g711.o
+libisdnnet.so: $(ISDNNETOBJ)
+ rm -f $@
+ $(CC) -shared -Xlinker -x -o $@ $(ISDNNETOBJ)
+
libisdnnet.a: $(ISDNNETOBJ)
rm -f $@
ar cr $@ $(ISDNNETOBJ)
@@ -33,7 +42,7 @@
g711.o: g711.c $(INCLUDEDIR)/g711.h
clean:
- rm -f *.o *~ DEADJOE
+ rm -f *.o *.so *~ DEADJOE
rm -f libisdnnet.a
distclean: clean
diff -u -r -P /tmp/mISDNuser/i4lnet/net_if.c mISDNuser/i4lnet/net_if.c
--- /tmp/mISDNuser/i4lnet/net_if.c 2004-12-05 18:23:40.000000000 +0100
+++ mISDNuser/i4lnet/net_if.c 2005-11-14 09:27:58.000000000 +0100
@@ -1,7 +1,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <asm/bitops.h>
+#include "net_l2.h"
#include "isdn_net.h"
#include "bchannel.h"
#include "helper.h"
diff -u -r -P /tmp/mISDNuser/i4lnet/net_l2.c mISDNuser/i4lnet/net_l2.c
--- /tmp/mISDNuser/i4lnet/net_l2.c 2004-12-05 23:22:15.000000000 +0100
+++ mISDNuser/i4lnet/net_l2.c 2005-11-14 09:27:58.000000000 +0100
@@ -32,18 +32,6 @@
#define L2_STATE_COUNT (ST_L2_8+1)
-static char *strL2State[] =
-{
- "ST_L2_1",
- "ST_L2_2",
- "ST_L2_3",
- "ST_L2_4",
- "ST_L2_5",
- "ST_L2_6",
- "ST_L2_7",
- "ST_L2_8",
-};
-
enum {
EV_L2_UI,
EV_L2_SABME,
diff -u -r -P /tmp/mISDNuser/i4lnet/net_l2.h mISDNuser/i4lnet/net_l2.h
--- /tmp/mISDNuser/i4lnet/net_l2.h 2004-12-05 00:47:10.000000000 +0100
+++ mISDNuser/i4lnet/net_l2.h 2005-11-14 09:27:58.000000000 +0100
@@ -9,7 +9,6 @@
#ifndef NET_L2_H
#define NET_L2_H
-#include <asm/bitops.h>
#include "mISDNlib.h"
#include "isdn_net.h"
#include "fsm.h"
@@ -118,4 +117,31 @@
#define FLG_LAPD_NET 18
#define FLG_TEI_T201_1 19
+
+/* Simple replacement for the NON-ATOMIC routines which asm/bitops.h
+ was providing. */
+static inline int test_bit(int bit, unsigned long *word)
+{
+ return !!((*word) & (1<<bit));
+}
+static inline int test_and_clear_bit(int bit, unsigned long *word)
+{
+ int ret = !!((*word) & (1<<bit));
+ *word &= ~(1<<bit);
+ return ret;
+}
+static inline int test_and_set_bit(int bit, unsigned long *word)
+{
+ int ret = !!((*word) & (1<<bit));
+ *word |= 1<<bit;
+ return ret;
+}
+static inline void clear_bit(int bit, unsigned long *word)
+{
+ *word &= ~(1<<bit);
+}
+static inline void set_bit(int bit, unsigned long *word)
+{
+ *word |= 1<<bit;
+}
#endif
diff -u -r -P /tmp/mISDNuser/i4lnet/net_l3.c mISDNuser/i4lnet/net_l3.c
--- /tmp/mISDNuser/i4lnet/net_l3.c 2005-04-30 17:32:06.000000000 +0200
+++ mISDNuser/i4lnet/net_l3.c 2005-11-14 09:27:58.000000000 +0100
@@ -9,7 +9,6 @@
*/
#include <stdlib.h>
-#include <asm/bitops.h>
#include "mISDNlib.h"
#include "net_l2.h"
#include "net_l3.h"
diff -u -r -P /tmp/mISDNuser/lib/Makefile mISDNuser/lib/Makefile
--- /tmp/mISDNuser/lib/Makefile 2004-08-28 14:28:38.000000000 +0200
+++ mISDNuser/lib/Makefile 2005-12-05 18:57:27.000000000 +0100
@@ -1,7 +1,18 @@
-all: libmISDN.a
+all: libmISDN.a libmISDN.so
-libmISDN.a: device.o layer.o stack.o status.o
+install:
+ install -m 644 libmISDN.so $(INSTALL_PREFIX)/usr/lib/
+
+LIBMISDN_OBJS=device.o layer.o stack.o status.o
+
+libmISDN.so: $(LIBMISDN_OBJS)
+ rm -f $@
+ $(CC) -shared -Xlinker -x -o $@ $(LIBMISDN_OBJS)
+
+
+
+libmISDN.a: $(LIBMISDN_OBJS)
rm -f $@
ar -r $@ $^
ar -s $@
@@ -12,9 +23,8 @@
status.o : status.c ../include/mISDNlib.h
clean:
- rm -f *.o *~ DEADJOE
+ rm -f *.o *.so *~ DEADJOE
rm -f libmISDN.a
distclean: clean
rm -f *.a
-
diff -u -r -P /tmp/mISDNuser/Makefile mISDNuser/Makefile
--- /tmp/mISDNuser/Makefile 2004-08-28 14:30:55.000000000 +0200
+++ mISDNuser/Makefile 2005-12-05 19:16:52.000000000 +0100
@@ -1,10 +1,26 @@
+#
+# Set this to your local copy of mISDN
+#
+MISDNDIR := /usr/src/mISDN
+
+#
+# Change this to create an install prefix for the shared libs, programms and
+# includes
+#
+INSTALL_PREFIX := /
+export INSTALL_PREFIX
+
+MISDNINCLUDEDIR := $(MISDNDIR)/include
+export MISDNINCLUDEDIR
+
mISDN_DIR := $(PWD)
export mISDN_DIR
INCLUDEDIR := $(mISDN_DIR)/include
export INCLUDEDIR
-CFLAGS:= -g -Wall -O2 -I $(INCLUDEDIR)
+CFLAGS:= -g -Wall -O2 -I $(INCLUDEDIR) -I $(MISDNINCLUDEDIR)
+CFLAGS+= -D CLOSE_REPORT=1
export CFLAGS
mISDNLIB := $(PWD)/lib/libmISDN.a
@@ -20,9 +36,20 @@
LIBS := lib/libmISDN.a
-all:
+all: test_misdn_includes
make TARGET=$@ subdirs
+
+install_path:
+ mkdir -p $(INSTALL_PREFIX)/usr/bin/
+ mkdir -p $(INSTALL_PREFIX)/usr/lib/mISDNuser/
+ mkdir -p $(INSTALL_PREFIX)/usr/include/mISDNuser/
+
+install: install_path all
+ make TARGET=install subdirs
+ cp include/*.h $(INSTALL_PREFIX)/usr/include/mISDNuser/
+
+
subdirs:
set -e; for i in $(SUBDIRS) ; do $(MAKE) -C $$i $(TARGET); done
@@ -61,3 +88,8 @@
voiparchiv: ARCHIVNAME := $(ARCHIVDIR)/$(MAINDIR)_voip-$(VERSION).tar.bz2
voiparchiv: archiv
+
+test_misdn_includes:
+ @if ! echo "#include <linux/mISDNif.h>" | gcc -I$(MISDNINCLUDEDIR) -C -E - >/tmp/muh ; then echo -e "\n\nYou either don't seem to have installed mISDN properly\nor you haven't set the MISDNDIR variable in this very Makefile.\n\nPlease either install mISDN or set the MISDNDIR properly\n"; exit 1; fi
+
+
diff -u -r -P /tmp/mISDNuser/tenovis/Makefile mISDNuser/tenovis/Makefile
--- /tmp/mISDNuser/tenovis/Makefile 2004-08-28 14:29:27.000000000 +0200
+++ mISDNuser/tenovis/Makefile 2005-12-05 18:51:05.000000000 +0100
@@ -10,6 +10,11 @@
all: sublib $(PROGS)
+install:
+ for i in $(PROGS) ; do \
+ install -m 755 $$i $(INSTALL_PREFIX)/usr/bin ;\
+ done
+
testlib: testlib.o $(TENOVISLIB) $(mISDNLIB)
tstlib: tstlib.o $(TENOVISLIB) $(mISDNLIB)
diff -u -r -P /tmp/mISDNuser/voip/Makefile mISDNuser/voip/Makefile
--- /tmp/mISDNuser/voip/Makefile 2004-08-28 14:29:53.000000000 +0200
+++ mISDNuser/voip/Makefile 2005-12-05 18:50:39.000000000 +0100
@@ -24,6 +24,11 @@
all: $(PROGRAMMS)
+install:
+ for i in $(PROGRAMMS) ; do \
+ install -m 755 $$i $(INSTALL_PREFIX)/usr/bin ;\
+ done
+
INTERNET_PORT = 2074
CARGS = -DInternet_Port=$(INTERNET_PORT)