}
}
+ 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 };
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);
}
su_free(nh->nh_home, full);
}
}
+
if (sip->sip_to) {
char *p = strip_quotes(sip->sip_to->a_display);
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);
+ }
}
-
-
+
+
rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER);
switch_assert(tech_pvt != NULL);
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);
}
}
+ 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")
}
}
+ 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);