From 842ea87d645c4f770b35bce9483e356f0c5d4393 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 21 Sep 2011 14:56:49 -0500 Subject: [PATCH] FS-3571 try this, I don't have a way to test it so this is just guessing, give me a lab box if this doesn't work --- src/include/switch_types.h | 3 ++- src/mod/applications/mod_spandsp/mod_spandsp_fax.c | 6 ++++-- src/mod/endpoints/mod_sofia/sofia.c | 7 +++++++ src/mod/endpoints/mod_sofia/sofia_glue.c | 5 +++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index e0419718c1..21dfa51339 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1181,7 +1181,8 @@ typedef enum { CF_APP_TAGGED = (1 << 0), CF_APP_T38 = (1 << 1), CF_APP_T38_REQ = (1 << 2), - CF_APP_T38_FAIL = (1 << 3) + CF_APP_T38_FAIL = (1 << 3), + CF_APP_T38_NEGOTIATED = (1 << 4) } switch_channel_app_flag_t; diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 4653d9cee8..23cb9031bf 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -806,7 +806,7 @@ static t38_mode_t negotiate_t38(pvt_t *pvt) switch_channel_set_private(channel, "t38_options", NULL); } else { pvt->t38_mode = T38_MODE_NEGOTIATED; - + switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38 SDP Origin = %s\n", t38_options->sdp_o_line); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxVersion = %d\n", t38_options->T38FaxVersion); @@ -1211,6 +1211,7 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat } else if (switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { switch_core_session_message_t msg = { 0 }; pvt->t38_mode = T38_MODE_NEGOTIATED; + switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED); spanfax_init(pvt, T38_MODE); configure_t38(pvt); @@ -1493,13 +1494,14 @@ static switch_status_t t38_gateway_on_soft_execute(switch_core_session_t *sessio spanfax_init(pvt, T38_GATEWAY_MODE); configure_t38(pvt); pvt->t38_mode = T38_MODE_NEGOTIATED; + switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED); } else { if (negotiate_t38(pvt) != T38_MODE_NEGOTIATED) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Could not negotiate T38\n", switch_channel_get_name(channel)); switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); goto end_unlock; } - + switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED); spanfax_init(pvt, T38_GATEWAY_MODE); } diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index ef65a7ce95..e32b96cd01 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5605,6 +5605,12 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } goto done; } else { + + if (switch_channel_test_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_NEGOTIATED)) { + nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END()); + goto done; + } + sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE); if (tech_pvt->num_codecs) { @@ -5620,6 +5626,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if (sofia_glue_tech_choose_port(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) { goto done; } + sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0); if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) { diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index af55c13a9a..a85098bc8d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4404,6 +4404,11 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s if (got_udptl && m->m_type == sdp_media_image && m->m_port) { switch_t38_options_t *t38_options = tech_process_udptl(tech_pvt, sdp, m); + if (switch_channel_test_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_NEGOTIATED)) { + match = 1; + goto done; + } + if (switch_channel_test_app_flag_key("T38", tech_pvt->channel, CF_APP_T38)) { sofia_set_flag(tech_pvt, TFLAG_NOREPLY); }