aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_controlplayback.c
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-01-30 19:03:16 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-01-30 19:03:16 +0000
commit32f90215c3ca73b65d91a4615a5d8932e77476b4 (patch)
treec0044af8d54049128ec80f036b58f54f841c7615 /apps/app_controlplayback.c
parent4e78a9454e02957a01f92e9cefb9793b3846e4b5 (diff)
Allow disabling the default ffwd/rewind keys in the ControlPlayback application.
This is done in a backward compat way. If the "default" key for ffwd/rew is used for another option (such as stop), the "default" is removed. (closes issue #11754) Reported by: johan Patches: app_controlplayback.c.option3.patch uploaded by johan (license 334) Tested by: johan, qwell git-svn-id: http://svn.digium.com/svn/asterisk/trunk@101296 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_controlplayback.c')
-rw-r--r--apps/app_controlplayback.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/apps/app_controlplayback.c b/apps/app_controlplayback.c
index b6dfd898e..85bcf7b92 100644
--- a/apps/app_controlplayback.c
+++ b/apps/app_controlplayback.c
@@ -78,6 +78,17 @@ static int is_on_phonepad(char key)
return key == 35 || key == 42 || (key >= 48 && key <= 57);
}
+static int is_argument(const char *haystack, int needle)
+{
+ if (ast_strlen_zero(haystack))
+ return 0;
+
+ if (strchr(haystack, needle))
+ return -1;
+
+ return 0;
+}
+
static int controlplayback_exec(struct ast_channel *chan, void *data)
{
int res = 0;
@@ -114,10 +125,21 @@ static int controlplayback_exec(struct ast_channel *chan, void *data)
skipms = args.skip ? (atoi(args.skip) ? atoi(args.skip) : 3000) : 3000;
- if (!args.fwd || !is_on_phonepad(*args.fwd))
- args.fwd = "#";
- if (!args.rev || !is_on_phonepad(*args.rev))
- args.rev = "*";
+ if (!args.fwd || !is_on_phonepad(*args.fwd)) {
+ char *digit = "#";
+ if (!is_argument(args.rev, *digit) && !is_argument(args.stop, *digit) && !is_argument(args.pause, *digit) && !is_argument(args.restart, *digit))
+ args.fwd = digit;
+ else
+ args.fwd = NULL;
+ }
+ if (!args.rev || !is_on_phonepad(*args.rev)) {
+ char *digit = "*";
+ if (!is_argument(args.fwd, *digit) && !is_argument(args.stop, *digit) && !is_argument(args.pause, *digit) && !is_argument(args.restart, *digit))
+ args.rev = digit;
+ else
+ args.rev = NULL;
+ }
+ ast_log(LOG_WARNING, "args.fwd = %s, args.rew = %s\n", args.fwd, args.rev);
if (args.stop && !is_on_phonepad(*args.stop))
args.stop = NULL;
if (args.pause && !is_on_phonepad(*args.pause))