[asterisk-commits] mnicholson: trunk r333896 - in /trunk: ./ res/res_fax.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 30 09:03:09 CDT 2011


Author: mnicholson
Date: Tue Aug 30 09:03:02 2011
New Revision: 333896

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=333896
Log:
Merged revisions 333895 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/10

........
  r333895 | mnicholson | 2011-08-30 09:01:31 -0500 (Tue, 30 Aug 2011) | 6 lines
  
  Replaced FAXOPT(gwtimeout) with a second parameter to FAXOPT(gateway).
  
  Patch by: irroot
  Review: https://reviewboard.asterisk.org/r/1385/
  ASTERISK-18219
........

Modified:
    trunk/   (props changed)
    trunk/res/res_fax.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: trunk/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_fax.c?view=diff&rev=333896&r1=333895&r2=333896
==============================================================================
--- trunk/res/res_fax.c (original)
+++ trunk/res/res_fax.c Tue Aug 30 09:03:02 2011
@@ -190,10 +190,7 @@
 						<para>R/W Modem type (v17/v27/v29).</para>
 					</enum>
 					<enum name="gateway">
-						<para>R/W T38 Gateway Enabled (yes/no)</para>
-					</enum>
-					<enum name="gwtimeout">
-						<para>R/W Gateway fax activity timeout in seconds (yes/no/seconds)</para>
+						<para>R/W T38 fax gateway, with optional fax activity timeout in seconds (yes[,timeout]/no)</para>
 					</enum>
 					<enum name="pages">
 						<para>R/O Number of pages transferred.</para>
@@ -455,7 +452,7 @@
 	d->minrate = general_options.minrate;
 	d->maxrate = general_options.maxrate;
 	d->gateway_id = -1;
-	d->gateway_timeout = FAX_GATEWAY_TIMEOUT;
+	d->gateway_timeout = 0;
 
 	return d;
 }
@@ -2906,12 +2903,12 @@
 
 	if (gateway->bridged && !ast_tvzero(gateway->timeout_start)) {
 		if (ast_tvdiff_ms(ast_tvnow(), gateway->timeout_start) > details->gateway_timeout) {
-			ast_debug(1, "no fax activity between %s and %s after %d ms, disabling gateway\n", chan->name, peer->name, FAX_GATEWAY_TIMEOUT);
+			ast_debug(1, "no fax activity between %s and %s after %d ms, disabling gateway\n", chan->name, peer->name, details->gateway_timeout);
 			ast_framehook_detach(chan, gateway->framehook);
 			details->gateway_id = -1;
 
 			ast_string_field_set(details, result, "FAILED");
-			ast_string_field_build(details, resultstr, "no fax activity after %d ms", FAX_GATEWAY_TIMEOUT);
+			ast_string_field_build(details, resultstr, "no fax activity after %d ms", details->gateway_timeout);
 			ast_string_field_set(details, error, "TIMEOUT");
 			set_channel_variables(chan, details);
 			ao2_ref(details, -1);
@@ -3472,8 +3469,6 @@
 	} else if (!strcasecmp(data, "t38gateway") || !strcasecmp(data, "gateway") ||
 		   !strcasecmp(data, "t38_gateway") || !strcasecmp(data, "faxgateway")) {
 		ast_copy_string(buf, details->gateway_id != -1 ? "yes" : "no", len);
-	} else if (!strcasecmp(data, "gwtimeout")) {
-		snprintf(buf, len, "%d", details->gateway_timeout / 1000);
 	} else if (!strcasecmp(data, "error")) {
 		ast_copy_string(buf, details->error, len);
 	} else if (!strcasecmp(data, "filename")) {
@@ -3551,6 +3546,19 @@
 	} else if (!strcasecmp(data, "t38gateway") || !strcasecmp(data, "gateway") ||
 		   !strcasecmp(data, "t38_gateway") || !strcasecmp(data, "faxgateway")) {
 		const char *val = ast_skip_blanks(value);
+		char *timeout = strchr(val, ',');
+
+		details->gateway_timeout = 0;
+		if (timeout) {
+			unsigned int gwtimeout;
+			*timeout++ = '\0';
+			if (sscanf(timeout, "%u", &gwtimeout) == 1) {
+				details->gateway_timeout = gwtimeout * 1000;
+			} else {
+				ast_log(LOG_WARNING, "Unsupported timeout '%s' passed to FAXOPT(%s).\n", timeout, data);
+			}
+		}
+
 		if (ast_true(val)) {
 			if (details->gateway_id < 0) {
 				details->gateway_id = fax_gateway_attach(chan, details);
@@ -3569,18 +3577,6 @@
 		} else {
 			ast_log(LOG_WARNING, "Unsupported value '%s' passed to FAXOPT(%s).\n", value, data);
 		}
-	} else if (!strcasecmp(data, "gwtimeout")) {
-		const char *val = ast_skip_blanks(value);
-		int timeout;
-		if (ast_true(val)) {
-			details->gateway_timeout = FAX_GATEWAY_TIMEOUT;
-		} else if (ast_false(val)) {
-			details->gateway_timeout = 0;
-		} else if (sscanf(val, "%d", &timeout) == 1 && timeout > 0) {
-			details->gateway_timeout = timeout * 1000;
-		} else {
-			ast_log(LOG_WARNING, "Unsupported value '%s' passed to FAXOPT(%s).\n", value, data);
-		}
 	} 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