[Asterisk-code-review] res_tonedetect: Fixes some logic issues and typos (asterisk[18])
Joshua Colp
asteriskteam at digium.com
Mon Jan 31 08:55:41 CST 2022
Joshua Colp has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/17933 )
Change subject: res_tonedetect: Fixes some logic issues and typos
......................................................................
res_tonedetect: Fixes some logic issues and typos
Fixes some minor logic issues with the module:
Previously, the OPT_END_FILTER flag was getting
tested before options were parsed, so it could
never evaluate to true (wrong ordering).
Additionally, the initially parsed timeout (float)
needs to be compared with 0, not the result int
which is set afterwards (wrong variable).
ASTERISK-29857 #close
Change-Id: I0062bce3b391c15e5df7a714780eeaa96dd93d4c
---
M res/res_tonedetect.c
1 file changed, 4 insertions(+), 4 deletions(-)
Approvals:
George Joseph: Looks good to me, approved
Joshua Colp: Approved for Submit
diff --git a/res/res_tonedetect.c b/res/res_tonedetect.c
index b65a69b..4943f69 100644
--- a/res/res_tonedetect.c
+++ b/res/res_tonedetect.c
@@ -596,12 +596,12 @@
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
- if (ast_test_flag(&flags, OPT_END_FILTER)) {
- return remove_detect(chan);
- }
if (!ast_strlen_zero(args.options)) {
ast_app_parse_options(td_opts, &flags, opt_args, args.options);
}
+ if (ast_test_flag(&flags, OPT_END_FILTER)) {
+ return remove_detect(chan);
+ }
if (freq_parser(args.freqs, &freq1, &freq2)) {
return -1;
}
@@ -739,7 +739,7 @@
pbx_builtin_setvar_helper(chan, "WAITFORTONESTATUS", "ERROR");
return -1;
}
- if (!ast_strlen_zero(args.timeout) && (sscanf(args.timeout, "%30lf", &timeoutf) != 1 || timeout < 0)) {
+ if (!ast_strlen_zero(args.timeout) && (sscanf(args.timeout, "%30lf", &timeoutf) != 1 || timeoutf < 0)) {
ast_log(LOG_WARNING, "Invalid timeout: %s\n", args.timeout);
pbx_builtin_setvar_helper(chan, "WAITFORTONESTATUS", "ERROR");
return -1;
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/17933
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I0062bce3b391c15e5df7a714780eeaa96dd93d4c
Gerrit-Change-Number: 17933
Gerrit-PatchSet: 2
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220131/5908ba7a/attachment-0001.html>
More information about the asterisk-code-review
mailing list