[Asterisk-cvs] asterisk/channels chan_iax2.c,1.121,1.122

markster at lists.digium.com markster at lists.digium.com
Mon Apr 19 11:20:50 CDT 2004


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

Modified Files:
	chan_iax2.c 
Log Message:
Always give real timestamps on IAX ping/pong messages


Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -d -r1.121 -r1.122
--- chan_iax2.c	18 Apr 2004 21:53:13 -0000	1.121
+++ chan_iax2.c	19 Apr 2004 15:24:51 -0000	1.122
@@ -1102,7 +1102,7 @@
 				iax2_send(iaxs[fr->callno], &fr->af, fr->ts, -1, 0, 0, 0);
 			} else if (fr->af.subclass == IAX_COMMAND_LAGRP) {
 				/* This is a reply we've been given, actually measure the difference */
-				ts = calc_timestamp(iaxs[fr->callno], 0, NULL);
+				ts = calc_timestamp(iaxs[fr->callno], 0, &fr->af);
 				iaxs[fr->callno]->lag = ts - fr->ts;
 			}
 		} else {
@@ -2576,10 +2576,15 @@
 	struct timeval tv;
 	int ms;
 	int voice = 0;
+	int genuine = 0;
 	struct timeval *delivery = NULL;
-	if (f && (f->frametype == AST_FRAME_VOICE)) {
-		voice = 1;
-		delivery = &f->delivery;
+	if (f) {
+		if (f->frametype == AST_FRAME_VOICE) {
+			voice = 1;
+			delivery = &f->delivery;
+		} else if (f->frametype == AST_FRAME_IAX) {
+			genuine = 1;
+		}
 	}
 	if (!p->offset.tv_sec && !p->offset.tv_usec) {
 		gettimeofday(&p->offset, NULL);
@@ -2605,8 +2610,12 @@
 			} else
 				p->nextpred = ms;
 		} else {
-			/* On a dataframe, use last value + 3 (to accomodate jitter buffer shrinkign) if appropriate */
-			if (abs(ms - p->lastsent) <= 640) {
+			/* On a dataframe, use last value + 3 (to accomodate jitter buffer shrinkign) if appropriate unless
+			   it's a genuine frame */
+			if (genuine) {
+				if (ms <= p->lastsent)
+					ms = p->lastsent + 3;
+			} else if (abs(ms - p->lastsent) <= 640) {
 				ms = p->lastsent + 3;
 			}
 		}
@@ -5033,7 +5042,7 @@
 				}
 #else
 				/* Calculate ping time */
-				iaxs[fr.callno]->pingtime =  calc_timestamp(iaxs[fr.callno], 0, NULL) - fr.ts;
+				iaxs[fr.callno]->pingtime =  calc_timestamp(iaxs[fr.callno], 0, &f) - fr.ts;
 #endif
 				if (iaxs[fr.callno]->peerpoke) {
 					peer = iaxs[fr.callno]->peerpoke;




More information about the svn-commits mailing list