[svn-commits] branch crichter/0.3.0 r36289 - in /team/crichter/0.3.0: channels/ channels/mi...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Jun 29 04:44:52 MST 2006


Author: crichter
Date: Thu Jun 29 06:44:52 2006
New Revision: 36289

URL: http://svn.digium.com/view/asterisk?rev=36289&view=rev
Log:
added better L2 handling for ptp, if it's down we don't try to call on that port in groupdial anymore, also we try to get it up then. Additionally added the configoptions  ntdebugflags and ntdebugfile to debug the mISDNuser NT Stack (should have done that ages before..).

Modified:
    team/crichter/0.3.0/channels/chan_misdn.c
    team/crichter/0.3.0/channels/misdn/chan_misdn_config.h
    team/crichter/0.3.0/channels/misdn/isdn_lib.c
    team/crichter/0.3.0/channels/misdn/isdn_lib.h
    team/crichter/0.3.0/channels/misdn/isdn_lib_intern.h
    team/crichter/0.3.0/channels/misdn_config.c
    team/crichter/0.3.0/configs/misdn.conf.sample

Modified: team/crichter/0.3.0/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/chan_misdn.c?rev=36289&r1=36288&r2=36289&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/chan_misdn.c (original)
+++ team/crichter/0.3.0/channels/chan_misdn.c Thu Jun 29 06:44:52 2006
@@ -678,6 +678,14 @@
 		misdn_debug[i] = cfg_debug;
 		misdn_debug_only[i] = 0;
 	}
+
+	int ntflags=0;
+	char ntfile[BUFFERSIZE+1];
+
+	misdn_cfg_get( 0, MISDN_GEN_NTDEBUGFLAGS, &ntflags, sizeof(int));
+	misdn_cfg_get( 0, MISDN_GEN_NTDEBUGFILE, &ntfile, BUFFERSIZE);
+
+	misdn_lib_nt_debug_init(ntflags,ntfile);
 }
 
 static int misdn_reload (int fd, int argc, char *argv[])
@@ -4008,6 +4016,8 @@
 
 
 	misdn_cfg_get( 0, MISDN_GEN_TRACEFILE, global_tracefile, BUFFERSIZE);
+
+	reload_config();
 	
 	chan_misdn_log(0, 0, "-- mISDN Channel Driver Registred -- (BE AWARE THIS DRIVER IS EXPERIMENTAL!)\n");
 

Modified: team/crichter/0.3.0/channels/misdn/chan_misdn_config.h
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/chan_misdn_config.h?rev=36289&r1=36288&r2=36289&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/chan_misdn_config.h (original)
+++ team/crichter/0.3.0/channels/misdn/chan_misdn_config.h Thu Jun 29 06:44:52 2006
@@ -71,6 +71,8 @@
 	MISDN_GEN_DYNAMIC_CRYPT,       /* int (bool) */
 	MISDN_GEN_CRYPT_PREFIX,        /* char[] */
 	MISDN_GEN_CRYPT_KEYS,          /* char[] */
+	MISDN_GEN_NTDEBUGFLAGS,          /* int */
+	MISDN_GEN_NTDEBUGFILE,          /* char[] */
 	MISDN_GEN_LAST
 };
 

