[Asterisk-cvs] asterisk app.c,1.71,1.72

kpfleming kpfleming
Mon Aug 22 15:04:36 CDT 2005


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

Modified Files:
	app.c 
Log Message:
add 'restart' character to ast_control_playback function and ControlPlayback() application (issue #4693)
rework app_controlplayback.c to take into account all Asterisk 1.2 coding style requirements


Index: app.c
===================================================================
RCS file: /usr/cvsroot/asterisk/app.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- app.c	6 Aug 2005 16:52:56 -0000	1.71
+++ app.c	22 Aug 2005 19:06:42 -0000	1.72
@@ -406,7 +406,10 @@
 	return res;
 }
 
-int ast_control_streamfile(struct ast_channel *chan, const char *file, const char *fwd, const char *rev, const char *stop, const char *pause, int skipms) 
+int ast_control_streamfile(struct ast_channel *chan, const char *file,
+			   const char *fwd, const char *rev,
+			   const char *stop, const char *pause,
+			   const char *restart, int skipms) 
 {
 	long elapsed = 0,last_elapsed =0;
 	char *breaks=NULL;
@@ -418,12 +421,18 @@
 		blen += strlen(stop);
 	if (pause)
 		blen += strlen(pause);
+	if (restart)
+		blen += strlen(restart);
 
 	if (blen > 2) {
 		breaks = alloca(blen + 1);
 		breaks[0] = '\0';
-		strcat(breaks, stop);
-		strcat(breaks, pause);
+		if (stop)
+			strcat(breaks, stop);
+		if (pause)
+			strcat(breaks, pause);
+		if (restart)
+			strcat(breaks, restart);
 	}
 	if (chan->_state != AST_STATE_UP)
 		res = ast_answer(chan);
@@ -466,6 +475,13 @@
 		if (res < 1)
 			break;
 
+		/* We go at next loop if we got the restart char */
+		if (restart && strchr(restart, res)) {
+			ast_log(LOG_DEBUG, "we'll restart the stream here at next loop\n");
+			elapsed=0; /* To make sure the next stream will start at beginning */
+			continue;
+		}
+
 		if (pause != NULL && strchr(pause, res)) {
 			elapsed = ast_tvdiff_ms(ast_tvnow(), started) + last_elapsed;
 			for(;;) {




More information about the svn-commits mailing list