[Asterisk-cvs] asterisk/channels chan_iax2.c, 1.352, 1.353 chan_vpb.c, 1.94, 1.95 chan_zap.c, 1.529, 1.530

markster markster
Thu Oct 13 14:33:16 CDT 2005


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

Modified Files:
	chan_iax2.c chan_vpb.c chan_zap.c 
Log Message:
Fix call timeouts with rtp bridge etc (bug #5252)


Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.352
retrieving revision 1.353
diff -u -d -r1.352 -r1.353
--- chan_iax2.c	12 Oct 2005 05:12:43 -0000	1.352
+++ chan_iax2.c	13 Oct 2005 18:27:53 -0000	1.353
@@ -725,7 +725,7 @@
 static int iax2_write(struct ast_channel *c, struct ast_frame *f);
 static int iax2_indicate(struct ast_channel *c, int condition);
 static int iax2_setoption(struct ast_channel *c, int option, void *data, int datalen);
-static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc);
+static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
 static int iax2_transfer(struct ast_channel *c, const char *dest);
 static int iax2_fixup(struct ast_channel *oldchannel, struct ast_channel *newchan);
 
@@ -3082,7 +3082,7 @@
 	ast_mutex_unlock(&iaxsl[callno0]);
 }
 
-static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc)
+static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms)
 {
 	struct ast_channel *cs[3];
 	struct ast_channel *who;
@@ -3162,6 +3162,11 @@
 		}
 		to = 1000;
 		who = ast_waitfor_n(cs, 2, &to);
+		if (timeoutms > -1) {
+			timeoutms -= (1000 - to);
+			if (timeoutms < 0)
+				timeoutms = 0;
+		}
 		if (!who) {
 			if (ast_check_hangup(c0) || ast_check_hangup(c1)) {
 				res = AST_BRIDGE_FAILED;

Index: chan_vpb.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_vpb.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- chan_vpb.c	14 Sep 2005 20:46:50 -0000	1.94
+++ chan_vpb.c	13 Oct 2005 18:27:53 -0000	1.95
@@ -337,7 +337,7 @@
 static int vpb_answer(struct ast_channel *ast);
 static struct ast_frame *vpb_read(struct ast_channel *ast);
 static int vpb_write(struct ast_channel *ast, struct ast_frame *frame);
-static enum ast_bridge_result vpb_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc);
+static enum ast_bridge_result vpb_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
 static int vpb_indicate(struct ast_channel *ast, int condition);
 static int vpb_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
 
@@ -407,7 +407,7 @@
 /* #define HALF_DUPLEX_BRIDGE */
 
 /* This is the Native bridge code, which Asterisk will try before using its own bridging code */
-static enum ast_bridge_result vpb_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc)
+static enum ast_bridge_result vpb_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms)
 {
 	struct vpb_pvt *p0 = (struct vpb_pvt *)c0->tech_pvt;
 	struct vpb_pvt *p1 = (struct vpb_pvt *)c1->tech_pvt;
@@ -415,7 +415,6 @@
 	int res;
 	struct ast_channel *cs[3];
 	struct ast_channel *who;
-	int to = -1;
 	struct ast_frame *f;
 
 	cs[0] = c0;
@@ -517,7 +516,7 @@
 		/* pthread_cond_wait(&bridges[i].cond, &bridges[i].lock);*/ /* Wait for condition signal. */
 		while( !bridges[i].endbridge ) {
 			/* Are we really ment to be doing nothing ?!?! */
-			who = ast_waitfor_n(cs, 2, &to);
+			who = ast_waitfor_n(cs, 2, &timeoutms);
 			if (!who) {
 				ast_log(LOG_DEBUG, "%s: vpb_bridge: Empty frame read...\n",p0->dev);
 				/* check for hangup / whentohangup */

Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.529
retrieving revision 1.530
diff -u -d -r1.529 -r1.530
--- chan_zap.c	4 Oct 2005 17:00:01 -0000	1.529
+++ chan_zap.c	13 Oct 2005 18:27:53 -0000	1.530
@@ -340,7 +340,7 @@
 
 static int restart_monitor(void);
 
-static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc);
+static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
 
 static int zt_sendtext(struct ast_channel *c, const char *text);
 
@@ -2940,13 +2940,12 @@
 #endif		
 }
 
-static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc)
+static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms)
 {
 	struct ast_channel *who;
 	struct zt_pvt *p0, *p1, *op0, *op1;
 	struct zt_pvt *master = NULL, *slave = NULL;
 	struct ast_frame *f;
-	int to;
 	int inconf = 0;
 	int nothingok = 1;
 	int ofd0, ofd1;
@@ -3169,8 +3168,7 @@
 		}
 #endif
 
-		to = -1;
-		who = ast_waitfor_n(priority ? c0_priority : c1_priority, 2, &to);
+		who = ast_waitfor_n(priority ? c0_priority : c1_priority, 2, &timeoutms);
 		if (!who) {
 			ast_log(LOG_DEBUG, "Ooh, empty read...\n");
 			continue;




More information about the svn-commits mailing list