Modified: team/crichter/0.3.0/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/isdn_lib.c?rev=36289&r1=36288&r2=36289&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_lib.c (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_lib.c Thu Jun 29 06:44:52 2006
@@ -20,6 +20,7 @@
 
 int queue_cleanup_bc(struct misdn_bchannel *bc) ;
 
+int misdn_lib_get_l2_up(struct misdn_stack *stack);
 
 struct misdn_stack* get_misdn_stack( void );
 
@@ -1638,12 +1639,21 @@
 		if ( !stack->ptp && !check) return 1;
 		
 		if (stack->port == port) {
-			if (stack->l1link)
-				return 1;
-			else {
-				cb_log(-1,port, "Port down [%s]\n",
-				       stack->ptp?"PP":"PMP");
-				return 0;
+			if (stack->ptp ) {
+				if (stack->l1link && stack->l2link) {
+					return 1;
+				} else {
+					cb_log(-1,port, "Port Down L2:%d L1:%d\n",
+						stack->l2link, stack->l1link);
+					return 0;
+				}
+			} else {
+				if ( stack->l1link)
+					return 1;
+				else {
+					cb_log(-1,port, "Port down PMP\n");
+					return 0;
+				}
 			}
 		}
 	}
@@ -1890,6 +1900,7 @@
 		{
 			cb_log(4, stack->port, "%% GOT L2 Activate Info.\n");
 			stack->l2link = 1;
+			stack->l2upcnt=0;
 			
 			free_msg(msg);
 			return 0;
@@ -1900,9 +1911,19 @@
 		case DL_RELEASE | INDICATION:
 		case DL_RELEASE | CONFIRM:
 		{
-			cb_log(4, stack->port, "%% GOT L2 DeActivate Info.\n");
+			if (stack->ptp) {
+				cb_log(-1 , stack->port, "%% GOT L2 DeActivate Info.\n");
+				if (stack->l2upcnt>3) {
+					cb_log(-1 , stack->port, "!!! Could not Get the L2 up after 3 Attemps!!!\n");
+				}  else {
+					misdn_lib_get_l2_up(stack);
+					stack->l2upcnt++;
+				}
+				
+			} else 
+				cb_log(4, stack->port, "%% GOT L2 DeActivate Info.\n");
+			
 			stack->l2link = 0;
-			
 			free_msg(msg);
 			return 0;
 		}
@@ -3578,6 +3599,21 @@
 	return max;
 }
 
+
+void misdn_lib_nt_debug_init( int flags, char *file ) 
+{
+	int static init=0;
+
+	if (!init) {
+		debug_init( flags , file, file, file);
+		init=1;
+	} else {
+		debug_close();
+		debug_init( flags , file, file, file);
+	}
+}
+
+
 int misdn_lib_init(char *portlist, struct misdn_lib_iface *iface, void *user_data)
 {
 	struct misdn_lib *mgr=calloc(1, sizeof(struct misdn_lib));
@@ -3593,13 +3629,9 @@
 	glob_mgr = mgr;
   
 	msg_init();
-#if 0
-	int flags=0xff;
-	flags &= ~DBGM_MSG;
-	debug_init( flags , NULL, NULL, NULL);
-#else
-	debug_init(0 , NULL, NULL, NULL);
-#endif	
+
+	misdn_lib_nt_debug_init(0,NULL);
+	
 	if (!portlist || (*portlist == 0) ) return 1;
 	
 	init_flip_bits();

Modified: team/crichter/0.3.0/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/isdn_lib.h?rev=36289&r1=36288&r2=36289&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_lib.h (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_lib.h Thu Jun 29 06:44:52 2006
@@ -344,6 +344,8 @@
 
 /***** USER IFACE **********/
 
+void misdn_lib_nt_debug_init( int flags, char *file );
+
 int misdn_lib_init(char *portlist, struct misdn_lib_iface* iface, void *user_data);
 int misdn_lib_send_event(struct misdn_bchannel *bc, enum event_e event );
 void misdn_lib_destroy(void);

Modified: team/crichter/0.3.0/channels/misdn/isdn_lib_intern.h
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/isdn_lib_intern.h?rev=36289&r1=36288&r2=36289&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_lib_intern.h (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_lib_intern.h Thu Jun 29 06:44:52 2006
@@ -55,6 +55,8 @@
   
 	int ptp;
 
+	int l2upcnt;
+
 	int l2_id;
 	int lower_id;
 	int upper_id;

Modified: team/crichter/0.3.0/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn_config.c?rev=36289&r1=36288&r2=36289&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn_config.c (original)
+++ team/crichter/0.3.0/channels/misdn_config.c Thu Jun 29 06:44:52 2006
@@ -129,7 +129,9 @@
 	{ "append_digits2exten", MISDN_GEN_APPEND_DIGITS2EXTEN, MISDN_CTYPE_BOOL, "yes", NONE },
 	{ "dynamic_crypt", MISDN_GEN_DYNAMIC_CRYPT, MISDN_CTYPE_BOOL, "no", NONE },
 	{ "crypt_prefix", MISDN_GEN_CRYPT_PREFIX, MISDN_CTYPE_STR, NO_DEFAULT, NONE },
-	{ "crypt_keys", MISDN_GEN_CRYPT_KEYS, MISDN_CTYPE_STR, NO_DEFAULT, NONE }
+	{ "crypt_keys", MISDN_GEN_CRYPT_KEYS, MISDN_CTYPE_STR, NO_DEFAULT, NONE },
+	{ "ntdebugflags", MISDN_GEN_NTDEBUGFLAGS, MISDN_CTYPE_INT, "0", NONE },
+	{ "ntdebugfile", MISDN_GEN_NTDEBUGFILE, MISDN_CTYPE_STR, "/var/log/misdn-nt.log", NONE }
 };
 
 /* array of port configs, default is at position 0. */
@@ -535,11 +537,18 @@
 		}
 		break;
 	case MISDN_CTYPE_INT:
-		if (sscanf(value, "%d", &tmp)) {
+	{
+		char *pat;
+		if (strchr(value,'x')) 
+			pat="%x";
+		else
+			pat="%d";
+		if (sscanf(value, pat, &tmp)) {
 			dest->num = (int *)malloc(sizeof(int));
 			memcpy(dest->num, &tmp, sizeof(int));
 		} else
 			re = -1;
+	}
 		break;
 	case MISDN_CTYPE_BOOL:
 		dest->num = (int *)malloc(sizeof(int));

Modified: team/crichter/0.3.0/configs/misdn.conf.sample
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/configs/misdn.conf.sample?rev=36289&r1=36288&r2=36289&view=diff
==============================================================================
--- team/crichter/0.3.0/configs/misdn.conf.sample (original)
+++ team/crichter/0.3.0/configs/misdn.conf.sample Thu Jun 29 06:44:52 2006
@@ -24,6 +24,37 @@
 ;
 debug=0
 
+
+
+; set debugging file and flags for mISDNuser (NT-Stack) 
+; 
+; flags can be or'ed with the following values:
+;
+; DBGM_NET        0x00000001
+; DBGM_MSG        0x00000002
+; DBGM_FSM        0x00000004
+; DBGM_TEI        0x00000010
+; DBGM_L2         0x00000020
+; DBGM_L3         0x00000040
+; DBGM_L3DATA     0x00000080
+; DBGM_BC         0x00000100
+; DBGM_TONE       0x00000200
+; DBGM_BCDATA     0x00000400
+; DBGM_MAN        0x00001000
+; DBGM_APPL       0x00002000
+; DBGM_ISDN       0x00004000
+; DBGM_SOCK       0x00010000
+; DBGM_CONN       0x00020000
+; DBGM_CDATA      0x00040000
+; DBGM_DDATA      0x00080000
+; DBGM_SOUND      0x00100000
+; DBGM_SDATA      0x00200000
+; DBGM_TOPLEVEL   0x40000000
+; DBGM_ALL        0xffffffff
+;
+
+ntdebugflags=0
+ntdebugfile=/var/log/misdn-nt.log
 
 ; the big trace
 ;



More information about the svn-commits mailing list