From 7067bb8b427c87eda5be0f8574be16a0ded846a6 Mon Sep 17 00:00:00 2001
From: Matthew Nicholson <mnicholson@digium.com>
Date: Mon, 29 Aug 2011 18:28:02 +0000
Subject: [PATCH] Merged revisions 333716 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/10

........
  r333716 | mnicholson | 2011-08-29 13:22:58 -0500 (Mon, 29 Aug 2011) | 5 lines

  It is possible for the gateway to be attached when the channel is still
  negotiating T.38. This change handles that case.

  ASTERISK-18329
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@333736 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 res/res_fax_spandsp.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/res/res_fax_spandsp.c b/res/res_fax_spandsp.c
index 296dd07a63..81711bb40c 100644
--- a/res/res_fax_spandsp.c
+++ b/res/res_fax_spandsp.c
@@ -683,6 +683,13 @@ static int spandsp_fax_gateway_start(struct ast_fax_session *s) {
 		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);
-- 
GitLab