[Asterisk-cvs] asterisk channel.c,1.107,1.108

anthm at lists.digium.com anthm at lists.digium.com
Thu May 6 18:20:13 CDT 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv12055

Modified Files:
	channel.c 
Log Message:
make channel.c use autoservice_start/stop when playing warning sound files
during bridged calls.


Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- channel.c	6 May 2004 21:04:22 -0000	1.107
+++ channel.c	6 May 2004 22:29:00 -0000	1.108
@@ -2334,10 +2334,14 @@
 	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 @@
 		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 @@
 	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 @@
 			}
 			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 @@
 			}
 			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;
 			}
 			




More information about the svn-commits mailing list