[svn-commits] irroot: branch irroot/distrotech-customers-1.8 r333692 - /team/irroot/distrot...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Aug 29 12:44:52 CDT 2011


Author: irroot
Date: Mon Aug 29 12:44:48 2011
New Revision: 333692

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=333692
Log:
Remove gwtimeout option from t38 gateway

Modified:
    team/irroot/distrotech-customers-1.8/res/res_fax.c

Modified: team/irroot/distrotech-customers-1.8/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/res/res_fax.c?view=diff&rev=333692&r1=333691&r2=333692
==============================================================================
--- team/irroot/distrotech-customers-1.8/res/res_fax.c (original)
+++ team/irroot/distrotech-customers-1.8/res/res_fax.c Mon Aug 29 12:44:48 2011
@@ -186,9 +186,6 @@
 					<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>
-					</enum>
 					<enum name="pages">
 						<para>R/O Number of pages transferred.</para>
 					</enum>
@@ -2511,7 +2508,7 @@
 	ast_dsp_set_faxmode(gateway->peer_dsp, DSP_FAXMODE_DETECT_V21 | DSP_FAXMODE_DETECT_CED);
 
 	details->caps = AST_FAX_TECH_GATEWAY;
-	if (!(gateway->s = fax_session_reserve(details, &gateway->token))) {
+	if (details->gateway_timeout && !(gateway->s = fax_session_reserve(details, &gateway->token))) {
 		details->caps |= ~AST_FAX_TECH_GATEWAY;
 		ast_log(LOG_ERROR, "Can't reserve a FAX session, gateway attempt failed.\n");
 		ao2_ref(gateway, -1);
@@ -2595,6 +2592,7 @@
 
 	gateway->t38_state = T38_STATE_NEGOTIATING;
 	gateway->timeout_start = ast_tvnow();
+	details->gateway_timeout = FAX_GATEWAY_TIMEOUT;
 
 	ast_debug(1, "requesting T.38 for gateway session for %s\n", chan->name);
 	return fp;
@@ -2687,6 +2685,7 @@
 			t38_parameters_ast_to_fax(&details->their_t38_parameters, control_params);
 			gateway->t38_state = T38_STATE_UNKNOWN;
 			gateway->timeout_start = ast_tvnow();
+			details->gateway_timeout = FAX_GATEWAY_TIMEOUT;
 			ao2_ref(details, -1);
 			return f;
 		} else if (state == T38_STATE_UNAVAILABLE || state == T38_STATE_REJECTED) {
@@ -2724,6 +2723,7 @@
 			t38_parameters_ast_to_fax(&details->their_t38_parameters, control_params);
 			gateway->t38_state = T38_STATE_UNKNOWN;
 			gateway->timeout_start = ast_tvnow();
+			details->gateway_timeout = FAX_GATEWAY_TIMEOUT;
 
 			ast_debug(1, "%s is attempting to negotiate T.38 after we already sent a negotiation request based on v21 preamble detection\n", active->name);
 			ao2_ref(details, -1);
@@ -2967,7 +2967,9 @@
 			return f;
 		}
 
-		gateway->timeout_start = ast_tvnow();
+		if (details->gateway_timeout) {
+			gateway->timeout_start = ast_tvnow();
+		}
 
 		/* we are bridged, change r/w formats to SLIN for v21 preamble
 		 * detection and T.30 */
@@ -2987,7 +2989,7 @@
 		gateway->bridged = 1;
 	}
 
-	if (details->gateway_timeout && gateway->bridged && !ast_tvzero(gateway->timeout_start)) {
+	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, details->gateway_timeout);
 			ast_framehook_detach(chan, gateway->framehook);
@@ -3744,8 +3746,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 +3823,19 @@
 	} else if (!strcasecmp(data, "t38gateway") || !strcasecmp(data, "gateway") ||
 		   !strcasecmp(data, "t38_gateway") || !strcasecmp(data, "faxgateway")) {
 		const char *val = ast_skip_blanks(value);
+		if (!ast_strlen_zero(val)) {
+			char *timeout = strchr(val, ',');
+			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 +3854,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 svn-commits mailing list