[asterisk-commits] dhubbard: branch 1.6.0 r177762 - in /branches/1.6.0: ./ apps/app_fax.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Feb 20 15:41:54 CST 2009


Author: dhubbard
Date: Fri Feb 20 15:41:54 2009
New Revision: 177762

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=177762
Log:
Merged revisions 148868 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r148868 | tilghman | 2008-10-14 10:15:45 -0500 (Tue, 14 Oct 2008) | 6 lines
  
  API differences in spandsp 0.0.6pre1 and higher
  (closes issue #13688)
   Reported by: irroot
   Patches: 
         app_fax-span6.patch uploaded by irroot (license 52) with minor modifications by me
........

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

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

Modified: branches/1.6.0/apps/app_fax.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.0/apps/app_fax.c?view=diff&rev=177762&r1=177761&r2=177762
==============================================================================
--- branches/1.6.0/apps/app_fax.c (original)
+++ branches/1.6.0/apps/app_fax.c Fri Feb 20 15:41:54 2009
@@ -32,6 +32,7 @@
 #ifdef HAVE_SPANDSP_EXPOSE_H
 #include <spandsp/expose.h>
 #endif
+#include <spandsp/version.h>
 
 #include "asterisk/lock.h"
 #include "asterisk/file.h"
@@ -313,6 +314,7 @@
 	int original_read_fmt = AST_FORMAT_SLINEAR;
 	int original_write_fmt = AST_FORMAT_SLINEAR;
 	fax_state_t fax;
+	t30_state_t *t30state;
 	struct ast_dsp *dsp = NULL;
 	int detect_tone = 0;
 	struct ast_frame *inf = NULL;
@@ -321,6 +323,14 @@
 	struct timeval now, start, state_change;
 	enum ast_control_t38 t38control;
 
+#if SPANDSP_RELEASE_DATE >= 20081012
+        /* for spandsp shaphots 0.0.6 and higher */
+        t30state = &fax.t30;
+#else
+        /* for spandsp release 0.0.5 */
+        t30state = &fax.t30_state;
+#endif
+
 	original_read_fmt = s->chan->readformat;
 	if (original_read_fmt != AST_FORMAT_SLINEAR) {
 		res = ast_set_read_format(s->chan, AST_FORMAT_SLINEAR);
@@ -344,16 +354,16 @@
 
 	/* Setup logging */
 	set_logging(&fax.logging);
-	set_logging(&fax.t30_state.logging);
+	set_logging(&t30state->logging);
 
 	/* Configure terminal */
-	set_local_info(&fax.t30_state, s);
-	set_file(&fax.t30_state, s);
-	set_ecm(&fax.t30_state, TRUE);
+	set_local_info(t30state, s);
+	set_file(t30state, s);
+	set_ecm(t30state, TRUE);
 
 	fax_set_transmit_on_idle(&fax, TRUE);
 
-	t30_set_phase_e_handler(&fax.t30_state, phase_e_handler, s);
+	t30_set_phase_e_handler(t30state, phase_e_handler, s);
 
 	if (s->t38state == T38_STATE_UNAVAILABLE) {
 		ast_debug(1, "T38 is unavailable on %s\n", s->chan->name);
@@ -418,9 +428,9 @@
 			}
 
 			/* Watchdog */
-			if (last_state != fax.t30_state.state) {
+			if (last_state != t30state->state) {
 				state_change = ast_tvnow();
-				last_state = fax.t30_state.state;
+				last_state = t30state->state;
 			}
 		} else if (inf->frametype == AST_FRAME_CONTROL && inf->subclass == AST_CONTROL_T38 &&
 				inf->datalen == sizeof(enum ast_control_t38)) {
@@ -459,10 +469,10 @@
 	   by t30_terminate, display diagnostics and set status variables although no transmittion
 	   has taken place yet. */
 	if (res > 0) {
-		t30_set_phase_e_handler(&fax.t30_state, NULL, NULL);
-	}
-
-	t30_terminate(&fax.t30_state);
+		t30_set_phase_e_handler(t30state, NULL, NULL);
+	}
+
+	t30_terminate(t30state);
 	fax_release(&fax);
 
 done:
@@ -489,6 +499,19 @@
 	struct timeval now, start, state_change, last_frame;
 	enum ast_control_t38 t38control;
 
+	t30_state_t *t30state;
+	t38_core_state_t *t38state;
+
+#if SPANDSP_RELEASE_DATE >= 20081012
+	/* for spandsp shaphots 0.0.6 and higher */
+	t30state = &t38.t30;
+	t38state = &t38.t38_fe.t38;
+#else
+	/* for spandsp releases 0.0.5 */
+	t30state = &t38.t30_state;
+	t38state = &t38.t38;
+#endif
+
 	/* Initialize terminal */
 	memset(&t38, 0, sizeof(t38));
 	if (t38_terminal_init(&t38, s->caller_mode, t38_tx_packet_handler, s->chan) == NULL) {
@@ -498,15 +521,15 @@
 
 	/* Setup logging */
 	set_logging(&t38.logging);
-	set_logging(&t38.t30_state.logging);
-	set_logging(&t38.t38.logging);
+	set_logging(&t30state->logging);
+	set_logging(&t38state->logging);
 
 	/* Configure terminal */
-	set_local_info(&t38.t30_state, s);
-	set_file(&t38.t30_state, s);
-	set_ecm(&t38.t30_state, TRUE);
-
-	t30_set_phase_e_handler(&t38.t30_state, phase_e_handler, s);
+	set_local_info(t30state, s);
+	set_file(t30state, s);
+	set_ecm(t30state, TRUE);
+
+	t30_set_phase_e_handler(t30state, phase_e_handler, s);
 
 	now = start = state_change = ast_tvnow();
 
@@ -532,12 +555,12 @@
 		ast_debug(10, "frame %d/%d, len=%d\n", inf->frametype, inf->subclass, inf->datalen);
 
 		if (inf->frametype == AST_FRAME_MODEM && inf->subclass == AST_MODEM_T38) {
-			t38_core_rx_ifp_packet(&t38.t38, inf->data, inf->datalen, inf->seqno);
+			t38_core_rx_ifp_packet(t38state, inf->data, inf->datalen, inf->seqno);
 
 			/* Watchdog */
-			if (last_state != t38.t30_state.state) {
+			if (last_state != t30state->state) {
 				state_change = ast_tvnow();
-				last_state = t38.t30_state.state;
+				last_state = t30state->state;
 			}
 		} else if (inf->frametype == AST_FRAME_CONTROL && inf->subclass == AST_CONTROL_T38 &&
 				inf->datalen == sizeof(enum ast_control_t38)) {
@@ -567,7 +590,7 @@
 	if (inf)
 		ast_frfree(inf);
 
-	t30_terminate(&t38.t30_state);
+	t30_terminate(t30state);
 	t38_terminal_release(&t38);
 
 	return res;




More information about the asterisk-commits mailing list