[asterisk-commits] nadi: branch 1.2 r59199 - in /branches/1.2/channels: ./ misdn/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Mar 26 03:21:57 MST 2007


Author: nadi
Date: Mon Mar 26 05:21:56 2007
New Revision: 59199

URL: http://svn.digium.com/view/asterisk?view=rev&rev=59199
Log:
mISDN >= 1.2 provides a dsp pipeline for i.e. echo cancellation modules, make chan_misdn use it.

Modified:
    branches/1.2/channels/Makefile
    branches/1.2/channels/chan_misdn.c
    branches/1.2/channels/misdn/Makefile
    branches/1.2/channels/misdn/chan_misdn_config.h
    branches/1.2/channels/misdn/isdn_lib.c
    branches/1.2/channels/misdn/isdn_lib.h
    branches/1.2/channels/misdn_config.c

Modified: branches/1.2/channels/Makefile
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/Makefile?view=diff&rev=59199&r1=59198&r2=59199
==============================================================================
--- branches/1.2/channels/Makefile (original)
+++ branches/1.2/channels/Makefile Mon Mar 26 05:21:56 2007
@@ -86,6 +86,10 @@
 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/mISDNuser/mISDNlib.h),)
   CHANNEL_LIBS+=chan_misdn.so
   CFLAGS+=-Imisdn  
+endif
+
+ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/linux/mISDNdsp.h),)
+  CFLAGS+=-DMISDN_1_2
 endif
 
 CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
@@ -238,7 +242,7 @@
 endif
 
 misdn/chan_misdn_lib.a:
-	make -C misdn
+	make CROSS_COMPILE_TARGET=$(CROSS_COMPILE_TARGET) -C misdn
 
 chan_misdn.so: chan_misdn.o misdn_config.o misdn/chan_misdn_lib.a 
 	$(CC) -shared -Xlinker -x -L/usr/lib -o $@ $^ -lisdnnet -lmISDN 

Modified: branches/1.2/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_misdn.c?view=diff&rev=59199&r1=59198&r2=59199
==============================================================================
--- branches/1.2/channels/chan_misdn.c (original)
+++ branches/1.2/channels/chan_misdn.c Mon Mar 26 05:21:56 2007
@@ -283,9 +283,6 @@
 
 static int usecnt=0;
 
-static char **misdn_key_vector=NULL;
-static int misdn_key_vector_size=0;
-
 /* Only alaw and mulaw is allowed for now */
 static int prefformat =  AST_FORMAT_ALAW ; /*  AST_FORMAT_SLINEAR ;  AST_FORMAT_ULAW | */
 
@@ -325,7 +322,11 @@
 
 int chan_misdn_jb_empty(struct misdn_bchannel *bc, char *buf, int len);
 
+#ifdef MISDN_1_2
+static int update_pipeline_config(struct misdn_bchannel *bc);
+#else
 static int update_ec_config(struct misdn_bchannel *bc);
+#endif
 
 /*************** Helpers *****************/
 
@@ -773,7 +774,11 @@
 			"  --> activated: %d\n"
 			"  --> state: %s\n"
 			"  --> capability: %s\n"
+#ifdef MISDN_1_2
+			"  --> pipeline: %s\n"
+#else
 			"  --> echo_cancel: %d\n"
+#endif
 			"  --> notone : rx %d tx:%d\n"
 			"  --> bc_hold: %d\n",
 			help->ast->name,
@@ -786,7 +791,11 @@
 			bc->active,
 			bc_state2str(bc->bc_state),
 			bearer2str(bc->capability),
+#ifdef MISDN_1_2
+			bc->pipeline,
+#else
 			bc->ec_enable,
+#endif
 
 			help->norxtone,help->notxtone,
 			bc->holded
@@ -1005,7 +1014,11 @@
 			tmp->toggle_ec=tmp->toggle_ec?0:1;
 
 			if (tmp->toggle_ec) {
+#ifdef MISDN_1_2
+				update_pipeline_config(tmp->bc);
+#else
 				update_ec_config(tmp->bc);
+#endif
 				manager_ec_enable(tmp->bc);
 			} else {
 				manager_ec_disable(tmp->bc);
@@ -1404,9 +1417,25 @@
 	}
 }
 
