[asterisk-commits] irroot: branch irroot/t38gateway-trunk r333336 - /team/irroot/t38gateway-trun...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 26 04:42:55 CDT 2011


Author: irroot
Date: Fri Aug 26 04:42:52 2011
New Revision: 333336

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=333336
Log:
Use sscanf for waitfax parameters

Modified:
    team/irroot/t38gateway-trunk/res/res_fax.c

Modified: team/irroot/t38gateway-trunk/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/t38gateway-trunk/res/res_fax.c?view=diff&rev=333336&r1=333335&r2=333336
==============================================================================
--- team/irroot/t38gateway-trunk/res/res_fax.c (original)
+++ team/irroot/t38gateway-trunk/res/res_fax.c Fri Aug 26 04:42:52 2011
@@ -3143,8 +3143,6 @@
 			f = ast_dsp_process(chan, dsp, f);
 			if ((f->frametype ==  AST_FRAME_DTMF) && (f->subclass.integer == 'f')) {
 				res = 1;
-				ast_dsp_free(dsp);
-				dsp = NULL;
 			} else if ((f->frametype == AST_FRAME_VOICE) && (noiselim > 0)) {
 				ast_dsp_noise(dsp, f, &dspnoise);
 				if (dspnoise > noiselim) {
@@ -3199,8 +3197,8 @@
 static int waitfax_exec(struct ast_channel *chan, const char *data)
 {
 	int res = 0;
-	int timeout = 0;
-	int noiselim = 0;
+	unsigned int timeout;
+	unsigned int noiselim;
 	int ptres = -1;
 	char *parse;
 	struct ast_fax_session_details *details;
@@ -3221,12 +3219,10 @@
 	parse = ast_strdupa(data);
 	AST_STANDARD_APP_ARGS(args, parse);
 
-	if (args.timeout) {
-		timeout = atoi(args.timeout) * 1000;
-	}
-
-	if (args.noise) {
-		noiselim = atoi(args.noise);
+	if (!ast_strlen_zero(args.timeout) && sscanf(args.timeout, "%u", &timeout) == 1) {
+		timeout = timeout * 1000;
+	} else {
+		timeout = 0;
 	}
 
 	if (timeout <= 0) {
@@ -3235,6 +3231,10 @@
 		ast_log(LOG_ERROR, "Application WaitFAX requires a valid timeout\n");
 		ao2_ref(details, -1);
 		return 0;
+	}
+
+	if (ast_strlen_zero(args.noise) || sscanf(args.noise, "%u", &noiselim) != 1) {
+		noiselim = 0;
 	}
 
 	if (chan->_state != AST_STATE_UP) {




More information about the asterisk-commits mailing list