[svn-commits] qwell: trunk r92401 - /trunk/apps/app_controlplayback.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Dec 11 15:17:38 CST 2007


Author: qwell
Date: Tue Dec 11 15:17:37 2007
New Revision: 92401

URL: http://svn.digium.com/view/asterisk?view=rev&rev=92401
Log:
Add variable to show which key was pressed to stop playback.

Issue #11377, initial patch by johan.

Modified:
    trunk/apps/app_controlplayback.c

Modified: trunk/apps/app_controlplayback.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_controlplayback.c?view=diff&rev=92401&r1=92400&r2=92401
==============================================================================
--- trunk/apps/app_controlplayback.c (original)
+++ trunk/apps/app_controlplayback.c Tue Dec 11 15:17:37 2007
@@ -55,7 +55,9 @@
 "  CPLAYBACKSTATUS -  This variable contains the status of the attempt as a text\n"
 "                     string, one of: SUCCESS | USERSTOPPED | ERROR\n"
 "  CPLAYBACKOFFSET -  This contains the offset in ms into the file where\n"
-"                     playback was at when it stopped.  -1 is end of file.\n";
+"                     playback was at when it stopped.  -1 is end of file.\n"
+"  CPLAYBACKSTOPKEY - If the playback is stopped by the user this variable contains\n"
+"                     the key that was pressed.\n";
 
 enum {
 	OPT_OFFSET = (1 << 1),
@@ -82,6 +84,7 @@
 	int skipms = 0;
 	long offsetms = 0;
 	char offsetbuf[20];
+	char stopkeybuf[2];
 	char *tmp;
 	struct ast_flags opts = { 0, };
 	char *opt_args[OPT_ARG_ARRAY_LEN];
@@ -132,8 +135,10 @@
 
 	/* If we stopped on one of our stop keys, return 0  */
 	if (res > 0 && args.stop && strchr(args.stop, res)) {
+		pbx_builtin_setvar_helper(chan, "CPLAYBACKSTATUS", "USERSTOPPED");
+		snprintf(stopkeybuf, sizeof(stopkeybuf), "%c", res);
+		pbx_builtin_setvar_helper(chan, "CPLAYBACKSTOPKEY", stopkeybuf);
 		res = 0;
-		pbx_builtin_setvar_helper(chan, "CPLAYBACKSTATUS", "USERSTOPPED");
 	} else {
 		if (res < 0) {
 			res = 0;




More information about the svn-commits mailing list