-
-
-
+#ifdef MISDN_1_2
+static int update_pipeline_config(struct misdn_bchannel *bc)
+{
+	int ec;
+
+	misdn_cfg_get(bc->port, MISDN_CFG_PIPELINE, bc->pipeline, sizeof(bc->pipeline));
+
+	if (*bc->pipeline)
+		return 0;
+
+	misdn_cfg_get(bc->port, MISDN_CFG_ECHOCANCEL, &ec, sizeof(int));
+	if (ec == 1)
+		snprintf(bc->pipeline, sizeof(bc->pipeline) - 1, "mg2ec");
+	else if (ec > 1)
+		snprintf(bc->pipeline, sizeof(bc->pipeline) - 1, "mg2ec(deftaps=%d)", ec);
+
+	return 0;
+}
+#else
 static int update_ec_config(struct misdn_bchannel *bc)
 {
 	int ec;
@@ -1423,7 +1452,7 @@
 
 	return 0;
 }
-
+#endif
 
 static int read_config(struct chan_list *ch, int orig) {
 
@@ -1493,7 +1522,11 @@
 	
 	ast_copy_string (ast->context,ch->context,sizeof(ast->context));	
 
+#ifdef MISDN_1_2
+	update_pipeline_config(bc);
+#else
 	update_ec_config(bc);
+#endif
 
 	{
 		int eb3;
@@ -1721,9 +1754,15 @@
 		int bridging;
 		misdn_cfg_get( 0, MISDN_GEN_BRIDGING, &bridging, sizeof(int));
 		if (bridging && ch->other_ch) {
-			chan_misdn_log(0, port, "Disabling EC on both Sides\n");	
+#ifdef MISDN_1_2
+			chan_misdn_log(0, port, "Disabling EC (aka Pipeline) on both Sides\n");
+			*ch->bc->pipeline=0;
+			*ch->other_ch->bc->pipeline=0;
+#else
+			chan_misdn_log(0, port, "Disabling EC on both Sides\n");
 			ch->bc->ec_enable=0;
 			ch->other_ch->bc->ec_enable=0;
+#endif
 		}
 		
 		r=misdn_lib_send_event( newbc, EVENT_SETUP );
@@ -4563,15 +4602,22 @@
 			
 			if (neglect) {
 				chan_misdn_log(1, ch->bc->port, " --> disabled\n");
+#ifdef MISDN_1_2
+				*ch->bc->pipeline=0;
+#else
 				ch->bc->ec_enable=0;
-
+#endif
 			} else {
+#ifdef MISDN_1_2
+				update_pipeline_config(ch->bc);
+#else
 				ch->bc->ec_enable=1;
 				ch->bc->orig=ch->orginator;
 				tok++;
-				if (tok) {
+				if (*tok) {
 					ch->bc->ec_deftaps=atoi(tok);
 				}
+#endif
 			}
 			
 			break;

Modified: branches/1.2/channels/misdn/Makefile
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/misdn/Makefile?view=diff&rev=59199&r1=59198&r2=59199
==============================================================================
--- branches/1.2/channels/misdn/Makefile (original)
+++ branches/1.2/channels/misdn/Makefile Mon Mar 26 05:21:56 2007
@@ -8,6 +8,9 @@
 CFLAGS		= -pipe -c -Wall -ggdb
 ifeq ($(shell uname -m),x86_64)
 CFLAGS         += -fPIC
+endif
+ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/linux/mISDNdsp.h),)
+CFLAGS+=-DMISDN_1_2
 endif
 SOURCES		= isdn_lib.c isdn_msg_parser.c 
 OBJDIR		= .

Modified: branches/1.2/channels/misdn/chan_misdn_config.h
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/misdn/chan_misdn_config.h?view=diff&rev=59199&r1=59198&r2=59199
==============================================================================
--- branches/1.2/channels/misdn/chan_misdn_config.h (original)
+++ branches/1.2/channels/misdn/chan_misdn_config.h Mon Mar 26 05:21:56 2007
@@ -52,7 +52,9 @@
 	MISDN_CFG_EARLY_BCONNECT,      /* int (bool) */
 	MISDN_CFG_INCOMING_EARLY_AUDIO,      /* int (bool) */
 	MISDN_CFG_ECHOCANCEL,          /* int */
-	MISDN_CFG_ECHOCANCELWHENBRIDGED,  /* int (bool) */
+#ifdef MISDN_1_2
+	MISDN_CFG_PIPELINE,            /* char[] */
+#endif
 	MISDN_CFG_NEED_MORE_INFOS,     /* bool */
 	MISDN_CFG_NTTIMEOUT,     /* bool */
 	MISDN_CFG_JITTERBUFFER,              /* int */

Modified: branches/1.2/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/misdn/isdn_lib.c?view=diff&rev=59199&r1=59198&r2=59199
==============================================================================
--- branches/1.2/channels/misdn/isdn_lib.c (original)
+++ branches/1.2/channels/misdn/isdn_lib.c Mon Mar 26 05:21:56 2007
@@ -573,13 +573,16 @@
 	bc->active = 0;
 
 	bc->early_bconnect = 1;
-	
+
+#ifdef MISDN_1_2
+	*bc->pipeline = 0;
+#else
 	bc->ec_enable = 0;
 	bc->ec_deftaps = 128;
-	bc->ec_whenbridged = 0;
 
 #ifdef EC_TRAIN
 	bc->ec_training = 1;
+#endif
 #endif
 	
 	bc->orig=0;
@@ -4240,16 +4243,21 @@
 
 void manager_ec_enable(struct misdn_bchannel *bc)
 {
-	int ec_arr[2];
-
 	struct misdn_stack *stack=get_stack_by_bc(bc);
 	
 	cb_log(4, stack?stack->port:0,"ec_enable\n");
 
 	if (!misdn_cap_is_speech(bc->capability)) {
 		cb_log(1, stack?stack->port:0, " --> no speech? cannot enable EC\n");
-		return;
-	}
+	} else {
+
+#ifdef MISDN_1_2
+	if (*bc->pipeline) {
+		cb_log(3, stack?stack->port:0,"Sending Control PIPELINE_CFG %s\n",bc->pipeline);
+		manager_ph_control_block(bc, PIPELINE_CFG, bc->pipeline, strlen(bc->pipeline) + 1);
+	}
+#else
+	int ec_arr[2];
 
 	if (bc->ec_enable) {
 		cb_log(3, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d training:%d\n",bc->ec_deftaps, bc->ec_training);
@@ -4276,6 +4284,8 @@
 		
 		manager_ph_control_block(bc,  ECHOCAN_ON,  ec_arr, sizeof(ec_arr));
 	}
+#endif
+	}
 }
 
 
@@ -4291,10 +4301,14 @@
 		return;
 	}
 
