[asterisk-commits] mnicholson: branch irroot/t38gateway-1.8 r333926 - /team/irroot/t38gateway-1....

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


Author: mnicholson
Date: Tue Aug 30 09:27:33 2011
New Revision: 333926

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=333926
Log:
Replaced FAXOPT(gwtimeout) with a second parameter to FAXOPT(gateway).

Patch by: irroot
Review: https://reviewboard.asterisk.org/r/1385/
ASTERISK-18219

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

Modified: team/irroot/t38gateway-1.8/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/t38gateway-1.8/res/res_fax.c?view=diff&rev=333926&r1=333925&r2=333926
==============================================================================
--- team/irroot/t38gateway-1.8/res/res_fax.c (original)
+++ team/irroot/t38gateway-1.8/res/res_fax.c Tue Aug 30 09:27:33 2011
@@ -184,10 +184,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>
@@ -470,7 +467,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;
 }
@@ -3744,8 +3741,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")) {
@@ -3823,6 +3818,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);
@@ -3841,18 +3849,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