This commit is contained in:
Anthony Minessale 2011-11-16 09:57:15 -06:00
parent fa5289eab7
commit 189e0161c9
2 changed files with 27 additions and 9 deletions

View File

@ -183,6 +183,12 @@ static void extract_header_vars(sofia_profile_t *profile, sip_t const *sip,
}
}
if (sip->sip_contact) {
char *c = sip_header_as_string(nh->nh_home, (void *) sip->sip_contact);
switch_channel_set_variable(channel, "sip_invite_contact", c);
su_free(nh->nh_home, c);
}
if (sip->sip_record_route) {
sip_record_route_t *rrp;
switch_stream_handle_t stream = { 0 };
@ -235,6 +241,7 @@ static void extract_header_vars(sofia_profile_t *profile, sip_t const *sip,
su_free(nh->nh_home, full);
}
}
if (sip->sip_to) {
char *p = strip_quotes(sip->sip_to->a_display);

View File

@ -1954,9 +1954,16 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
char *record_route = NULL;
if (sofia_test_flag(tech_pvt, TFLAG_RECOVERING)) {
const char *recover_contact = switch_channel_get_variable(tech_pvt->channel, "sip_recover_contact");
if (!zstr(invite_record_route)) {
record_route = switch_core_session_sprintf(session, "Record-Route: %s", invite_record_route);
}
if (recover_contact) {
char *tmp = switch_core_session_strdup(session, recover_contact);
tech_pvt->redirected = sofia_glue_get_url_from_contact(tmp, 0);
}
}
@ -5384,6 +5391,7 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
switch_channel_t *channel;
private_object_t *tech_pvt = NULL;
const char *tmp;
const char *rr;
xml = switch_xml_parse_str_dynamic(argv[3], SWITCH_TRUE);
@ -5424,18 +5432,17 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
}
}
rr = switch_channel_get_variable(channel, "sip_invite_record_route");
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_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 {
const char *rr;
tech_pvt->redirected = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_contact_uri"));
if ((rr = switch_channel_get_variable(channel, "sip_invite_record_route"))) {
switch_channel_set_variable(channel, "sip_invite_route_uri", rr);
} else {
if (zstr(rr)) {
switch_channel_set_variable_printf(channel, "sip_invite_route_uri", "<sip:%s@%s:%s;lr>",
switch_channel_get_variable(channel, "sip_from_user"),
switch_channel_get_variable(channel, "sip_network_ip"), switch_channel_get_variable(channel, "sip_network_port")
@ -5453,6 +5460,10 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
}
}
if (rr) {
switch_channel_set_variable(channel, "sip_invite_route_uri", rr);
}
tech_pvt->dest_to = tech_pvt->dest;
sofia_glue_attach_private(session, h->profile, tech_pvt, NULL);