Index: src/mod/endpoints/mod_sofia/sofia_glue.c =================================================================== --- src/mod/endpoints/mod_sofia/sofia_glue.c (revision 16485) +++ src/mod/endpoints/mod_sofia/sofia_glue.c (working copy) @@ -1457,6 +1457,10 @@ sofia_destination_t *dst = NULL; sofia_cid_type_t cid_type = tech_pvt->profile->cid_type; + //int failover_flag = 0; + sip_cseq_t *cseq = NULL; + //char *sip_invite_cseq = NULL; + rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER); switch_assert(tech_pvt != NULL); @@ -1503,8 +1507,11 @@ const char *invite_from_params = switch_channel_get_variable(tech_pvt->channel, "sip_invite_from_params"); const char *from_var = switch_channel_get_variable(tech_pvt->channel, "sip_from_uri"); const char *from_display = switch_channel_get_variable(tech_pvt->channel, "sip_from_display"); - - + const char *invite_from_tag = switch_channel_get_variable(tech_pvt->channel, "sip_invite_from_tag"); + const char *invite_to_tag = switch_channel_get_variable(tech_pvt->channel, "sip_invite_to_tag"); + sip_from_t *from = NULL; + sip_to_t *to = NULL; + if (zstr(tech_pvt->dest)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "URL Error!\n"); return SWITCH_STATUS_FALSE; @@ -1544,6 +1551,8 @@ sipip); } + + if (from_var) { if (strncasecmp(from_var, "sip:", 4) || strncasecmp(from_var, "sips:", 5)) { use_from_str = switch_core_session_strdup(tech_pvt->session, from_var); @@ -1669,11 +1678,19 @@ } } + from = sip_from_make(tech_pvt->profile->home, from_str); + if (!zstr(invite_from_tag)) + sip_from_tag(tech_pvt->profile->home,from,invite_from_tag); + + to = sip_to_make(tech_pvt->profile->home, to_str); + if (!zstr(invite_to_tag)) + sip_to_tag(tech_pvt->profile->home,to,invite_to_tag); + tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL, NUTAG_URL(url_str), TAG_IF(call_id, SIPTAG_CALL_ID_STR(call_id)), - SIPTAG_TO_STR(to_str), - SIPTAG_FROM_STR(from_str), + SIPTAG_TO(to), + SIPTAG_FROM(from), SIPTAG_CONTACT_STR(invite_contact), TAG_END()); @@ -1825,7 +1842,12 @@ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "%s Setting proxy route to %s\n", route_uri, switch_channel_get_name(channel)); tech_pvt->route_uri = switch_core_session_strdup(tech_pvt->session, route_uri); } - + + if (( val = switch_channel_get_variable(tech_pvt->channel, "sip_invite_cseq"))) { + uint32_t callsequence = (uint32_t)strtoul(val,NULL,10); + cseq = sip_cseq_create(tech_pvt->profile->home, callsequence, SIP_METHOD_INVITE); + } + switch_channel_clear_flag(channel, CF_MEDIA_ACK); if (sofia_use_soa(tech_pvt)) { @@ -1845,6 +1867,7 @@ TAG_IF(!zstr(route_uri), NUTAG_PROXY(route_uri)), TAG_IF(!zstr(route), SIPTAG_ROUTE_STR(route)), TAG_IF(tech_pvt->profile->minimum_session_expires, NUTAG_MIN_SE(tech_pvt->profile->minimum_session_expires)), + TAG_IF(cseq,SIPTAG_CSEQ(cseq)), SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_REUSE_REJECTED(1), @@ -1871,6 +1894,7 @@ TAG_IF(!zstr(route_uri), NUTAG_PROXY(route_uri)), TAG_IF(!zstr(route), SIPTAG_ROUTE_STR(route)), TAG_IF(tech_pvt->profile->minimum_session_expires, NUTAG_MIN_SE(tech_pvt->profile->minimum_session_expires)), + TAG_IF(cseq,SIPTAG_CSEQ(cseq)), NUTAG_MEDIA_ENABLE(0), SIPTAG_CONTENT_TYPE_STR("application/sdp"), SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str),