[Asterisk-cvs] asterisk/channels chan_iax2.c,1.188.2.2,1.188.2.3

russell at lists.digium.com russell at lists.digium.com
Mon Oct 11 22:25:00 CDT 2004


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

Modified Files:
      Tag: v1-0
	chan_iax2.c 
Log Message:
fix delivery times on trunks (bug #2587)


Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.188.2.2
retrieving revision 1.188.2.3
diff -u -d -r1.188.2.2 -r1.188.2.3
--- chan_iax2.c	9 Oct 2004 00:25:53 -0000	1.188.2.2
+++ chan_iax2.c	12 Oct 2004 02:25:38 -0000	1.188.2.3
@@ -1731,7 +1731,7 @@
 	}
 }
 
-static int schedule_delivery(struct iax_frame *fr, int reallydeliver, int updatehistory)
+static int schedule_delivery(struct iax_frame *fr, int reallydeliver, int updatehistory, int fromtrunk)
 {
 	int ms,x;
 	int delay;
@@ -1794,7 +1794,7 @@
 		ms = 0;
 
 	/* delivery time is sender's sent timestamp converted back into absolute time according to our clock */
-	if (iaxs[fr->callno]->rxcore.tv_sec || iaxs[fr->callno]->rxcore.tv_usec) {
+	if ( (!fromtrunk) && (iaxs[fr->callno]->rxcore.tv_sec || iaxs[fr->callno]->rxcore.tv_usec) ) {
 		fr->af.delivery.tv_sec = iaxs[fr->callno]->rxcore.tv_sec;
 		fr->af.delivery.tv_usec = iaxs[fr->callno]->rxcore.tv_usec;
 		fr->af.delivery.tv_sec += fr->ts / 1000;
@@ -1807,7 +1807,7 @@
 	else {
 #if 0
 		if (reallydeliver)
-			ast_log(LOG_DEBUG, "schedule_delivery: set delivery to 0 as we don't have an rxcore yet.\n");
+			ast_log(LOG_DEBUG, "schedule_delivery: set delivery to 0 as we don't have an rxcore yet, or frame is from trunk.\n");
 #endif
 		fr->af.delivery.tv_sec = 0;
 		fr->af.delivery.tv_usec = 0;
@@ -1888,7 +1888,8 @@
 		delay = maxjitterbuffer;
 	
 	/* If jitter buffer is disabled then just pretend the frame is "right on time" */
-	if (!iaxs[fr->callno]->usejitterbuf)
+	/* If frame came from trunk, also don't do any delay */
+	if ( (!iaxs[fr->callno]->usejitterbuf) || fromtrunk )
 		delay = 0;
 
 	if (option_debug) {
@@ -5082,10 +5083,10 @@
 									if (iaxs[fr.callno]->bridgecallno) {
 										forward_delivery(&fr);
 									} else {
-										schedule_delivery(iaxfrdup2(&fr), 1, updatehistory);
+										schedule_delivery(iaxfrdup2(&fr), 1, updatehistory, 1);
 									}
 #else
-									schedule_delivery(iaxfrdup2(&fr), 1, updatehistory);
+									schedule_delivery(iaxfrdup2(&fr), 1, updatehistory, 1);
 #endif
 								}
 							} else {
@@ -5338,7 +5339,7 @@
 			if (option_debug)
 				ast_log(LOG_DEBUG, "IAX subclass %d received\n", f.subclass);
 			/* Go through the motions of delivering the packet without actually doing so */
-			schedule_delivery(&fr, 0, updatehistory);
+			schedule_delivery(&fr, 0, updatehistory, 0);
 			switch(f.subclass) {
 			case IAX_COMMAND_ACK:
 				/* Do nothing */
@@ -5996,12 +5997,12 @@
 		forward_delivery(&fr);
 	} else {
 		duped_fr = iaxfrdup2(&fr);
-		schedule_delivery(duped_fr, 1, updatehistory);
+		schedule_delivery(duped_fr, 1, updatehistory, 0);
 		fr.ts = duped_fr->ts;
 	}
 #else
 	duped_fr = iaxfrdup2(&fr);
-	schedule_delivery(duped_fr, 1, updatehistory);
+	schedule_delivery(duped_fr, 1, updatehistory, 0);
 	fr.ts = duped_fr->ts;
 #endif
 




More information about the svn-commits mailing list