1
0
mirror of https://github.com/signalwire/freeswitch.git synced 2025-04-07 21:32:56 +00:00

FS-9782: [mod_sofia] on recovery, don't flip the order of the record route ever, on outbound calls use the record route in the reverse order as the initial route set when doing the recover invite

This commit is contained in:
Mike Jerris 2016-11-29 15:04:06 -07:00
parent 553f3ac1ac
commit cacebb1557
2 changed files with 11 additions and 2 deletions
src/mod/endpoints/mod_sofia

@ -223,22 +223,31 @@ static void extract_header_vars(sofia_profile_t *profile, sip_t const *sip,
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
char *tmp[128] = { 0 };
int y = 0;
switch_stream_handle_t route_stream = { 0 };
SWITCH_STANDARD_STREAM(route_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);
tmp[y++] = rr;
if (y == 127) break;
x++;
}
y--;
x = 0;
while(y >= 0) {
stream.write_function(&stream, x == 0 ? "%s" : ",%s", tmp[y]);
route_stream.write_function(&route_stream, x == 0 ? "%s" : ",%s", tmp[y]);
su_free(nh->nh_home, tmp[y]);
y--;
x++;
}
switch_channel_set_variable(channel, "sip_invite_route_uri", (char *)route_stream.data);
free(route_stream.data);
} else {
for(rrp = sip->sip_record_route; rrp; rrp = rrp->r_next) {
char *rr = sip_header_as_string(nh->nh_home, (void *) rrp);

@ -1950,7 +1950,7 @@ int sofia_recover_callback(switch_core_session_t *session)
}
}
if (rr) {
if (rr && !switch_channel_get_variable(channel, "sip_invite_route_uri")) {
switch_channel_set_variable(channel, "sip_invite_route_uri", rr);
}