[svn-commits] trunk - r7826 in /trunk: ./ channel.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Jan 5 17:52:35 CST 2006


Author: kpfleming
Date: Thu Jan  5 17:52:34 2006
New Revision: 7826

URL: http://svn.digium.com/view/asterisk?rev=7826&view=rev
Log:
Merged revisions 7825 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r7825 | kpfleming | 2006-01-05 17:49:50 -0600 (Thu, 05 Jan 2006) | 3 lines

eliminate rounding errors that caused call time limits to be inaccurate (issue #5913)
round 'time left' reported during call limit warnings up to sound more accurate

........

Modified:
    trunk/   (props changed)
    trunk/channel.c

Propchange: trunk/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jan  5 17:52:34 2006
@@ -1,1 +1,1 @@
-/branches/1.2:1-7489,7491-7496,7498-7516,7518-7528,7530-7545,7547-7549,7551,7553-7556,7558-7579,7581-7585,7587-7594,7596-7604,7606-7640,7642-7662,7664-7705,7707-7737,7739-7770,7772-7791,7793-7811,7813-7819,7823
+/branches/1.2:1-7489,7491-7496,7498-7516,7518-7528,7530-7545,7547-7549,7551,7553-7556,7558-7579,7581-7585,7587-7594,7596-7604,7606-7640,7642-7662,7664-7705,7707-7737,7739-7770,7772-7791,7793-7811,7813-7825

Modified: trunk/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/channel.c?rev=7826&r1=7825&r2=7826&view=diff
==============================================================================
--- trunk/channel.c (original)
+++ trunk/channel.c Thu Jan  5 17:52:34 2006
@@ -3201,7 +3201,8 @@
 }
 
 static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct ast_channel *c1,
-			      struct ast_bridge_config *config, struct ast_frame **fo, struct ast_channel **rc, int toms)
+						 struct ast_bridge_config *config, struct ast_frame **fo,
+						 struct ast_channel **rc, struct timeval bridge_end)
 {
 	/* Copy voice back and forth between the two channels. */
 	struct ast_channel *cs[3];
@@ -3213,6 +3214,7 @@
 	int watch_c0_dtmf;
 	int watch_c1_dtmf;
 	void *pvt0, *pvt1;
+	int to;
 	
 	cs[0] = c0;
 	cs[1] = c1;
@@ -3231,12 +3233,13 @@
 			res = AST_BRIDGE_RETRY;
 			break;
 		}
-		who = ast_waitfor_n(cs, 2, &toms);
+		to = ast_tvdiff_ms(bridge_end, ast_tvnow());
+		if (to <= 0) {
+			res = AST_BRIDGE_RETRY;
+			break;
+		}
+		who = ast_waitfor_n(cs, 2, &to);
 		if (!who) {
-			if (!toms) {
-				res = AST_BRIDGE_RETRY;
-				break;
-			}
 			ast_log(LOG_DEBUG, "Nobody there, continuing...\n"); 
 			if (c0->_softhangup == AST_SOFTHANGUP_UNBRIDGE || c1->_softhangup == AST_SOFTHANGUP_UNBRIDGE) {
 				if (c0->_softhangup == AST_SOFTHANGUP_UNBRIDGE)
@@ -3405,10 +3408,13 @@
 			
 			if (!to) {
 				if (time_left_ms >= 5000) {
+					/* force the time left to round up if appropriate */
 					if (caller_warning && config->warning_sound && config->play_warning)
-						bridge_playfile(c0, c1, config->warning_sound, time_left_ms / 1000);
+						bridge_playfile(c0, c1, config->warning_sound,
+								(time_left_ms + 500) / 1000);
 					if (callee_warning && config->warning_sound && config->play_warning)
-						bridge_playfile(c1, c0, config->warning_sound, time_left_ms / 1000);
+						bridge_playfile(c1, c0, config->warning_sound,
+								(time_left_ms + 500) / 1000);
 				}
 				if (config->warning_freq) {
 					nexteventts = ast_tvadd(nexteventts, ast_samp2tv(config->warning_freq, 1000));
@@ -3509,7 +3515,7 @@
 			o0nativeformats = c0->nativeformats;
 			o1nativeformats = c1->nativeformats;
 		}
-		res = ast_generic_bridge(c0, c1, config, fo, rc, to);
+		res = ast_generic_bridge(c0, c1, config, fo, rc, nexteventts);
 		if (res != AST_BRIDGE_RETRY)
 			break;
 	}



More information about the svn-commits mailing list