[svn-commits] kpfleming: branch 1.6.0 r223653 - in /branches/1.6.0: ./ apps/ channels/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Oct 12 09:28:03 CDT 2009


Author: kpfleming
Date: Mon Oct 12 09:28:00 2009
New Revision: 223653

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=223653
Log:
Merged revisions 223652 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r223652 | kpfleming | 2009-10-12 09:25:29 -0500 (Mon, 12 Oct 2009) | 13 lines
  
  Remove automatic switching from T.38 to voice mode in chan_sip.
  
  chan_sip has some code to automatically switch from T.38 mode to voice mode when
  a voice frame is written to the channel while it is in T.38 mode; this was
  intended to handle the situation when a FAX transmission has ended and the channel
  is not yet hung up, but is causing problems at the beginning of FAX sessions as
  well when there are still voice frames 'in flight' at the time the T.38 negotiation
  completes. This patch removes the automatic switchover, and changes app_fax to
  explicitly switch off T.38 mode when the FAX transmission process ends.
  
  (closes issue #16025)
  Reported by: jamicque
........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/apps/app_fax.c
    branches/1.6.0/channels/chan_sip.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/apps/app_fax.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.0/apps/app_fax.c?view=diff&rev=223653&r1=223652&r2=223653
==============================================================================
--- branches/1.6.0/apps/app_fax.c (original)
+++ branches/1.6.0/apps/app_fax.c Mon Oct 12 09:28:00 2009
@@ -550,6 +550,7 @@
 	struct timeval now, start, state_change, last_frame;
 	t30_state_t *t30state;
 	t38_core_state_t *t38state;
+	struct ast_control_t38_parameters t38_parameters = { .request_response = AST_T38_REQUEST_TERMINATE, };
 
 #if SPANDSP_RELEASE_DATE >= 20080725
 	/* for spandsp shaphots 0.0.6 and higher */
@@ -565,7 +566,8 @@
 	memset(&t38, 0, sizeof(t38));
 	if (t38_terminal_init(&t38, s->caller_mode, t38_tx_packet_handler, s->chan) == NULL) {
 		ast_log(LOG_WARNING, "Unable to start T.38 termination.\n");
-		return -1;
+		res = -1;
+		goto disable_t38;
 	}
 
 	t38_set_max_datagram_size(t38state, s->t38parameters.max_ifp);
@@ -650,6 +652,57 @@
 	t30_terminate(t30state);
 	t38_terminal_release(&t38);
 
+disable_t38:
+	if (ast_channel_get_t38_state(s->chan) == T38_STATE_NEGOTIATED) {
+		if (ast_indicate_data(s->chan, AST_CONTROL_T38_PARAMETERS, &t38_parameters, sizeof(t38_parameters)) == 0) {
+			/* wait up to five seconds for negotiation to complete */
+			unsigned int timeout = 5000;
+			int ms;
+			
+			ast_debug(1, "Shutting down T.38 on %s\n", s->chan->name);
+			while (timeout > 0) {
+				ms = ast_waitfor(s->chan, 1000);
+				if (ms < 0) {
+					ast_log(LOG_WARNING, "something bad happened while channel '%s' was polling.\n", s->chan->name);
+					return -1;
+				}
+				if (!ms) {
+					/* nothing happened */
+					if (timeout > 0) {
+						timeout -= 1000;
+						continue;
+					} else {
+						ast_log(LOG_WARNING, "channel '%s' timed-out during the T.38 shutdown.\n", s->chan->name);
+						break;
+					}
+				}
+				if (!(inf = ast_read(s->chan))) {
+					return -1;
+				}
+				if ((inf->frametype == AST_FRAME_CONTROL) &&
+				    (inf->subclass == AST_CONTROL_T38_PARAMETERS) &&
+				    (inf->datalen == sizeof(t38_parameters))) {
+					struct ast_control_t38_parameters *parameters = inf->data;
+					
+					switch (parameters->request_response) {
+					case AST_T38_NEGOTIATED:
+						ast_debug(1, "Shut down T.38 on %s\n", s->chan->name);
+						break;
+					case AST_T38_REFUSED:
+						ast_log(LOG_WARNING, "channel '%s' refused to disable T.38\n", s->chan->name);
+						break;
+					default:
+						ast_log(LOG_ERROR, "channel '%s' failed to disable T.38\n", s->chan->name);
+						break;
+					}
+					ast_frfree(inf);
+					break;
+				}
+				ast_frfree(inf);
+			}
+		}
+	}
+
 	return res;
 }
 

Modified: branches/1.6.0/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.0/channels/chan_sip.c?view=diff&rev=223653&r1=223652&r2=223653
==============================================================================
--- branches/1.6.0/channels/chan_sip.c (original)
+++ branches/1.6.0/channels/chan_sip.c Mon Oct 12 09:28:00 2009
@@ -5343,8 +5343,7 @@
 						ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);
 					}
 				} else if (p->t38.state == T38_ENABLED) {
-					change_t38_state(p, T38_DISABLED);
-					transmit_reinvite_with_sdp(p, FALSE, FALSE);
+					/* drop frame, can't sent VOICE frames while in T.38 mode */
 				} else {
 					p->lastrtptx = time(NULL);
 					res = ast_rtp_write(p->rtp, frame);




More information about the svn-commits mailing list