This commit is contained in:
Anthony Minessale 2011-11-15 11:26:49 -06:00
parent 3603a69d66
commit ebed43a4f6
2 changed files with 41 additions and 27 deletions

View File

@ -182,15 +182,47 @@ static void extract_header_vars(sofia_profile_t *profile, sip_t const *sip,
su_free(nh->nh_home, full);
}
}
if (sip->sip_via) {
if ((full = sip_header_as_string(nh->nh_home, (void *) sip->sip_via))) {
const char *v = switch_channel_get_variable(channel, "sip_full_via");
if (!v) {
switch_channel_set_variable(channel, "sip_full_via", full);
}
su_free(nh->nh_home, full);
if (sip->sip_record_route) {
sip_record_route_t *rrp;
switch_stream_handle_t stream = { 0 };
int x = 0;
SWITCH_STANDARD_STREAM(stream);
for(rrp = sip->sip_record_route; rrp; rrp = rrp->r_next) {
char *rr = sip_header_as_string(nh->nh_home, (void *) rrp);
stream.write_function(&stream, x == 0 ? "%s" : ",%s", rr);
su_free(nh->nh_home, rr);
x++;
}
switch_channel_set_variable(channel, "sip_invite_record_route", (char *)stream.data);
free(stream.data);
}
if (sip->sip_via) {
sip_via_t *vp;
switch_stream_handle_t stream = { 0 };
int x = 0;
SWITCH_STANDARD_STREAM(stream);
for(vp = sip->sip_via; vp; vp = vp->v_next) {
char *v = sip_header_as_string(nh->nh_home, (void *) vp);
stream.write_function(&stream, x == 0 ? "%s" : ",%s", v);
su_free(nh->nh_home, v);
x++;
}
switch_channel_set_variable(channel, "sip_invite_via", (char *)stream.data);
free(stream.data);
}
if (sip->sip_from) {
char *p = strip_quotes(sip->sip_from->a_display);
@ -7440,16 +7472,6 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
}
}
if (sip->sip_record_route) {
char *rr = sip_header_as_string(nh->nh_home, (void *) sip->sip_record_route);
switch_channel_set_variable(channel, "sip_invite_record_route", rr);
}
if (sip->sip_via) {
char *via = sip_header_as_string(nh->nh_home, (void *) sip->sip_via);
switch_channel_set_variable(channel, "sip_invite_via", via);
}
if ((rpid = sip_remote_party_id(sip))) {
if (rpid->rpid_url && rpid->rpid_url->url_user) {
char *full_rpid_header = sip_header_as_string(nh->nh_home, (void *) rpid);

View File

@ -1943,7 +1943,6 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
sip_cseq_t *cseq = NULL;
const char *invite_record_route = switch_channel_get_variable(tech_pvt->channel, "sip_invite_record_route");
const char *invite_via = switch_channel_get_variable(tech_pvt->channel, "sip_invite_via");
const char *invite_full_via = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_via");
const char *invite_route_uri = switch_channel_get_variable(tech_pvt->channel, "sip_invite_route_uri");
const char *invite_full_from = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_from");
const char *invite_full_to = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_to");
@ -1954,15 +1953,10 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
char *mp = NULL, *mp_type = NULL;
char *record_route = NULL;
if (sofia_test_flag(tech_pvt, TFLAG_RECOVERING)) {
if (!zstr(invite_record_route)) {
record_route = switch_core_session_sprintf(session, "Record-Route: %s", invite_record_route);
}
if (!zstr(invite_via)) {
tech_pvt->user_via = switch_core_session_strdup(session, invite_via);
}
}
@ -2463,7 +2457,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
TAG_IF(invite_full_to, SIPTAG_TO_STR(invite_full_to)),
TAG_IF(tech_pvt->redirected, NUTAG_URL(tech_pvt->redirected)),
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
TAG_IF(!zstr(invite_full_via), SIPTAG_VIA_STR(invite_full_via)),
TAG_IF(!zstr(invite_via), SIPTAG_VIA_STR(invite_via)),
TAG_IF(!zstr(tech_pvt->rpid), SIPTAG_REMOTE_PARTY_ID_STR(tech_pvt->rpid)),
TAG_IF(!zstr(tech_pvt->preferred_id), SIPTAG_P_PREFERRED_IDENTITY_STR(tech_pvt->preferred_id)),
TAG_IF(!zstr(tech_pvt->asserted_id), SIPTAG_P_ASSERTED_IDENTITY_STR(tech_pvt->asserted_id)),
@ -2497,7 +2491,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
TAG_IF(invite_full_to, SIPTAG_TO_STR(invite_full_to)),
TAG_IF(tech_pvt->redirected, NUTAG_URL(tech_pvt->redirected)),
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
TAG_IF(!zstr(invite_full_via), SIPTAG_VIA_STR(invite_full_via)),
TAG_IF(!zstr(invite_via), SIPTAG_VIA_STR(invite_via)),
TAG_IF(!zstr(tech_pvt->rpid), SIPTAG_REMOTE_PARTY_ID_STR(tech_pvt->rpid)),
TAG_IF(!zstr(tech_pvt->preferred_id), SIPTAG_P_PREFERRED_IDENTITY_STR(tech_pvt->preferred_id)),
TAG_IF(!zstr(tech_pvt->asserted_id), SIPTAG_P_ASSERTED_IDENTITY_STR(tech_pvt->asserted_id)),
@ -5432,8 +5426,6 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
tech_pvt->dest = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_req_uri"));
switch_channel_set_variable(channel, "sip_invite_full_via", switch_channel_get_variable(channel, "sip_full_via"));
switch_channel_set_variable(channel, "sip_handle_full_from", switch_channel_get_variable(channel, "sip_full_from"));
switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, "sip_full_to"));
} else {