]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9782: [mod_sofia] on recovery, don't flip the order of the record route ever,...
authorMike Jerris <mike@jerris.com>
Tue, 29 Nov 2016 22:04:06 +0000 (15:04 -0700)
committerMike Jerris <mike@jerris.com>
Tue, 29 Nov 2016 22:04:17 +0000 (15:04 -0700)
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c

index f5141e4703742a3215edacf977c3a9c09c7cdf85..1a1cd2a0f711f4171a96690945d06d470e796936 100644 (file)
@@ -224,22 +224,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);
index 6b523ac993fd0ed7c2fb92c9830f1e9a778ec58d..7bc26b94e7f2b409799fb3a863a49c753f122120 100644 (file)
@@ -1953,7 +1953,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);
        }