[asterisk-commits] branch crichter/0.3.0 - r8097 in /team/crichter/0.3.0/channels: ./ misdn/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Jan 16 02:13:49 MST 2006


Author: crichter
Date: Mon Jan 16 03:13:45 2006
New Revision: 8097

URL: http://svn.digium.com/view/asterisk?rev=8097&view=rev
Log:
merged hdlc stuff from frame-data in order to make data calls possible between chan_zap and chan_misdn

Modified:
    team/crichter/0.3.0/channels/chan_misdn.c
    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_msg_parser.c

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=8097&r1=8096&r2=8097&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/chan_misdn.c (original)
+++ team/crichter/0.3.0/channels/chan_misdn.c Mon Jan 16 03:13:45 2006
@@ -1562,10 +1562,12 @@
 	}
 
 	{
-		const char *async=pbx_builtin_getvar_helper(ast, "MISDN_DIGITAL_TRANS");
-		if (async) {
+		const char *nodsp=pbx_builtin_getvar_helper(ast, "MISDN_DIGITAL_TRANS");
+		if (nodsp) {
 			chan_misdn_log(1, p->bc->port, " --> Connection is transparent digital\n");
-			p->bc->async=1;
+			p->bc->nodsp=1;
+			p->bc->hdlc=0;
+			p->bc->nojitter=1;
 		}
 	}
 	
@@ -3847,14 +3849,12 @@
       
 		case 'h':
 			chan_misdn_log(1, ch->bc->port, "SETOPT: Digital\n");
+			
 			if (strlen(tok) > 1 && tok[1]=='1') {
-				chan_misdn_log(1, ch->bc->port, "SETOPT: Digital TRANS_DIGITAL\n");
-				ch->bc->async=1;
-				ch->bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED;
-			} else {
-				ch->bc->async=0;
-				ch->bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED;
-			}
+				chan_misdn_log(1, ch->bc->port, "SETOPT: HDLC \n");
+				ch->bc->hdlc=1;
+			}  
+			ch->bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED;
 			break;
             
 		case 's':

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=8097&r1=8096&r2=8097&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_lib.c (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_lib.c Mon Jan 16 03:13:45 2006
@@ -488,9 +488,9 @@
 	bc->mode=0;
 	bc->rate=0;
 	bc->user1=0;
-	bc->async=0;
 	bc->urate=0;
 	
+	bc->hdlc=0;
 	
 	
 	bc->info_dad[0] = 0;
@@ -756,11 +756,10 @@
 	int midev=stack->midev;
 	int channel=bc->channel-1-(bc->channel>16);
 	int b_stid=stack->b_stids[channel>=0?channel:0];
-	
-	
-	if ( !misdn_cap_is_speech(bc->capability))
+
+	if (bc->hdlc) {
 		clean_up_bc(bc);
-	
+	}
 	
 	if (bc->upset) {
 		cb_log(4, stack->port, "$$$ bc already upsetted stid :%x\n", b_stid);
@@ -792,7 +791,18 @@
 #ifndef MISDN_DSP
 		bc->nodsp=1;
 #endif
-		if ( misdn_cap_is_speech(bc->capability) && !bc->nodsp && (bc->async != 1) ) {
+		if ( bc->hdlc || bc->nodsp) {
+			cb_log(4, stack->port,"setup_bc: without dsp\n");
+			{ 
+				int l = sizeof(li.name);
+				strncpy(li.name, "B L3", l);
+				li.name[l-1] = 0;
+			}
+			li.pid.layermask = ISDN_LAYER((3));
+			li.pid.protocol[3] = ISDN_PID_L3_B_USER;
+			
+			bc->layer=3;
+		} else {
 			cb_log(4, stack->port,"setup_bc: with dsp\n");
 			{ 
 				int l = sizeof(li.name);
@@ -800,22 +810,11 @@
 				li.name[l-1] = 0;
 			}
 			li.pid.layermask = ISDN_LAYER((4));
-			li.pid.protocol[4] = ISDN_PID_L4_B_USER;
-
+			li.pid.protocol[4] = ISDN_PID_L4_B_USER
+;
 			bc->layer=4;
 			
-		} else {
-			cb_log(4, stack->port,"setup_bc: without dsp\n");
-			{ 
-				int l = sizeof(li.name);
-				strncpy(li.name, "B L3", l);
-				li.name[l-1] = 0;
-			}
-			li.pid.layermask = ISDN_LAYER((3));
-			li.pid.protocol[3] = ISDN_PID_L3_B_USER;
-			
-			bc->layer=3;
-		}
+		}  
 		
 		ret = mISDN_new_layer(midev, &li);
 		if (ret ) {
@@ -833,29 +832,28 @@
 	
 	cb_log(4, stack->port," --> Channel is %d\n", bc->channel);
 	
-	
-	if (bc->async == 1 || bc->nodsp) {
-		cb_log(4, stack->port," --> TRANSPARENT Mode (no DSP, no HDLC)\n");
+	if (bc->nodsp) {
+		cb_log(2, 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");
+	} else if ( bc->hdlc ) {
+		cb_log(2, stack->port," --> HDLC Mode\n");
+		pid.protocol[1] = ISDN_PID_L1_B_64HDLC ;
+		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 {
+		cb_log(2, stack->port," --> TRANSPARENT Mode\n");
 		pid.protocol[1] = ISDN_PID_L1_B_64TRANS;
 		pid.protocol[2] = ISDN_PID_L2_B_TRANS;
 		pid.protocol[3] = ISDN_PID_L3_B_DSP;
 		pid.protocol[4] = ISDN_PID_L4_B_USER;
 		pid.layermask = ISDN_LAYER((1)) | ISDN_LAYER((2)) | ISDN_LAYER((3)) | ISDN_LAYER((4));
 		
-	} else {
-		cb_log(4, stack->port," --> HDLC Mode\n");
-		pid.protocol[1] = ISDN_PID_L1_B_64HDLC ;
-		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)) ;
-	}
+	} 
 	
 	ret = mISDN_set_stack(midev, bc->b_stid, &pid);
 	
@@ -1271,10 +1269,19 @@
 		switch (event) {
 
 		case EVENT_CONNECT_ACKNOWLEDGE:
+			
+			if ( !misdn_cap_is_speech(bc->capability)) {
+				int ret=setup_bc(bc);
+				if (ret == -EINVAL){
+					cb_log(-1,bc->port,"send_event: setup_bc failed\n");
+					
+				}
+			}
+			
 			manager_bchannel_activate(bc);
 			break;
 		case EVENT_CONNECT:
-			
+
 			if ( *bc->crypt_key ) {
 				cb_log(4, stack->port, "ENABLING BLOWFISH channel:%d oad%d:%s dad%d:%s\n", bc->channel, bc->onumplan,bc->oad, bc->dnumplan,bc->dad);
 				
@@ -1294,7 +1301,6 @@
 				bc->channel=find_free_chan_in_stack(stack, 0);
 				if (!bc->channel) {
 					cb_log(-1, stack->port, "Any Channel Requested, but we have no more!!\n");
-
 					break;
 				}
 			} 
@@ -1302,7 +1308,6 @@
 			if (!stack->nt) {
 				int ret=setup_bc(bc);
 				if (ret == -EINVAL){
-
 					cb_log(-1,bc->port,"handle_event: setup_bc failed\n");
 					misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
 				}
@@ -1575,7 +1580,25 @@
 		}
 		break;
 
-
+		case CC_CONNECT_ACKNOWLEDGE|INDICATION:
+#if 0
+		{
+			struct misdn_bchannel *bc=find_bc_by_l3id(stack, hh->dinfo);
+			if (bc) {
+				if ( !misdn_cap_is_speech(bc->capability)) {
+					int ret=setup_bc(bc);
+					if (ret == -EINVAL){
+						cb_log(-1,bc->port,"send_event: setup_bc failed\n");
+						
+					}
+				}
+				
+				manager_bchannel_activate(bc);
+			}
+		}
+#endif
+		break;
+		
 		case CC_CONNECT|INDICATION:
 		case CC_ALERTING|INDICATION:
 		case CC_PROCEEDING|INDICATION:
@@ -2653,62 +2676,62 @@
 		
 
 	case EVENT_CONNECT:
-	case EVENT_PROCEEDING:
 	case EVENT_PROGRESS:
 	case EVENT_ALERTING:
+	case EVENT_PROCEEDING:
 	case EVENT_SETUP_ACKNOWLEDGE:
 	case EVENT_RETRIEVE_ACKNOWLEDGE:
-		
 		if (stack->nt) {
 			if (bc->channel <=0 ) { /*  else we have the channel already */
 				bc->channel = find_free_chan_in_stack(stack, 0);
 				if (!bc->channel) {
 					cb_log(-1, stack->port, " No free channel at the moment\n");
-
+					
 					err=-ENOCHAN;
 					goto ERR;
 				}
 			}
 			/* Its that i generate channels */
 		}
-
-		int ret=setup_bc(bc);
-		if (ret == -EINVAL){
-			cb_log(-1,bc->port,"send_event: setup_bc failed\n");
-			
-		}
-		
-		
-		if ( event == EVENT_CONNECT ) {
+		
+		if ( bc->nt || misdn_cap_is_speech(bc->capability)) {
+			int ret=setup_bc(bc);
+			if (ret == -EINVAL){
+				cb_log(-1,bc->port,"send_event: setup_bc failed\n");
+				
+			}
+		} 
+		
+		
+		if ( (event == EVENT_CONNECT ) && misdn_cap_is_speech(bc->capability) ) {
 			if ( *bc->crypt_key ) {
 				cb_log(4, stack->port,  " --> ENABLING BLOWFISH channel:%d oad%d:%s dad%d:%s \n", bc->channel, bc->onumplan,bc->oad, bc->dnumplan,bc->dad);
 				
 				manager_ph_control_block(bc,  BF_ENABLE_KEY, bc->crypt_key, strlen(bc->crypt_key) );
 			}
 			
-			if ( misdn_cap_is_speech(bc->capability)) {
-				if (!bc->nodsp) manager_ph_control(bc,  DTMF_TONE_START, 0);
-				
-				if (bc->ec_enable) manager_ec_enable(bc);
-				
-				if (bc->txgain != 0) {
-					cb_log(4, stack->port,  "--> Changing txgain to %d\n", bc->txgain);
-					manager_ph_control(bc, VOL_CHANGE_TX, bc->txgain);
-				}
-				
-				if ( bc->rxgain != 0 ) {
-					cb_log(4, stack->port,  "--> Changing rxgain to %d\n", bc->rxgain);
-					manager_ph_control(bc, VOL_CHANGE_RX, bc->rxgain);
-				}
-			}
+			
+			if (!bc->nodsp) manager_ph_control(bc,  DTMF_TONE_START, 0);
+			
+			if (bc->ec_enable) manager_ec_enable(bc);
+			
+			if (bc->txgain != 0) {
+				cb_log(4, stack->port,  "--> Changing txgain to %d\n", bc->txgain);
+				manager_ph_control(bc, VOL_CHANGE_TX, bc->txgain);
+			}
+			
+			if ( bc->rxgain != 0 ) {
+				cb_log(4, stack->port,  "--> Changing rxgain to %d\n", bc->rxgain);
+				manager_ph_control(bc, VOL_CHANGE_RX, bc->rxgain);
+			}
+			
 		}
 		
 		if (event == EVENT_RETRIEVE_ACKNOWLEDGE) {
 			manager_bchannel_activate(bc);
 		}
-		
 		break;
-    
+
 	case EVENT_HOLD_ACKNOWLEDGE:
 	{
 		struct misdn_bchannel *holded_bc=malloc(sizeof(struct misdn_bchannel));

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=8097&r1=8096&r2=8097&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_lib.h (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_lib.h Mon Jan 16 03:13:45 2006
@@ -254,7 +254,7 @@
 
 	int user1;
 	int urate;
-	int async;
+	int hdlc;
 	/* V110 */
   
 	unsigned char display[84];

Modified: team/crichter/0.3.0/channels/misdn/isdn_msg_parser.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/isdn_msg_parser.c?rev=8097&r1=8096&r2=8097&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_msg_parser.c (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_msg_parser.c Mon Jan 16 03:13:45 2006
@@ -197,26 +197,19 @@
 		dec_ie_bearer(setup->BEARER, (Q931_info_t *)setup, &coding, &capability, &mode, &rate, &multi, &user, &async, &urate, &stopbits, &dbits, &parity, nt,bc);
 		switch (capability) {
 		case -1: bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED; 
-//			cb_log(2, bc->stack->port, " --> cap -1 -> digital\n");
 			break;
 		case 0: bc->capability=INFO_CAPABILITY_SPEECH;
-//			cb_log(2, bc->stack->port, " --> cap speech\n");
 			break;
 		case 8: bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED;
 			bc->user1 = user;
-			bc->async = async;
 			bc->urate = urate;
 			
 			bc->rate = rate;
 			bc->mode = mode;
-			
-//			cb_log(2, bc->stack->port, " --> cap unres Digital (user l1 %d, async %d, user rate %d\n", user, async, urate);
 			break;
 		case 9: bc->capability=INFO_CAPABILITY_DIGITAL_RESTRICTED;
-//			cb_log(2, bc->stack->port, " --> cap res Digital\n");
 			break;
 		default:
-//			cb_log(2, bc->stack->port, " --> cap Else\n");
 			break;
 		}
 		



More information about the asterisk-commits mailing list