[asterisk-commits] branch crichter/0.3.0 - r8265 /team/crichter/0.3.0/channels/misdn/isdn_lib.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jan 19 09:09:24 MST 2006


Author: crichter
Date: Thu Jan 19 10:09:22 2006
New Revision: 8265

URL: http://svn.digium.com/view/asterisk?rev=8265&view=rev
Log:
fixed the issue that no indications where heard with jitterbuffer

Modified:
    team/crichter/0.3.0/channels/misdn/isdn_lib.c

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=8265&r1=8264&r2=8265&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_lib.c (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_lib.c Thu Jan 19 10:09:22 2006
@@ -141,6 +141,8 @@
 #endif
 
 #define MISDN_DEBUG 0
+
+void misdn_tx_jitter(struct misdn_bchannel *bc, int len);
 
 struct misdn_bchannel *find_bc_by_l3id(struct misdn_stack *stack, unsigned long l3id);
 
@@ -433,6 +435,8 @@
 
 void empty_bc(struct misdn_bchannel *bc)
 {
+	bc->bframe_len=0;
+
 	bc->state=STATE_NOTHING;
 	
 	bc->channel = 0;
@@ -1892,6 +1896,11 @@
 	
 	if (bc->generate_tone) {
 		cb_event(EVENT_TONE_GENERATE, bc, glob_mgr->user_data);
+
+		if ( !bc->nojitter ) {
+			misdn_tx_jitter(bc,len);
+		}
+		
 		return 1;
 	}
 	
@@ -1899,6 +1908,35 @@
 }
 
 
+
+void misdn_tx_jitter(struct misdn_bchannel *bc, int len)
+{
+	char buf[4096 + mISDN_HEADER_LEN];
+	iframe_t *txfrm= (iframe_t*)buf;
+	int jlen, r;
+	
+	jlen=cb_jb_empty(bc,&buf[mISDN_HEADER_LEN],len);
+	
+	if (jlen) {
+		
+		if (jlen < len) {
+			cb_log(5,bc->port,"Jitterbuffer Underrun.\n");
+		}
+		
+		txfrm->prim = DL_DATA|REQUEST;
+		
+		txfrm->dinfo = 0;
+		
+		txfrm->addr = bc->addr|FLG_MSG_DOWN; /*  | IF_DOWN; */
+		
+		txfrm->len =jlen;
+		cb_log(9, bc->port, "Transmitting %d samples 2 misdn\n", txfrm->len);
+		
+		r=mISDN_write( glob_mgr->midev, buf, txfrm->len + mISDN_HEADER_LEN, 8000 );
+	} else {
+		//jb is filling
+	}
+}
 
 int handle_bchan(msg_t *msg)
 {
@@ -1957,8 +1995,6 @@
 		cb_log(4, stack->port, "BCHAN: bchan ACT Confirm\n");
 		free_msg(msg);
 		
-		cb_event(EVENT_BCHAN_ACTIVATED, bc, glob_mgr->user_data);
-		
 		return 1;    
 		
 	case PH_DEACTIVATE | INDICATION:
@@ -2030,31 +2066,7 @@
 				
 				if ( misdn_cap_is_speech(bc->capability)) {
 					if ( !bc->nojitter ) {
-						char buf[4096 + mISDN_HEADER_LEN];
-						iframe_t *txfrm= (iframe_t*)buf;
-						int len, r;
-						
-						len=cb_jb_empty(bc,&buf[mISDN_HEADER_LEN],frm->len);
-
-						if (len) {
-							
-							if (len < frm->len) {
-								cb_log(5,bc->port,"Jitterbuffer Underrun.\n");
-							}
-							
-							txfrm->prim = DL_DATA|REQUEST;
-							
-							txfrm->dinfo = 0;
-							
-							txfrm->addr = bc->addr|FLG_MSG_DOWN; /*  | IF_DOWN; */
-
-							txfrm->len = len;
-							cb_log(9, stack->port, "Transmitting %d samples 2 misdn\n", txfrm->len);
-							
-							r=mISDN_write(stack->midev, buf, txfrm->len + mISDN_HEADER_LEN, 8000 );
-						} else {
-							//jb is filling
-						}
+						misdn_tx_jitter(bc,frm->len);
 					}
 				}
 				



More information about the asterisk-commits mailing list