+#ifdef MISDN_1_2
+	manager_ph_control_block(bc, PIPELINE_CFG, "", 0);
+#else
 	if ( ! bc->ec_enable) {
 		cb_log(3, stack?stack->port:0, "Sending Control ECHOCAN_OFF\n");
 		manager_ph_control(bc,  ECHOCAN_OFF, 0);
 	}
+#endif
 }
 
 struct misdn_stack* get_misdn_stack() {

Modified: branches/1.2/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/misdn/isdn_lib.h?view=diff&rev=59199&r1=59198&r2=59199
==============================================================================
--- branches/1.2/channels/misdn/isdn_lib.h (original)
+++ branches/1.2/channels/misdn/isdn_lib.h Mon Mar 26 05:21:56 2007
@@ -354,10 +354,13 @@
   
 	/** list stuf **/
 
+#ifdef MISDN_1_2
+	char pipeline[128];
+#else
 	int ec_enable;
 	int ec_deftaps;
-	int ec_whenbridged;
 	int ec_training;
+#endif
 
 #ifdef WITH_BEROEC
 	beroec_t *ec;

Modified: branches/1.2/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/misdn_config.c?view=diff&rev=59199&r1=59198&r2=59199
==============================================================================
--- branches/1.2/channels/misdn_config.c (original)
+++ branches/1.2/channels/misdn_config.c Mon Mar 26 05:21:56 2007
@@ -113,6 +113,9 @@
 	{ "early_bconnect", MISDN_CFG_EARLY_BCONNECT, MISDN_CTYPE_BOOL, "yes", NONE },
 	{ "incoming_early_audio", MISDN_CFG_INCOMING_EARLY_AUDIO, MISDN_CTYPE_BOOL, "no", NONE },
 	{ "echocancel", MISDN_CFG_ECHOCANCEL, MISDN_CTYPE_BOOLINT, "0", 128 },
+#ifdef MISDN_1_2
+	{ "pipeline", MISDN_CFG_PIPELINE, MISDN_CTYPE_STR, NO_DEFAULT, NONE },
+#endif
 	{ "need_more_infos", MISDN_CFG_NEED_MORE_INFOS, MISDN_CTYPE_BOOL, "0", NONE },
 	{ "nttimeout", MISDN_CFG_NTTIMEOUT, MISDN_CTYPE_BOOL, "no", NONE },
 	{ "jitterbuffer", MISDN_CFG_JITTERBUFFER, MISDN_CTYPE_INT, "4000", NONE },



More information about the asterisk-commits mailing list