[svn-commits] trunk r20540 - /trunk/channel.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sun Apr 16 09:04:27 MST 2006


Author: rizzo
Date: Sun Apr 16 11:04:24 2006
New Revision: 20540

URL: http://svn.digium.com/view/asterisk?rev=20540&view=rev
Log:
move common conditions to the outside block.


Modified:
    trunk/channel.c

Modified: trunk/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/channel.c?rev=20540&r1=20539&r2=20540&view=diff
==============================================================================
--- trunk/channel.c (original)
+++ trunk/channel.c Sun Apr 16 11:04:24 2006
@@ -3465,10 +3465,10 @@
 			if (time_left_ms < to)
 				to = time_left_ms;
 
-			if (time_left_ms <= 0) {
-				if (caller_warning && config->end_sound)
+			if (time_left_ms <= 0 && config->end_sound) {
+				if (caller_warning)
 					bridge_playfile(c0, c1, config->end_sound, 0);
-				if (callee_warning && config->end_sound)
+				if (callee_warning)
 					bridge_playfile(c1, c0, config->end_sound, 0);
 				*fo = NULL;
 				if (who)
@@ -3478,14 +3478,12 @@
 			}
 			
 			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 + 500) / 1000);
-					if (callee_warning && config->warning_sound && config->play_warning)
-						bridge_playfile(c1, c0, config->warning_sound,
-								(time_left_ms + 500) / 1000);
+				if (time_left_ms >= 5000 && config->warning_sound && config->play_warning) {
+					int t = (time_left_ms + 500) / 1000; /* round to nearest second */
+					if (caller_warning)
+						bridge_playfile(c0, c1, config->warning_sound, t);
+					if (callee_warning)
+						bridge_playfile(c1, c0, config->warning_sound, t);
 				}
 				if (config->warning_freq) {
 					nexteventts = ast_tvadd(nexteventts, ast_samp2tv(config->warning_freq, 1000));



More information about the svn-commits mailing list