From 3ddbad4dd386f30b3a5fe29763e04b965f8b0dfa Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 23 Jul 2013 13:52:49 -0500 Subject: [PATCH] let sofia recover work in some tcp situations --- src/mod/endpoints/mod_sofia/sofia.c | 2 +- src/mod/endpoints/mod_sofia/sofia_glue.c | 11 ++++++----- src/switch_core_media.c | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 276c87a858..35c325fefa 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -253,7 +253,7 @@ static void extract_header_vars(sofia_profile_t *profile, sip_t const *sip, switch_channel_set_variable(channel, "sip_full_via", (char *)stream.data); - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND || switch_stristr("TCP", (char *)stream.data)) { switch_channel_set_variable(channel, "sip_recover_via", (char *)stream.data); } diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index fccc577fa8..ea403e7d38 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -986,7 +986,6 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) switch_channel_set_variable(channel, "sip_to_host", sofia_glue_get_host(to_str, switch_core_session_get_pool(session))); switch_channel_set_variable(channel, "sip_from_host", sofia_glue_get_host(from_str, switch_core_session_get_pool(session))); - if (!(tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL, NUTAG_URL(url_str), TAG_IF(call_id, SIPTAG_CALL_ID_STR(call_id)), @@ -1221,6 +1220,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) "Local SDP:\n%s\n", tech_pvt->mparams.local_sdp_str); } + if (sofia_use_soa(tech_pvt)) { nua_invite(tech_pvt->nh, NUTAG_AUTOANSWER(0), @@ -1850,10 +1850,13 @@ int sofia_recover_callback(switch_core_session_t *session) tech_pvt->redirected = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_contact_uri")); if (zstr(rr)) { - switch_channel_set_variable_printf(channel, "sip_invite_route_uri", "", + switch_channel_set_variable_printf(channel, "sip_invite_route_uri", "", switch_channel_get_variable(channel, "sip_from_user"), - switch_channel_get_variable(channel, "sip_network_ip"), switch_channel_get_variable(channel, "sip_network_port") + switch_channel_get_variable(channel, "sip_network_ip"), + switch_channel_get_variable(channel, "sip_network_port"), + switch_channel_get_variable(channel,"sip_via_protocol") ); + } tech_pvt->dest = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_from_uri")); @@ -1889,8 +1892,6 @@ int sofia_recover_callback(switch_core_session_t *session) if (session) { const char *use_uuid; - switch_channel_set_flag(channel, CF_RECOVERING); - if ((use_uuid = switch_channel_get_variable(channel, "origination_uuid"))) { if (switch_core_session_set_uuid(session, use_uuid) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s set UUID=%s\n", switch_channel_get_name(channel), diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 989aacb361..22e082d90d 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -7478,7 +7478,7 @@ SWITCH_DECLARE (void) switch_core_media_recover_session(switch_core_session_t *s ip = switch_channel_get_variable(session->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE); port = switch_channel_get_variable(session->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE); - + switch_channel_set_flag(session->channel, CF_RECOVERING); if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) || !(ip && port)) { return;