aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_controlplayback.c
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-11 21:17:37 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-11 21:17:37 +0000
commitbc610bd4711db0349fa7a455a24e78297b0a152c (patch)
treec446c468d7000fc28e6f2f0ebf9b195dad8ce9f5 /apps/app_controlplayback.c
parentc79944aab87cec708c095761bdcb6b051d9ad32d (diff)
Add variable to show which key was pressed to stop playback.
Issue #11377, initial patch by johan. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@92401 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_controlplayback.c')
-rw-r--r--apps/app_controlplayback.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/app_controlplayback.c b/apps/app_controlplayback.c
index edf10a182..b6dfd898e 100644
--- a/apps/app_controlplayback.c
+++ b/apps/app_controlplayback.c
@@ -55,7 +55,9 @@ static const char *descrip =
" 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 @@ static int controlplayback_exec(struct ast_channel *chan, void *data)
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 @@ static int controlplayback_exec(struct ast_channel *chan, void *data)
/* If we stopped on one of our stop keys, return 0 */
if (res > 0 && args.stop && strchr(args.stop, res)) {
- res = 0;
pbx_builtin_setvar_helper(chan, "CPLAYBACKSTATUS", "USERSTOPPED");
+ snprintf(stopkeybuf, sizeof(stopkeybuf), "%c", res);
+ pbx_builtin_setvar_helper(chan, "CPLAYBACKSTOPKEY", stopkeybuf);
+ res = 0;
} else {
if (res < 0) {
res = 0;