[Asterisk-cvs] asterisk/apps app_controlplayback.c, 1.7, 1.8 app_playback.c, 1.14, 1.15

markster at lists.digium.com markster at lists.digium.com
Mon Oct 25 22:22:20 CDT 2004


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

Modified Files:
	app_controlplayback.c app_playback.c 
Log Message:
Add n+101 jump if file does not exist (bug #2722)


Index: app_controlplayback.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_controlplayback.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- app_controlplayback.c	22 Jun 2004 19:32:52 -0000	1.7
+++ app_controlplayback.c	26 Oct 2004 02:25:50 -0000	1.8
@@ -35,7 +35,7 @@
 "  be included following a pipe symbol.  You can use * and # to rewind and\n"
 "  fast forward the playback specified. If 'stopchar' is added the file will\n"
 "  terminate playback when 'stopchar' is pressed. Returns -1 if the channel\n"
-"  was hung up, or if the file does not exist. Returns 0 otherwise.\n\n"
+"  was hung up. if the file does not exist jumps to n+101 if it present.\n\n"
 "  Example:  exten => 1234,1,ControlPlayback(file|4000|*|#|1|0)\n\n";
 
 STANDARD_LOCAL_USER;
@@ -54,6 +54,7 @@
 	struct localuser *u;
 	char tmp[256];
 	char *skip = NULL, *fwd = NULL, *rev = NULL, *stop = NULL, *pause = NULL, *file = NULL;
+	
 
 	if (!data || ast_strlen_zero((char *)data)) {
 		ast_log(LOG_WARNING, "ControlPlayback requires an argument (filename)\n");
@@ -110,7 +111,12 @@
 	/* If we stopped on one of our stop keys, return 0  */
 	if(stop && strchr(stop, res)) 
 		res = 0;
-	
+
+	if(res < 0) {
+		if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
+            chan->priority+=100;
+		res = 0;
+	}
 	return res;
 }
 

Index: app_playback.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_playback.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- app_playback.c	19 Jul 2004 02:18:11 -0000	1.14
+++ app_playback.c	26 Oct 2004 02:25:50 -0000	1.15
@@ -36,8 +36,8 @@
 "specified, the application will return immediately should the channel not be\n"
 "off hook.  Otherwise, unless 'noanswer' is specified, the channel channel will\n"
 "be answered before the sound is played. Not all channels support playing\n"
-"messages while still hook. Returns -1 if the channel was hung up, or if the\n"
-"file does not exist. Returns 0 otherwise.\n";
+"messages while still hook. Returns -1 if the channel was hung up.  If the\n"
+"file does not exist, will jump to priority n+101 if present.\n";
 
 STANDARD_LOCAL_USER;
 
@@ -81,6 +81,8 @@
 			res = ast_waitstream(chan, "");
 		else {
 			ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char *)data);
+			if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
+				chan->priority+=100;
 			res = 0;
 		}
 		ast_stopstream(chan);




More information about the svn-commits mailing list