[asterisk-commits] irroot: branch irroot/distrotech-customers-1.8 r334436 - /team/irroot/distrot...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Sep 4 05:09:28 CDT 2011


Author: irroot
Date: Sun Sep  4 05:09:17 2011
New Revision: 334436

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=334436
Log:
Fixup for gwtimeout patch and handle T38_STATE_NEGOTIATING and T38_STATE_NEGOTIATED the same when gateway is started.

Modified:
    team/irroot/distrotech-customers-1.8/res/res_fax.c
    team/irroot/distrotech-customers-1.8/res/res_fax_spandsp.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=334436&r1=334435&r2=334436
==============================================================================
--- team/irroot/distrotech-customers-1.8/res/res_fax.c (original)
+++ team/irroot/distrotech-customers-1.8/res/res_fax.c Sun Sep  4 05:09:17 2011
@@ -184,7 +184,7 @@
 						<para>R/W Modem type (v17/v27/v29).</para>
 					</enum>
 					<enum name="gateway">
-						<para>R/W T38 Gateway Enabled (yes/no)</para>
+						<para>R/W T38 Gateway Enabled With optional fax activity timeout in seconds (yes[,gwtimeout]/no)</para>
 					</enum>
 					<enum name="pages">
 						<para>R/O Number of pages transferred.</para>
@@ -467,7 +467,6 @@
 	d->minrate = general_options.minrate;
 	d->maxrate = general_options.maxrate;
 	d->gateway_id = -1;
-	d->gateway_timeout = FAX_GATEWAY_TIMEOUT;
 
 	return d;
 }
@@ -3823,21 +3822,24 @@
 	} 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);
-				}
-			}
+		char *timeout = strchr(val, ',');
+
+		if (timeout) {
+			*timeout++ = '\0';
 		}
 
 		if (ast_true(val)) {
 			if (details->gateway_id < 0) {
+				details->gateway_timeout = 0;
+				if (timeout) {
+					unsigned int gwtimeout;
+					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);
+					}
+				}
+
 				details->gateway_id = fax_gateway_attach(chan, details);
 				if (details->gateway_id < 0) {
 					ast_log(LOG_ERROR, "Error attaching T.38 gateway to channel %s.\n", chan->name);

Modified: team/irroot/distrotech-customers-1.8/res/res_fax_spandsp.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/res/res_fax_spandsp.c?view=diff&rev=334436&r1=334435&r2=334436
==============================================================================
--- team/irroot/distrotech-customers-1.8/res/res_fax_spandsp.c (original)
+++ team/irroot/distrotech-customers-1.8/res/res_fax_spandsp.c Sun Sep  4 05:09:17 2011
@@ -544,7 +544,6 @@
 		.subclass.codec = AST_FORMAT_SLINEAR,
 		.src = "res_fax_spandsp_g711",
 	};
-
 	struct ast_frame *f = &fax_frame;
 
 	ast_timer_ack(p->timer, 1);
@@ -684,6 +683,13 @@
 		ast_channel_unlock(s->chan);
 		return -1;
 	}
+
+	/* we can be in T38_STATE_NEGOTIATING or T38_STATE_NEGOTIATED when the
+	 * gateway is started. We treat both states the same. */
+	if (p->ast_t38_state == T38_STATE_NEGOTIATING) {
+		p->ast_t38_state = T38_STATE_NEGOTIATED;
+	}
+
 	ast_activate_generator(p->ast_t38_state == T38_STATE_NEGOTIATED ? peer : s->chan, &t30_gen , s);
 
 	set_logging(&p->t38_gw_state.logging, s->details);




More information about the asterisk-commits mailing list