aboutsummaryrefslogtreecommitdiffstats
path: root/channel.c
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-16 16:04:24 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-16 16:04:24 +0000
commitebd45fb7683af558e22eb8e0e16bce02a89ac535 (patch)
treeb9f87805d7fdf068bdfd3fe6715b11de84627843 /channel.c
parent8afb9a9b5e6718a79b535286a0ddfa54ee0c2183 (diff)
move common conditions to the outside block.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@20540 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rw-r--r--channel.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/channel.c b/channel.c
index 8dbf884db..9d0efd52b 100644
--- a/channel.c
+++ b/channel.c
@@ -3465,10 +3465,10 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
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 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
}
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));