mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	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
This commit is contained in:
		
				
					committed by
					
						 Joshua Colp
						Joshua Colp
					
				
			
			
				
	
			
			
			
						parent
						
							7ae8321925
						
					
				
				
					commit
					70f8ea0d1a
				
			| @@ -596,12 +596,12 @@ static int detect_write(struct ast_channel *chan, const char *cmd, char *data, c | ||||
| 	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 @@ static int wait_exec(struct ast_channel *chan, const char *data) | ||||
| 		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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user