From: Matthew Jordan Date: Mon, 23 Jan 2012 19:12:14 +0000 (+0000) Subject: Correctly apply FAXOPT settings (V17, V27, V29) before starting spandsp layer X-Git-Tag: 1.8.10.0-rc1~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11105d0cd3c2a1c02b0f3a7a1f937f4a663ff9ca;p=thirdparty%2Fasterisk.git 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) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@352144 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_fax_spandsp.c b/res/res_fax_spandsp.c index 73004198b4..02549f23d3 100644 --- a/res/res_fax_spandsp.c +++ b/res/res_fax_spandsp.c @@ -131,6 +131,7 @@ static int t38_tx_packet_handler(t38_core_state_t *t38_core_state, void *data, c 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); @@ -412,6 +413,31 @@ static void set_ecm(t30_state_t *t30_state, struct ast_fax_session_details *deta t30_set_supported_compressions(t30_state, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); } +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) { @@ -584,6 +610,7 @@ static int spandsp_fax_start(struct ast_fax_session *s) 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 */