[asterisk-commits] branch group/t38passthrough r31553 - in /team/group/t38passthrough: ./ includ...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jun 1 14:24:37 MST 2006


Author: mogorman
Date: Thu Jun  1 16:24:37 2006
New Revision: 31553

URL: http://svn.digium.com/view/asterisk?rev=31553&view=rev
Log:
steves patches from the bug note

Modified:
    team/group/t38passthrough/include/asterisk/frame.h
    team/group/t38passthrough/udptl.c

Modified: team/group/t38passthrough/include/asterisk/frame.h
URL: http://svn.digium.com/view/asterisk/team/group/t38passthrough/include/asterisk/frame.h?rev=31553&r1=31552&r2=31553&view=diff
==============================================================================
--- team/group/t38passthrough/include/asterisk/frame.h (original)
+++ team/group/t38passthrough/include/asterisk/frame.h Thu Jun  1 16:24:37 2006
@@ -117,6 +117,8 @@
 	long len;
 	/*! Sequence number */
 	int seqno;
+	/*! Number of copies to send (for redundant transmission of special data) */
+	int tx_copies;
 };
 
 /*!

Modified: team/group/t38passthrough/udptl.c
URL: http://svn.digium.com/view/asterisk/team/group/t38passthrough/udptl.c?rev=31553&r1=31552&r2=31553&view=diff
==============================================================================
--- team/group/t38passthrough/udptl.c (original)
+++ team/group/t38passthrough/udptl.c Thu Jun  1 16:24:37 2006
@@ -331,12 +331,12 @@
 				if (seq_no - i >= s->rx_seq_no) {
 					/* This one wasn't seen before */
 					/* Decode the secondary IFP packet */
-					//fprintf(stderr, "Secondary %d, len %d\n", seq_no - i, lengths[i - 1]);
 					s->f[ifp_no].frametype = AST_FRAME_MODEM;
 					s->f[ifp_no].subclass = AST_MODEM_T38;
 
 					s->f[ifp_no].mallocd = 0;
-					//s->f[ifp_no].???seq_no = seq_no - i;
+					s->f[ifp_no].seqno = seq_no - i;
+					s->f[ifp_no].tx_copies = 1;
 					s->f[ifp_no].datalen = lengths[i - 1];
 					s->f[ifp_no].data = (uint8_t *) bufs[i - 1];
 					s->f[ifp_no].offset = 0;
@@ -358,7 +358,8 @@
 			s->f[ifp_no].subclass = AST_MODEM_T38;
 			
 			s->f[ifp_no].mallocd = 0;
-			//s->f[ifp_no].???seq_no = seq_no;
+			s->f[ifp_no].seqno = seq_no;
+			s->f[ifp_no].tx_copies = 1;
 			s->f[ifp_no].datalen = ifp_len;
 			s->f[ifp_no].data = (uint8_t *) ifp;
 			s->f[ifp_no].offset = 0;
@@ -454,12 +455,12 @@
 		/* Now play any new packets forwards in time */
 		for (l = (x + 1) & UDPTL_BUF_MASK, j = seq_no - UDPTL_BUF_MASK;  l != x;  l = (l + 1) & UDPTL_BUF_MASK, j++) {
 			if (repaired[l]) {
-				//fprintf(stderr, "Fixed packet %d, len %d\n", j, l);
 				s->f[ifp_no].frametype = AST_FRAME_MODEM;
 				s->f[ifp_no].subclass = AST_MODEM_T38;
 			
 				s->f[ifp_no].mallocd = 0;
-				//s->f[ifp_no].???seq_no = j;
+				s->f[ifp_no].seqno = j;
+				s->f[ifp_no].tx_copies = 1;
 				s->f[ifp_no].datalen = s->rx[l].buf_len;
 				s->f[ifp_no].data = s->rx[l].buf;
 				s->f[ifp_no].offset = 0;
@@ -477,7 +478,8 @@
 		s->f[ifp_no].subclass = AST_MODEM_T38;
 			
 		s->f[ifp_no].mallocd = 0;
-		//s->f[ifp_no].???seq_no = j;
+		s->f[ifp_no].seqno = j;
+		s->f[ifp_no].tx_copies = 1;
 		s->f[ifp_no].datalen = ifp_len;
 		s->f[ifp_no].data = (uint8_t *) ifp;
 		s->f[ifp_no].offset = 0;
@@ -894,6 +896,8 @@
 {
 	int len;
 	int res;
+	int copies;
+	int i;
 	uint8_t buf[LOCAL_FAX_MAX_DATAGRAM];
 	char iabuf[INET_ADDRSTRLEN];
 
@@ -912,10 +916,12 @@
 
 	/* Cook up the UDPTL packet, with the relevant EC info. */
 	len = udptl_build_packet(s, buf, f->data, f->datalen);
-
-	if (len > 0  &&  s->them.sin_port && s->them.sin_addr.s_addr) {
-		if ((res = sendto(s->fd, buf, len, 0, (struct sockaddr *) &s->them, sizeof(s->them))) < 0)
-			ast_log(LOG_NOTICE, "UDPTL Transmission error to %s:%d: %s\n", ast_inet_ntoa(iabuf, sizeof(iabuf), s->them.sin_addr), ntohs(s->them.sin_port), strerror(errno));
+	if (len > 0  &&  s->them.sin_port  &&  s->them.sin_addr.s_addr) {
+		copies = (f->tx_copies > 0)  ?  f->tx_copies  :  1;
+		for (i = 0;  i < copies;  i++) {
+			if ((res = sendto(s->fd, buf, len, 0, (struct sockaddr *) &s->them, sizeof(s->them))) < 0)
+				ast_log(LOG_NOTICE, "UDPTL Transmission error to %s:%d: %s\n", ast_inet_ntoa(iabuf, sizeof(iabuf), s->them.sin_addr), ntohs(s->them.sin_port), strerror(errno));
+		}
 #if 0
 		printf("Sent %d bytes of UDPTL data to %s:%d\n", res, ast_inet_ntoa(iabuf, sizeof(iabuf), udptl->them.sin_addr), ntohs(udptl->them.sin_port));
 #endif



More information about the asterisk-commits mailing list