[Asterisk-cvs] asterisk rtp.c,1.109,1.110

markster at lists.digium.com markster at lists.digium.com
Sun Feb 27 00:01:38 CST 2005


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

Modified Files:
	rtp.c 
Log Message:
Make sure we increase the timestamp between digits (bug #3675)


Index: rtp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/rtp.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- rtp.c	15 Feb 2005 15:57:52 -0000	1.109
+++ rtp.c	27 Feb 2005 05:59:24 -0000	1.110
@@ -85,6 +85,7 @@
 	int dtmfcount;
 	unsigned int dtmfduration;
 	int nat;
+	int digitssent;
 	int flags;
 	struct sockaddr_in us;
 	struct sockaddr_in them;
@@ -1010,6 +1011,7 @@
 	memset(&rtp->dtmfmute, 0, sizeof(rtp->dtmfmute));
 	rtp->lastts = 0;
 	rtp->lastrxts = 0;
+	rtp->digitssent = 0;
 	rtp->lastividtimestamp = 0;
 	rtp->lastovidtimestamp = 0;
 	rtp->lasteventseqn = 0;
@@ -1101,10 +1103,14 @@
 	
 	/* Get a pointer to the header */
 	rtpheader = (unsigned int *)data;
-	rtpheader[0] = htonl((2 << 30) | (1 << 23) | (payload << 16) | (rtp->seqno++));
-	rtpheader[1] = htonl(rtp->lastts);
+	rtpheader[0] = htonl((2 << 30) | (1 << 23) | (payload << 16) | rtp->seqno);
+	rtpheader[1] = htonl(rtp->lastts + (rtp->digitssent * 160));
 	rtpheader[2] = htonl(rtp->ssrc); 
 	rtpheader[3] = htonl((digit << 24) | (0xa << 16) | (0));
+
+	rtp->seqno++;
+	rtp->digitssent++;
+
 	for (x=0;x<6;x++) {
 		if (rtp->them.sin_port && rtp->them.sin_addr.s_addr) {
 			res = sendto(rtp->s, (void *)rtpheader, hdrlen + 4, 0, (struct sockaddr *)&rtp->them, sizeof(rtp->them));
@@ -1272,6 +1278,7 @@
 	put_uint32(rtpheader + 4, htonl(rtp->lastts));
 	put_uint32(rtpheader + 8, htonl(rtp->ssrc)); 
 
+	rtp->digitssent = 0;
 	rtp->seqno++;
 
 	if (rtp->them.sin_port && rtp->them.sin_addr.s_addr) {




More information about the svn-commits mailing list