* 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
1.2-netsec
Christian Richter 20 years ago
parent 5a06af4d57
commit 8b352fcb94

@ -83,6 +83,7 @@ endif
ifneq ($(wildcard misdn/chan_misdn_lib.a),)
CHANNEL_LIBS+=chan_misdn.so
CFLAGS+=-Imisdn
endif
CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
@ -234,11 +235,10 @@ chan_h323.so: chan_h323.o h323/libchanh323.a
endif
chan_misdn.so: chan_misdn.o chan_misdn_config.o misdn/chan_misdn_lib.a
$(CC) -shared -Xlinker -x -o $@ $^ $(MISDNUSER)/i4lnet/libisdnnet.a $(MISDNUSER)/lib/libmISDN.a
chan_misdn_config.o: chan_misdn_config.c
$(CC) $(CFLAGS) -c chan_misdn_config.c
$(CC) -shared -Xlinker -x -L/usr/lib -o $@ $^ -lmISDN -lisdnnet
chan_misdn.o: chan_misdn.c
$(CC) $(CFLAGS) -DCHAN_MISDN_VERSION=\"0.2.1\" -c $< -o $@
#chan_modem.so : chan_modem.o
# $(CC) -rdynamic -shared -Xlinker -x -o $@ $<

@ -1092,13 +1092,12 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
ast_setstate(ast, AST_STATE_DOWN);
return -1;
}
port=newbc->port;
ast_copy_string(newbc->dad, ext, sizeof(newbc->dad));
ast_copy_string(ast->exten, ext, sizeof(ast->exten));
chan_misdn_log(1, 0, "* CALL: %s\n",dest);
chan_misdn_log(1, port, " --> * dad:%s tech:%s ctx:%s\n",ast->exten,ast->name, ast->context);
@ -1131,22 +1130,63 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
strncpy(newbc->oad,callerid, l);
newbc->oad[l-1] = 0;
}
misdn_cfg_get( port, MISDN_CFG_DIALPLAN, &newbc->dnumplan, sizeof(int));
switch (newbc->dnumplan) {
case NUMPLAN_INTERNATIONAL:
case NUMPLAN_NATIONAL:
case NUMPLAN_SUBSCRIBER:
case NUMPLAN_UNKNOWN:
/* Maybe we should cut off the prefix if present ? */
}
misdn_cfg_get( port, MISDN_CFG_DIALPLAN, &newbc->dnumplan, sizeof(int));
switch (newbc->dnumplan) {
case NUMPLAN_INTERNATIONAL:
chan_misdn_log(2, port, " --> TON: International\n");
break;
case NUMPLAN_NATIONAL:
chan_misdn_log(2, port, " --> TON: National\n");
break;
case NUMPLAN_SUBSCRIBER:
chan_misdn_log(2, port, " --> TON: Subscriber\n");
break;
case NUMPLAN_UNKNOWN:
chan_misdn_log(2, port, " --> TON: Unknown\n");
break;
/* Maybe we should cut off the prefix if present ? */
default:
chan_misdn_log(0, port, " --> !!!! Wrong dialplan setting, please see the misdn.conf sample file\n ");
break;
default:
}
misdn_cfg_get( port, MISDN_CFG_LOCALDIALPLAN, &newbc->onumplan, sizeof(int));
switch (newbc->onumplan) {
case NUMPLAN_INTERNATIONAL:
chan_misdn_log(2, port, " --> TON: International\n");
break;
case NUMPLAN_NATIONAL:
chan_misdn_log(2, port, " --> TON: National\n");
break;
case NUMPLAN_SUBSCRIBER:
chan_misdn_log(2, port, " --> TON: Subscriber\n");
break;
case NUMPLAN_UNKNOWN:
chan_misdn_log(2, port, " --> TON: Unknown\n");
break;
/* Maybe we should cut off the prefix if present ? */
default:
chan_misdn_log(0, port, " --> !!!! Wrong dialplan setting, please see the misdn.conf sample file\n ");
break;
}
}
}
{
int eb3;
misdn_cfg_get( port, MISDN_CFG_EARLY_BCONNECT, &eb3, sizeof(int));
newbc->early_bconnect=eb3;
}
/* Will be overridden by asterisk in head! */
{
@ -1160,38 +1200,48 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
int def_callingpres;
misdn_cfg_get( port, MISDN_CFG_USE_CALLINGPRES, &def_callingpres, sizeof(int));
if ( def_callingpres) {
switch (ast->cid.cid_pres & 0x60){
case AST_PRES_RESTRICTED:
chan_misdn_log(2, port, " --> PRES: Restricted (0x1)\n");
newbc->pres=1;
break;
case AST_PRES_UNAVAILABLE:
chan_misdn_log(2, port, " --> PRES: Unavailable (0x2)\n");
newbc->pres=2;
break;
default:
chan_misdn_log(2, port, " --> PRES: Allowed (0x0)\n");
newbc->pres=0;
}
switch (ast->cid.cid_pres & 0x3){
case AST_PRES_USER_NUMBER_UNSCREENED:
chan_misdn_log(2, port, " --> SCREEN: Unscreened (0x0)\n");
newbc->screen=0;
break;
case AST_PRES_USER_NUMBER_PASSED_SCREEN:
chan_misdn_log(2, port, " --> SCREEN: Passed Screen (0x1)\n");
newbc->screen=1;
break;
case AST_PRES_USER_NUMBER_FAILED_SCREEN:
chan_misdn_log(2, port, " --> SCREEN: Failed Screen (0x2)\n");
newbc->screen=2;
break;
case AST_PRES_NETWORK_NUMBER:
chan_misdn_log(2, port, " --> SCREEN: Network Nr. (0x3)\n");
newbc->screen=3;
break;
default:
chan_misdn_log(2, port, " --> SCREEN: Unscreened (0x0)\n");
newbc->screen=0;
}
}
@ -1210,9 +1260,11 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
newbc->ec_deftaps=ec;
}
if ( !ectr ) {
newbc->ec_training=0;
if (ectr>=0) {
newbc->ec_training=ectr;
}
}
}
@ -1533,9 +1585,8 @@ int misdn_hangup(struct ast_channel *ast)
struct chan_list *p;
struct misdn_bchannel *bc=NULL;
if (!ast || ! MISDN_ASTERISK_PVT(ast)) return -1;
p = MISDN_ASTERISK_TECH_PVT(ast) ;
if (!ast || ! (p=MISDN_ASTERISK_TECH_PVT(ast) ) ) return -1;
release_lock;
chan_misdn_trace_call(ast,1,"*->I: EVENT_HANGUP cause=%d\n",ast->hangupcause);
@ -1666,8 +1717,7 @@ struct ast_frame *misdn_read(struct ast_channel *ast)
int len =0 ;
if (!ast) return NULL;
tmp = MISDN_ASTERISK_TECH_PVT(ast);
if (!tmp) return NULL;
if (! (tmp=MISDN_ASTERISK_TECH_PVT(ast)) ) return NULL;
if (!tmp->bc) return NULL;
@ -1699,8 +1749,7 @@ int misdn_write(struct ast_channel *ast, struct ast_frame *frame)
struct chan_list *p;
int i = 0;
if (!ast || ! MISDN_ASTERISK_PVT(ast)) return -1;
p = MISDN_ASTERISK_TECH_PVT(ast) ;
if (!ast || ! (p=MISDN_ASTERISK_TECH_PVT(ast)) ) return -1;
if (!p->bc ) {
ast_log(LOG_WARNING, "private but no bc\n");
@ -2099,15 +2148,18 @@ struct ast_channel *misdn_new(struct chan_list *chlist, int state, char * name,
tmp->priority=1;
if (context)
if (context) {
ast_copy_string(tmp->context, context, sizeof(tmp->context));
else
} else {
chan_misdn_log(1,0,"misdn_new: no context given.\n");
if (exten)
ast_copy_string(tmp->exten, exten, sizeof(tmp->exten));
else
}
if (exten) {
ast_copy_string(tmp->exten, exten, sizeof(tmp->exten));
} else {
chan_misdn_log(1,0,"misdn_new: no exten given.\n");
}
if (callerid) {
char *cid_name, *cid_num;
@ -2863,32 +2915,25 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
/** queue new chan **/
cl_queue_chan(&cl_te, ch) ;
/*
added support for s extension hope it will help those poor cretains
which haven't overlap dial.
*/
{
misdn_cfg_get( bc->port, MISDN_CFG_LANGUAGE, chan->language, sizeof(chan->language));
int ai;
misdn_cfg_get( bc->port, MISDN_CFG_ALWAYS_IMMEDIATE, &ai, sizeof(ai));
if ( ai ) {
do_immediate_setup(bc, ch , chan);
break;
}
misdn_cfg_get( bc->port, MISDN_CFG_LANGUAGE, chan->language, sizeof(chan->language));
}
int immediate;
misdn_cfg_get( bc->port, MISDN_CFG_IMMEDIATE, &immediate, sizeof(int));
{
int eb3;
if (ast_strlen_zero(bc->orig_dad) && immediate ) {
do_immediate_setup(bc, ch , chan);
break;
}
misdn_cfg_get( bc->port, MISDN_CFG_EARLY_BCONNECT, &eb3, sizeof(int));
bc->early_bconnect=eb3;
}
{
int ec, ectr;
@ -2902,8 +2947,8 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
bc->ec_deftaps=ec;
}
if ( !ectr ) {
bc->ec_training=0;
if ( ectr>=0 ) {
bc->ec_training=ectr;
}
}
@ -2913,6 +2958,29 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
snprintf(buf,16,"%d",bc->urate);
pbx_builtin_setvar_helper(chan,"MISDN_URATE",buf);
}
/**
from here on we start the PBX, so no configuration should
be considered anymore
**/
int ai;
misdn_cfg_get( bc->port, MISDN_CFG_ALWAYS_IMMEDIATE, &ai, sizeof(ai));
if ( ai ) {
do_immediate_setup(bc, ch , chan);
break;
}
int immediate;
misdn_cfg_get( bc->port, MISDN_CFG_IMMEDIATE, &immediate, sizeof(int));
if (ast_strlen_zero(bc->orig_dad) && immediate ) {
do_immediate_setup(bc, ch , chan);
break;
}
/* Check for Pickup Request first */
if (!strcmp(chan->exten, ast_pickup_ext())) {
@ -3210,8 +3278,6 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
struct ast_channel *hold_ast=AST_BRIDGED_P(ch->ast);
ch->state = MISDN_CONNECTED;
//ast_moh_stop(ch->ast);
//start_bc_tones(ch);
if (hold_ast) {
ast_moh_stop(hold_ast);
}
@ -3384,8 +3450,8 @@ int load_module(void)
int unload_module(void)
{
/* First, take us out of the channel loop */
chan_misdn_log(0, 0, "-- Unregistering mISDN Channel Driver --\n");
ast_log(LOG_VERBOSE, "-- Unregistering mISDN Channel Driver --\n");
if (!g_config_initialized) return 0;
ast_cli_unregister(&cli_send_display);

@ -29,6 +29,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "chan_misdn_config.h"
@ -59,7 +60,8 @@ struct port_config {
char *language;
char *callerid;
char *method;
int *dialplan;
int *dialplan;
int *localdialplan;
char *nationalprefix;
char *internationalprefix;
int *pres;
@ -151,6 +153,7 @@ static void free_port_cfg (void) {
FREE_ELEM(callerid);
FREE_ELEM(method);
FREE_ELEM(dialplan);
FREE_ELEM(localdialplan);
FREE_ELEM(nationalprefix);
FREE_ELEM(internationalprefix);
FREE_ELEM(pres);
@ -277,6 +280,8 @@ void misdn_cfg_get(int port, enum misdn_cfg_elements elem, void *buf, int bufsiz
break;
case MISDN_CFG_DIALPLAN: GET_PORTCFG_MEMCPY(dialplan);
break;
case MISDN_CFG_LOCALDIALPLAN: GET_PORTCFG_MEMCPY(localdialplan);
break;
case MISDN_CFG_NATPREFIX: GET_PORTCFG_STRCPY(nationalprefix);
break;
case MISDN_CFG_INTERNATPREFIX:
@ -534,6 +539,8 @@ void misdn_cfg_get_config_string(int port, enum misdn_cfg_elements elem, char* b
break;
case MISDN_CFG_DIALPLAN: GET_CFG_INT(DIALPLAN, dialplan);
break;
case MISDN_CFG_LOCALDIALPLAN: GET_CFG_INT(LOCALDIALPLAN, localdialplan);
break;
case MISDN_CFG_NATPREFIX: GET_CFG_STRING(NATIONALPREFIX, nationalprefix);
break;
case MISDN_CFG_INTERNATPREFIX:
@ -812,6 +819,7 @@ static void build_port_config(struct ast_variable *v, char *cat) {
}
PARSE_CFG_STR(context);
PARSE_CFG_INT(dialplan);
PARSE_CFG_INT(localdialplan);
PARSE_CFG_STR(nationalprefix);
PARSE_CFG_STR(internationalprefix);
PARSE_CFG_STR(language);
@ -963,6 +971,8 @@ static void fill_defaults (void) {
}
if (!port_cfg[0]->dialplan)
port_cfg[0]->dialplan = (int *)calloc(1, sizeof(int));
if (!port_cfg[0]->localdialplan)
port_cfg[0]->localdialplan = (int *)calloc(1, sizeof(int));
if (!port_cfg[0]->nationalprefix) {
port_cfg[0]->nationalprefix = (char *)malloc(2 * sizeof(char));
sprintf(port_cfg[0]->nationalprefix, "0");

@ -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)
FORCE:
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

@ -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) */

@ -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

@ -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);

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

@ -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>

@ -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->law) {
case INFO_CODEC_ULAW: user=2;
break;
case INFO_CODEC_ALAW: user=3;
break;
default:
user=3;
}
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");
user=-1;
break;
case INFO_CAPABILITY_DIGITAL_RESTRICTED: capability = 9;
// cb_log(2, bc->stack->port, " --> cap res Digital\n");
user=-1;
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;
}
enc_ie_bearer(&setup->BEARER, msg, coding, capability, mode, rate, -1, user, nt,bc);
}

File diff suppressed because it is too large Load Diff

@ -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)

@ -26,8 +26,7 @@ Features:
Supported Hardware:
-------------------
chan_misdn supports any mISDN compatible Hardware. Especially the 1-8 Port
BRI Cards available from http://shop.beronet.com
chan_misdn supports any mISDN compatible Hardware.
Overview
--------
@ -49,48 +48,29 @@ Overview
Fast Installation Guide
-----------------------
You have two options on how to install chan_misdn.
(1) Requirements:
- mISDN and mISDNuser from jolly (see Pre-Requisites below)
Installation:
- cd <asterisk-src-dir>/channels/misdn
- edit Makefile so that MISDNUSER points to your mISDNuser directory
- run 'make'
- cd <asterisk-src-dir>
- compile and install asterisk via 'make install'
(2) Requirements:
- Asterisk headers and Kernel headers
Description:
The Makefile gets the newest mISDN and mISDNuser Sources from
jollys webpage and the newest release of chan_misdn from beronets
Servers. After that it compiles and installs everything (hopefully).
Installation:
- cd /usr/src
- wget http://www.beronet.com/downloads/install-misdn.tar.gz
- tar zxf install-misdn.tar.gz
- cd install-misdn
- make install
It is easy to install mISDN and mISDNuser. Using the Makefile from
channels/misdn. You just need to type:
cd channels/misdn
make misdn
Then all the necessary files are fetched from jollys homepage and are patched
with the Echocanellor.
Pre-Requisites
--------------
To compile and install this driver, you'll need at least one mISDN Driver, the
mISDNuser package and the Asterisk includes (which will be inside of the
sources). Chan_misdn works with both, the current release version and the
development (svn trunk) version of Asterisk.
To compile and install this driver, you'll need at least one mISDN Driver and
the mISDNuser package. Chan_misdn works with both, the current release version
and the development (svn trunk) version of Asterisk. mISDNuser and mISDN must
be fetched from jollys homepage and must be patched with the Echocancellor.
To get the mISDN stuff please follow the instructions at
http://www.isdn4linux.de. Please Note that mISDN works good for the
linux-2.6.x kernels. Some of the mISDN drivers do not compile against the
2.4.x or older kernels, you can patch them, but than you'll get mysterious
errors.
Please Note that mISDN works good for the linux-2.6.x kernels. Some of the
mISDN drivers do not compile against the 2.4.x or older kernels, you can patch
them, but than you'll get mysterious errors.
I use Kernels > 2.6.9 and it works perfect. with kernels >= 2.6.10 there is a
very litle bug in hfc_multi.c which causes the module not to compile, it can
be easily fixed by changing pci_findsubsys to pci_getsubsys in code.
Using Kernels > 2.6.9 works perfect.
Ok so far so good, now follow the compilation instructions.
@ -99,46 +79,26 @@ Ok so far so good, now follow the compilation instructions.
Compilation
-----------
!! Be aware, in the actual mISDNuser package theres a bug in the Makefile
!! the compilation stops near iapplication.h, this isn't very important
!! at this step you are ready.
After you've successfully installed mISDN, mISDNuser and Asterisk, you should
modify the Makefile in the chan_misdn source path. There you can tell the
Makefile where to install the driver, sample-conf, and most important where it
can find the linux kernel includes, the mISDNuser package and the Asterisk
includes. If you use the development version of Asterisk (or at least a newer
version than release) uncomment the CCFLAGS+=-DASTERISK_STABLE, the release
version of Asterisk is at the moment v1-2 as subversion branch.
The compilation of chan_misdn requires a library which will be generated under
channels/misdn/.
Now you can type in:
To compile this library you just need to go into this directory and type
make. Now you can go back to the asterisk source root and type make install
again, which now should compile and install chan_misdn.
make
This should compile chan_misdn.so, if there's an error check the paths in the
Makefile again.
Installation
------------
After successful compilation of chan_misdn, you should simply type in:
make install
as privileged user to put chan_misdn.so in the Asterisk modules
directory.
Chan_misdn is automatically installed by the asterisk installation process.
You should see a message like: "Successfully installed chan_misdn".
Congratulations.
Theres a sample init.d script for loading the mISDN modules (mISDN.sample),
simply copy it to /etc/init.d/ and modify it, there you can enter your cards.
There is a sample init.d script for loading the mISDN modules (mISDN.sample),
5Asimply copy it to /etc/init.d/ and modify it, there you can enter your cards.
!! Forget to use capi together with chan_misdn.
Configuration
-------------
@ -162,6 +122,11 @@ configuration file, bigger numbers will lead to more debug output. There's also
tracefile option, which takes a path+filename where debug output is written
to.
- misdn.conf: [default] section
The default section is another special section which can contain all the
options available int the usr/port sections. the user/port section inherit
their parameters from the default section.
- misdn.conf: user/port sections
The user sections have names which are unequal to "general". Those sections
contain the ports variable which mean the mISDN Ports. Here you can add
@ -205,8 +170,8 @@ The available Optchars are:
vt - txgain control
chan_misdn registers a new dial plan application "misdn_set_opt" when loaded. This
application takes the Optionsstring as argument. The Syntax is:
chan_misdn registers a new dial plan application "misdn_set_opt" when
loaded. This application takes the Optionsstring as argument. The Syntax is:
misdn_set_opt(<OPTIONSSTRING>)
@ -343,6 +308,11 @@ it, you can just change pci_find_subsys to pci_get_subsys, this works.
* asterisk >= v1-0.2 , also CVS Head
* mISDN/mISDNuser (3.0-beta) from isdn.jolly.de
- chan_misdn-0.2.1
* linux-kernel >= 2.6.8 (but at least 2.6)
* asterisk >= v1.2 , also CVS Head
* mISDN/mISDNuser (3.0) from isdn.jolly.de
Known Problems
--------------

Loading…
Cancel
Save