[svn-commits] russell: branch russell/sla_updates r54637 - /team/russell/sla_updates/apps/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Feb 15 10:05:49 MST 2007


Author: russell
Date: Thu Feb 15 11:05:48 2007
New Revision: 54637

URL: http://svn.digium.com/view/asterisk?view=rev&rev=54637
Log:
Fix some logic dealing with calculating trunk ring timeouts

Modified:
    team/russell/sla_updates/apps/app_meetme.c

Modified: team/russell/sla_updates/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/russell/sla_updates/apps/app_meetme.c?view=diff&rev=54637&r1=54636&r2=54637
==============================================================================
--- team/russell/sla_updates/apps/app_meetme.c (original)
+++ team/russell/sla_updates/apps/app_meetme.c Thu Feb 15 11:05:48 2007
@@ -3332,18 +3332,23 @@
 	free(ringing_trunk);
 }
 
+/*! \brief Calculate the time until the next known event
+ *  \note Called with sla.lock locked */
 static int sla_calc_timeout(struct timespec *ts)
 {
 	struct sla_ringing_trunk *ringing_trunk;
+	struct sla_ringing_station *ringing_station;
 	unsigned int timeout = UINT_MAX;
 	struct timeval tv;
 	unsigned int trunk_stopped = 0;
 
+	/* Check for ring timeouts on ringing trunks */
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_trunks, ringing_trunk, entry) {
-		int time_left;
+		int time_left, time_elapsed;
 		if (!ringing_trunk->trunk->ring_timeout)
 			continue;
-		time_left = ast_tvdiff_ms(ast_tvnow(), ringing_trunk->ring_begin);
+		time_elapsed = ast_tvdiff_ms(ast_tvnow(), ringing_trunk->ring_begin);
+		time_left = (ringing_trunk->trunk->ring_timeout * 1000) - time_elapsed;
 		if (time_left <= 0) {
 			AST_LIST_REMOVE_CURRENT(&sla.ringing_trunks, entry);
 			sla_stop_ringing_trunk(ringing_trunk);
@@ -3352,6 +3357,12 @@
 		}
 		if (time_left < timeout)
 			timeout = time_left;
+	}
+	AST_LIST_TRAVERSE_SAFE_END
+
+	/* Check for ring timeouts on ringing stations */
+	AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_stations, ringing_station, entry) {
+
 	}
 	AST_LIST_TRAVERSE_SAFE_END
 
@@ -3375,10 +3386,11 @@
 	unsigned int trunk_stopped = 0;
 
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_trunks, ringing_trunk, entry) {
-		int time_left;
+		int time_left, time_elapsed;
 		if (!ringing_trunk->trunk->ring_timeout)
 			continue;
-		time_left = ast_tvdiff_ms(ast_tvnow(), ringing_trunk->ring_begin);
+		time_elapsed = ast_tvdiff_ms(ast_tvnow(), ringing_trunk->ring_begin);
+		time_left = (ringing_trunk->trunk->ring_timeout * 1000) - time_elapsed;
 		if (time_left <= 0) {
 			AST_LIST_REMOVE_CURRENT(&sla.ringing_trunks, entry);
 			sla_stop_ringing_trunk(ringing_trunk);



More information about the svn-commits mailing list