diff --git a/apps/app_controlplayback.c b/apps/app_controlplayback.c index 80df5926de13c3f4ed3fe702fa2f8a53f2efd6a3..edf10a18202e7fe189104d1afbf084b917b9c349 100644 --- a/apps/app_controlplayback.c +++ b/apps/app_controlplayback.c @@ -124,7 +124,7 @@ static int controlplayback_exec(struct ast_channel *chan, void *data) if (args.options) { ast_app_parse_options(cpb_opts, &opts, opt_args, args.options); - if (ast_test_flag(&opts, OPT_OFFSET) && !ast_strlen_zero(opt_args[OPT_ARG_OFFSET])) + if (ast_test_flag(&opts, OPT_OFFSET)) offsetms = atol(opt_args[OPT_ARG_OFFSET]); } diff --git a/main/app.c b/main/app.c index fd286fa172dbf1b41cca9b67dab1e2a044b041ab..4fda65ce0d91fe0d762449ac5741247e425afbe8 100644 --- a/main/app.c +++ b/main/app.c @@ -1608,7 +1608,6 @@ int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags s = optstr; while (*s) { curarg = *s++ & 0x7f; /* the array (in app.h) has 128 entries */ - ast_set_flag(flags, options[curarg].flag); argloc = options[curarg].arg_index; if (*s == '(') { /* Has argument */ @@ -1625,6 +1624,8 @@ int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags } else if (argloc) { args[argloc - 1] = NULL; } + if (!argloc || !ast_strlen_zero(args[argloc - 1])) + ast_set_flag(flags, options[curarg].flag); } return res;