diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-03-15 22:48:38 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-03-15 22:48:38 +0000 |
commit | 0727ec7bdf784bef41b768f80fbb54b1a8f45113 (patch) | |
tree | 1fbf016e8483f9f2b0f53c2966027ec62ca0b4a6 /res | |
parent | b40e92597ab55df5b8483f7fd2cb9def8b59b34b (diff) |
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.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@252709 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r-- | res/res_fax.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/res/res_fax.c b/res/res_fax.c index e37fe1ded..55e30b0c2 100644 --- a/res/res_fax.c +++ b/res/res_fax.c @@ -1775,7 +1775,14 @@ static int acf_faxopt_write(struct ast_channel *chan, const char *cmd, char *dat 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")) { |