[asterisk-commits] kpfleming: trunk r252709 - /trunk/res/res_fax.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 15 17:48:42 CDT 2010


Author: kpfleming
Date: Mon Mar 15 17:48:38 2010
New Revision: 252709

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=252709
Log:
Improve handling of values supplied to FAXOPT(ecm).

Previously, values that began with whitespace were silently treated as 'no',
and all non-'yes' values were also treated as 'no'. Now the supplied value
is specifically checked for a 'yes' or 'no' (or equivalent) value, after skipping
leading whitespace. If the value is not valid, then a warning message is generated.


Modified:
    trunk/res/res_fax.c

Modified: trunk/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_fax.c?view=diff&rev=252709&r1=252708&r2=252709
==============================================================================
--- trunk/res/res_fax.c (original)
+++ trunk/res/res_fax.c Mon Mar 15 17:48:38 2010
@@ -1775,7 +1775,14 @@
 	ast_debug(3, "channel '%s' setting FAXOPT(%s) to '%s'\n", chan->name, data, value);
 
 	if (!strcasecmp(data, "ecm")) {
-		details->option.ecm = ast_true(value) ? 1 : 0;
+		const char *val = ast_skip_blanks(value);
+		if (ast_true(val)) {
+			details->option.ecm = AST_FAX_OPTFLAG_TRUE;
+		} else if (ast_false(val)) {
+			details->option.ecm = AST_FAX_OPTFLAG_FALSE;
+		} else {
+			ast_log(LOG_WARNING, "Unsupported value '%s' passed to FAXOPT(ecm).\n", value);
+		}
 	} else if (!strcasecmp(data, "headerinfo")) {
 		ast_string_field_set(details, headerinfo, value);
 	} else if (!strcasecmp(data, "localstationid")) {




More information about the asterisk-commits mailing list