[asterisk-commits] irroot: branch irroot/t38gateway-trunk r333337 - /team/irroot/t38gateway-trun...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 26 04:55:28 CDT 2011


Author: irroot
Date: Fri Aug 26 04:55:24 2011
New Revision: 333337

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=333337
Log:
Fixup gwtimeout option to make more sense and not overwrite settings.
Only  set the v21 indicator when we have actioned t38 negotiation

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

Modified: team/irroot/t38gateway-trunk/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/t38gateway-trunk/res/res_fax.c?view=diff&rev=333337&r1=333336&r2=333337
==============================================================================
--- team/irroot/t38gateway-trunk/res/res_fax.c (original)
+++ team/irroot/t38gateway-trunk/res/res_fax.c Fri Aug 26 04:55:24 2011
@@ -2446,7 +2446,7 @@
 	ast_dsp_set_faxmode(gateway->peer_dsp, DSP_FAXMODE_DETECT_V21);
 
 	details->caps = AST_FAX_TECH_GATEWAY;
-	if (details->gateway_timeout && !(gateway->s = fax_session_reserve(details, &gateway->token))) {
+	if (!(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,7 +2530,6 @@
 
 	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;
@@ -2555,8 +2554,8 @@
 	}
 
 	if (dfr->frametype == AST_FRAME_DTMF && dfr->subclass.integer == 'g') {
-		gateway->detected_v21 = 1;
 		if (ast_channel_get_t38_state(other) == T38_STATE_UNKNOWN) {
+			gateway->detected_v21 = 1;
 			ast_debug(1, "detected v21 preamble from %s\n", active->name);
 			return fax_gateway_request_t38(gateway, chan, f);
 		} else {
@@ -2623,7 +2622,6 @@
 			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) {
@@ -2661,7 +2659,6 @@
 			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);
@@ -2905,9 +2902,7 @@
 			return f;
 		}
 
-		if (details->gateway_timeout) {
-			gateway->timeout_start = ast_tvnow();
-		}
+		gateway->timeout_start = ast_tvnow();
 
 		/* we are bridged, change r/w formats to SLIN for v21 preamble
 		 * detection and T.30 */
@@ -2927,14 +2922,14 @@
 		gateway->bridged = 1;
 	}
 
-	if (gateway->bridged && !ast_tvzero(gateway->timeout_start)) {
+	if (details->gateway_timeout && 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);




More information about the asterisk-commits mailing list