diff options
author | anthm <anthm@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-05-06 22:29:00 +0000 |
---|---|---|
committer | anthm <anthm@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-05-06 22:29:00 +0000 |
commit | cf3caca69465019deb9ae8aa181f6bfb820f7d89 (patch) | |
tree | afd76a20254a738868dec3cc40984d9383920df2 /channel.c | |
parent | 7906a09bfb4793f4577249b8b865bb7894927d40 (diff) |
make channel.c use autoservice_start/stop when playing warning sound files
during bridged calls.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2913 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rwxr-xr-x | channel.c | 24 |
1 files changed, 15 insertions, 9 deletions
@@ -2334,10 +2334,14 @@ static long tvdiff(struct timeval *now, struct timeval *then) return (((now->tv_sec * 1000) + now->tv_usec / 1000) - ((then->tv_sec * 1000) + then->tv_usec / 1000)); } -static void bridge_playfile(struct ast_channel *chan, char *sound, int remain) +static void bridge_playfile(struct ast_channel *chan, struct ast_channel *peer, char *sound, int remain) { - int res=0, min=0, sec=0; - + int res=0, min=0, sec=0,check=0; + + check = ast_autoservice_start(peer); + if(check) + return; + if (remain > 0) { if (remain / 60 > 1) { min = remain / 60; @@ -2364,6 +2368,8 @@ static void bridge_playfile(struct ast_channel *chan, char *sound, int remain) res = ast_streamfile(chan, sound, chan->language); res = ast_waitstream(chan, ""); } + + check = ast_autoservice_stop(peer); } int ast_channel_bridge(struct ast_channel *c0, struct ast_channel *c1, struct ast_bridge_config *config, struct ast_frame **fo, struct ast_channel **rc) @@ -2388,9 +2394,9 @@ int ast_channel_bridge(struct ast_channel *c0, struct ast_channel *c1, struct as time_left_ms = config->timelimit; if (config->play_to_caller && config->start_sound) - bridge_playfile(c0,config->start_sound,time_left_ms / 1000); + bridge_playfile(c0,c1,config->start_sound,time_left_ms / 1000); if (config->play_to_callee && config->start_sound) - bridge_playfile(c1,config->start_sound,time_left_ms / 1000); + bridge_playfile(c1,c0,config->start_sound,time_left_ms / 1000); /* Stop if we're a zombie or need a soft hangup */ if (c0->zombie || ast_check_hangup_locked(c0) || c1->zombie || ast_check_hangup_locked(c1)) @@ -2443,9 +2449,9 @@ int ast_channel_bridge(struct ast_channel *c0, struct ast_channel *c1, struct as } if (time_left_ms <= 0) { if (config->play_to_caller && config->end_sound) - bridge_playfile(c0,config->end_sound,0); + bridge_playfile(c0,c1,config->end_sound,0); if (config->play_to_callee && config->end_sound) - bridge_playfile(c1,config->end_sound,0); + bridge_playfile(c1,c0,config->end_sound,0); *fo = NULL; if (who) *rc = who; res = 0; @@ -2453,9 +2459,9 @@ int ast_channel_bridge(struct ast_channel *c0, struct ast_channel *c1, struct as } if (time_left_ms >= 5000 && playit) { if (config->play_to_caller && config->warning_sound && config->play_warning) - bridge_playfile(c0,config->warning_sound,time_left_ms / 1000); + bridge_playfile(c0,c1,config->warning_sound,time_left_ms / 1000); if (config->play_to_callee && config->warning_sound && config->play_warning) - bridge_playfile(c1,config->warning_sound,time_left_ms / 1000); + bridge_playfile(c1,c0,config->warning_sound,time_left_ms / 1000); playit = 0; } |