[asterisk-commits] irroot: branch irroot/distrotech-customers-10 r333691 - /team/irroot/distrote...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 29 12:43:52 CDT 2011


Author: irroot
Date: Mon Aug 29 12:43:49 2011
New Revision: 333691

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

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

Modified: team/irroot/distrotech-customers-10/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-10/res/res_fax.c?view=diff&rev=333691&r1=333690&r2=333691
==============================================================================
--- team/irroot/distrotech-customers-10/res/res_fax.c (original)
+++ team/irroot/distrotech-customers-10/res/res_fax.c Mon Aug 29 12:43:49 2011
@@ -192,9 +192,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>
@@ -2446,7 +2443,7 @@
 	ast_dsp_set_faxmode(gateway->peer_dsp, DSP_FAXMODE_DETECT_V21);
 
 	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);
@@ -2530,6 +2527,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;
@@ -2622,6 +2620,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) {
@@ -2659,6 +2658,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);
@@ -2902,7 +2902,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 */
@@ -2922,7 +2924,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);
@@ -3681,8 +3683,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")) {
@@ -3760,6 +3760,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);
@@ -3778,18 +3791,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