[Asterisk-cvs] asterisk/channels/misdn isdn_lib.c, 1.4, 1.5 isdn_lib.h, 1.2, 1.3 isdn_msg_parser.c, 1.2, 1.3

kpfleming kpfleming
Tue Nov 15 15:30:43 CST 2005


Update of /usr/cvsroot/asterisk/channels/misdn
In directory mongoose.digium.com:/tmp/cvs-serv28401/channels/misdn

Modified Files:
	isdn_lib.c isdn_lib.h isdn_msg_parser.c 
Log Message:
issue #5739 (plus ast_copy_string() usage conversion)


Index: isdn_lib.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/misdn/isdn_lib.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- isdn_lib.c	8 Nov 2005 00:02:53 -0000	1.4
+++ isdn_lib.c	15 Nov 2005 20:20:45 -0000	1.5
@@ -50,7 +50,8 @@
 struct misdn_stack* get_stack_by_bc(struct misdn_bchannel *bc)
 {
 	struct misdn_stack *stack=get_misdn_stack();
-	
+
+	if (!bc) return NULL;
 	
 	for ( ; stack; stack=stack->next) {
 		int i;
@@ -333,7 +334,8 @@
 int misdn_cap_is_speech(int cap)
 /** Poor mans version **/
 {
-	if (cap != INFO_CAPABILITY_DIGITAL_UNRESTRICTED) return 1;
+	if ( (cap != INFO_CAPABILITY_DIGITAL_UNRESTRICTED) &&
+	     (cap != INFO_CAPABILITY_DIGITAL_RESTRICTED) ) return 1;
 	return 0;
 }
 
@@ -342,6 +344,7 @@
 	switch (bc->progress_indicator) {
 	case INFO_PI_INBAND_AVAILABLE:
 	case INFO_PI_CALL_NOT_E2E_ISDN:
+	case INFO_PI_CALLED_NOT_ISDN:
 		return 1;
 	default:
 		return 0;
@@ -400,6 +403,8 @@
 
 void empty_bc(struct misdn_bchannel *bc)
 {
+	bc->state=STATE_NOTHING;
+	
 	bc->channel = 0;
 	bc->in_use = 0;
 
@@ -674,6 +679,11 @@
 }
 
 
+void misdn_lib_setup_bc(struct misdn_bchannel *bc)
+{
+	setup_bc(bc);
+}
+
 
 int setup_bc(struct misdn_bchannel *bc)
 {
@@ -687,15 +697,18 @@
 	int midev=stack->midev;
 	int channel=bc->channel-1-(bc->channel>16);
 	int b_stid=stack->b_stids[channel>=0?channel:0];
+
 	
-	if (bc->upset) {
-		cb_log(5, stack->port, "$$$ bc already upsetted stid :%x\n", b_stid);
-		return -1;
-	}
-	
+	if (bc->nodsp ) 
+		clean_up_bc(bc);
 	
-	if (bc->nodsp) {
+	if ( !misdn_cap_is_speech(bc->capability))
 		clean_up_bc(bc);
+	
+	
+	if (bc->upset) {
+		cb_log(4, stack->port, "$$$ bc already upsetted stid :%x\n", b_stid);
+		return -1;
 	}
 	
 	cb_log(5, stack->port, "$$$ Setting up bc with stid :%x\n", b_stid);
@@ -704,7 +717,7 @@
 		cb_log(0, stack->port," -- Stid <=0 at the moment on port:%d channel:%d\n",stack->port,channel);
 		return 1;
 	}
-
+	
   
 	bc->b_stid = b_stid;
 	
@@ -756,11 +769,12 @@
 	
 	
 	if (bc->async == 1 || bc->nodsp) {
-		cb_log(4, stack->port," --> TRANSPARENT Mode (no DSP)\n");
+		cb_log(4, stack->port," --> TRANSPARENT Mode (no DSP, no HDLC)\n");
 		pid.protocol[1] = ISDN_PID_L1_B_64TRANS;
 		pid.protocol[2] = ISDN_PID_L2_B_TRANS;
 		pid.protocol[3] = ISDN_PID_L3_B_USER;
 		pid.layermask = ISDN_LAYER((1)) | ISDN_LAYER((2)) | ISDN_LAYER((3));
+		
 	} else if ( misdn_cap_is_speech(bc->capability)) {
 		cb_log(4, stack->port," --> TRANSPARENT Mode\n");
 		pid.protocol[1] = ISDN_PID_L1_B_64TRANS;
@@ -1201,7 +1215,12 @@
 	struct misdn_stack *stack=get_stack_by_bc(bc);
 	if (stack->mode == TE_MODE) {
 		switch (event) {
+
+		case EVENT_CONNECT_ACKNOWLEDGE:
+			manager_bchannel_activate(bc);
+			break;
 		case EVENT_CONNECT:
+			
 			if ( *bc->crypt_key ) {
 				cb_log(4, stack->port, "ENABLING BLOWFISH port:%d channel:%d oad%d:%s dad%d:%s\n", stack->port, bc->channel, bc->onumplan,bc->oad, bc->dnumplan,bc->dad);
 				
@@ -1326,6 +1345,11 @@
 void misdn_lib_release(struct misdn_bchannel *bc)
 {
 	struct misdn_stack *stack=get_stack_by_bc(bc);
+
+	if (!stack) {
+		cb_log(1,0,"misdn_release: No Stack found\n");
+		return;
+	}
 	
 	if (bc->channel>=0) {
 		empty_chan_in_stack(stack,bc->channel);
@@ -1489,13 +1513,14 @@
 		}
 		break;
 
-    
+
+		case CC_CONNECT|INDICATION:
 		case CC_ALERTING|INDICATION:
 		case CC_PROCEEDING|INDICATION:
-		case CC_CONNECT|INDICATION:
+
 		{
 			struct misdn_bchannel *bc=find_bc_by_l3id(stack, hh->dinfo);
-
+			
 			if (!bc) {
 				msg_t *dmsg;
 				cb_log(0, stack->port,"!!!! We didn't found our bc, dinfo:%x port:%d\n",hh->dinfo, stack->port);
@@ -1507,6 +1532,7 @@
 				return 0;
 				
 			}
+			
 			setup_bc(bc);
 		}
 		break;
@@ -1850,8 +1876,9 @@
 	case DL_ESTABLISH | CONFIRM:
 		cb_log(4, stack->port, "BCHAN: bchan ACT Confirm\n");
 		free_msg(msg);
-		return 1;    
 
+		return 1;    
+		
 	case PH_DEACTIVATE | INDICATION:
 	case DL_RELEASE | INDICATION:
 		cb_log (4, stack->port, "BCHAN: DeACT Ind\n");
@@ -1899,7 +1926,8 @@
 		bc->bframe_len = frm->len;
 
 		/** Anyway flip the bufbits **/
-		flip_buf_bits(bc->bframe, bc->bframe_len);
+		if ( misdn_cap_is_speech(bc->capability) ) 
+			flip_buf_bits(bc->bframe, bc->bframe_len);
 		
 		
 #if MISDN_DEBUG
@@ -2417,6 +2445,8 @@
 	
 	cb_log(2, stack->port, " --> channel:%d caps:%s pi:%x keypad:%s\n", bc->channel, bearer2str(bc->capability),bc->progress_indicator, bc->keypad);
 
+	cb_log(3, stack->port, " --> urate:%d rate:%d mode:%d user1:%d\n", bc->urate, bc->rate, bc->mode,bc->user1);
+	
 	cb_log(3, stack->port, " --> pid:%d addr:%x l3id:%x\n", bc->pid, bc->addr, bc->l3_id);
 
 	cb_log(4, stack->port, " --> bc:%x h:%d sh:%d\n", bc, bc->holded, bc->stack_holder);
@@ -3030,8 +3060,9 @@
 
 	struct misdn_stack *stack=get_stack_by_bc(bc);
 	if (!bc->active) return -1;   
-	
-	flip_buf_bits(data,len);
+
+	if ( misdn_cap_is_speech(bc->capability) )
+		flip_buf_bits(data,len);
 	
 	if ( !bc->nojitter && misdn_cap_is_speech(bc->capability) ) {
 		if (len > ibuf_freecount(bc->misdnbuf)) {

Index: isdn_lib.h
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/misdn/isdn_lib.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- isdn_lib.h	1 Nov 2005 22:04:14 -0000	1.2
+++ isdn_lib.h	15 Nov 2005 20:20:45 -0000	1.3
@@ -235,8 +235,7 @@
 	int stack_holder;
 	
 	int pres;
-  
-	int nohdlc;
+	int screen;
 	
 	int capability;
 	int law;
@@ -350,6 +349,7 @@
 
 /** Ibuf interface End **/
 
+void misdn_lib_setup_bc(struct misdn_bchannel *bc);
 
 void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);
 void misdn_lib_split_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);

Index: isdn_msg_parser.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/misdn/isdn_msg_parser.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- isdn_msg_parser.c	1 Nov 2005 22:04:14 -0000	1.2
+++ isdn_msg_parser.c	15 Nov 2005 20:20:45 -0000	1.3
@@ -267,7 +267,7 @@
 		enc_ie_channel_id(&setup->CHANNEL_ID, msg, 1, bc->channel, nt,bc);
   
 	{
-		int type=bc->onumplan,plan=1,present=bc->pres,screen=0;
+		int type=bc->onumplan,plan=1,present=bc->pres,screen=bc->screen;
 		enc_ie_calling_pn(&setup->CALLING_PN, msg, type, plan, present,
 				  screen, bc->oad, nt, bc);
 	}




More information about the svn-commits mailing list