[asterisk-commits] mjordan: trunk r352166 - in /trunk: ./ res/res_fax_spandsp.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 23 13:22:14 CST 2012


Author: mjordan
Date: Mon Jan 23 13:22:11 2012
New Revision: 352166

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=352166
Log:
Correctly apply FAXOPT settings (V17, V27, V29) before starting spandsp layer

While the FAXOPT function could be used to set the modem capabilities, the
input to that function was not being applied correctly to the spandsp layer.
This patch applies the current model capabilities before starting the spandsp
layer.

(closes issue: ASTERISK-16409)
Reported by: Kristijan Vrban
Tested by: Matt Jordan, Matthew Nicholson
Patches:
  spandsp-modems-1.8.diff uploaded by mnicholson (license 5081)
  spandsp-modems-10.diff uploaded by mnicholson (license 5081)
........

Merged revisions 352144 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 352149 from http://svn.asterisk.org/svn/asterisk/branches/10

Modified:
    trunk/   (props changed)
    trunk/res/res_fax_spandsp.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: trunk/res/res_fax_spandsp.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_fax_spandsp.c?view=diff&rev=352166&r1=352165&r2=352166
==============================================================================
--- trunk/res/res_fax_spandsp.c (original)
+++ trunk/res/res_fax_spandsp.c Mon Jan 23 13:22:11 2012
@@ -166,6 +166,7 @@
 static void t30_phase_e_handler(t30_state_t *t30_state, void *data, int completion_code);
 static void spandsp_log(int level, const char *msg);
 static int update_stats(struct spandsp_pvt *p, int completion_code);
+static int spandsp_modems(struct ast_fax_session_details *details);
 
 static void set_logging(logging_state_t *state, struct ast_fax_session_details *details);
 static void set_local_info(t30_state_t *t30_state, struct ast_fax_session_details *details);
@@ -473,6 +474,31 @@
 	return 0;
 }
 
+static int spandsp_modems(struct ast_fax_session_details *details)
+{
+	int modems = 0;
+	if (AST_FAX_MODEM_V17 & details->modems) {
+		modems |= T30_SUPPORT_V17;
+	}
+	if (AST_FAX_MODEM_V27 & details->modems) {
+		modems |= T30_SUPPORT_V27TER;
+	}
+	if (AST_FAX_MODEM_V29 & details->modems) {
+		modems |= T30_SUPPORT_V29;
+	}
+	if (AST_FAX_MODEM_V34 & details->modems) {
+#if defined(T30_SUPPORT_V34)
+		modems |= T30_SUPPORT_V34;
+#elif defined(T30_SUPPORT_V34HDX)
+		modems |= T30_SUPPORT_V34HDX;
+#else
+		ast_log(LOG_WARNING, "v34 not supported in this version of spandsp\n");
+#endif
+	}
+
+	return modems;
+}
+
 /*! \brief create an instance of the spandsp tech_pvt for a fax session */
 static void *spandsp_fax_new(struct ast_fax_session *s, struct ast_fax_tech_token *token)
 {
@@ -730,7 +756,7 @@
 static int spandsp_fax_gateway_start(struct ast_fax_session *s) {
 	struct spandsp_pvt *p = s->tech_pvt;
 	struct ast_fax_t38_parameters *t38_param;
-	int i, modems = 0;
+	int i;
 	struct ast_channel *peer;
 	static struct ast_generator t30_gen = {
 		alloc: spandsp_fax_gw_gen_alloc,
@@ -781,26 +807,8 @@
 	t38_gateway_set_transmit_on_idle(&p->t38_gw_state, TRUE);
 	t38_set_sequence_number_handling(p->t38_core_state, TRUE);
 
-	if (AST_FAX_MODEM_V17 & s->details->modems) {
-		modems |= T30_SUPPORT_V17;
-	}
-	if (AST_FAX_MODEM_V27 & s->details->modems) {
-		modems |= T30_SUPPORT_V27TER;
-	}
-	if (AST_FAX_MODEM_V29 & s->details->modems) {
-		modems |= T30_SUPPORT_V29;
-	}
-	if (AST_FAX_MODEM_V34 & s->details->modems) {
-#if defined(T30_SUPPORT_V34)
-		modems |= T30_SUPPORT_V34;
-#elif defined(T30_SUPPORT_V34HDX)
-		modems |= T30_SUPPORT_V34HDX;
-#else
-		ast_log(LOG_WARNING, "v34 not supported in this version of spandsp\n");
-#endif
-	}
-
-	t38_gateway_set_supported_modems(&p->t38_gw_state, modems);
+
+	t38_gateway_set_supported_modems(&p->t38_gw_state, spandsp_modems(s->details));
 
 	/* engage udptl nat on other side of T38 line 
 	 * (Asterisk changes media ports thus we send a few packets to reinitialize
@@ -895,6 +903,7 @@
 	set_local_info(p->t30_state, s->details);
 	set_file(p->t30_state, s->details);
 	set_ecm(p->t30_state, s->details);
+	t30_set_supported_modems(p->t30_state, spandsp_modems(s->details));
 
 	/* perhaps set_transmit_on_idle() should be called */
 




More information about the asterisk-commits mailing list