]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
few bugs on recent new features
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 3 Oct 2014 20:36:23 +0000 (15:36 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 3 Oct 2014 20:36:23 +0000 (15:36 -0500)
src/mod/endpoints/mod_sofia/sofia.c
src/switch_core_media.c

index ea3e567b1fe6a3eab144261326513893465b9c40..789a51e223370e9a0ec046747a10486ad1d5094c 100644 (file)
@@ -6364,37 +6364,36 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                if (!tech_pvt || !tech_pvt->nh) {
                        goto done;
                }
-       }
-
-       if (tech_pvt) {
+       
                if ((status > 100 || switch_channel_test_flag(channel, CF_ANSWERED)) && status < 300 && !r_sdp && tech_pvt->mparams.last_sdp_str) {
                        r_sdp = tech_pvt->mparams.last_sdp_str;
                }
                tech_pvt->mparams.last_sdp_str = NULL;
-       }
-
-       if (r_sdp && (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA))) {
-               const char *var;
-
-               if ((var = switch_channel_get_variable(channel, "bypass_media_sdp_filter"))) {
-                       if ((patched_sdp = switch_core_media_process_sdp_filter(r_sdp, var, session))) {
-                               r_sdp = patched_sdp;
+       
+               
+               if (r_sdp && (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA))) {
+                       const char *var;
+                       
+                       if ((var = switch_channel_get_variable(channel, "bypass_media_sdp_filter"))) {
+                               if ((patched_sdp = switch_core_media_process_sdp_filter(r_sdp, var, session))) {
+                                       r_sdp = patched_sdp;
+                               }
                        }
                }
-       }
 
-       if ((channel && (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA))) ||
-               (sofia_test_flag(profile, TFLAG_INB_NOMEDIA) || sofia_test_flag(profile, TFLAG_PROXY_MEDIA))) {
-
-               /* This marr in our code brought to you by people who can't read........ */
-               if (profile->ndlb & SM_NDLB_ALLOW_BAD_IANANAME && r_sdp && (p = (char *) switch_stristr("g729a/8000", r_sdp))) {
-                       p += 4;
-                       *p++ = '/';
-                       *p++ = '8';
-                       *p++ = '0';
-                       *p++ = '0';
-                       *p++ = '0';
-                       *p++ = ' ';
+               if ((switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) ||
+                       (sofia_test_flag(profile, TFLAG_INB_NOMEDIA) || sofia_test_flag(profile, TFLAG_PROXY_MEDIA))) {
+                       
+                       /* This marr in our code brought to you by people who can't read........ */
+                       if (profile->ndlb & SM_NDLB_ALLOW_BAD_IANANAME && r_sdp && (p = (char *) switch_stristr("g729a/8000", r_sdp))) {
+                               p += 4;
+                               *p++ = '/';
+                               *p++ = '8';
+                               *p++ = '0';
+                               *p++ = '0';
+                               *p++ = '0';
+                               *p++ = ' ';
+                       }
                }
        }
 
index 730799a5dd2309bfad1cf87c5b0a869c82d72fc2..852cdfc4bc4271134f9b93d9d6b2686cfc24865a 100644 (file)
@@ -8966,7 +8966,7 @@ SWITCH_DECLARE(char *) switch_core_media_filter_sdp(const char *sdp_str, const c
        }
 
 
-       len = strlen(sdp_str);
+       len = strlen(sdp_str) + 1;
        new_sdp = malloc(len);
        o = new_sdp;
        i = sdp_str;
@@ -9095,7 +9095,6 @@ SWITCH_DECLARE(char *) switch_core_media_process_sdp_filter(const char *sdp, con
        int argc = 0;
        char *argv[50];
        int x = 0;
-       char *use_sdp = (char *) sdp;
        char *patched_sdp = NULL;
 
        argc = switch_split(cmd, '|', argv);
@@ -9118,19 +9117,19 @@ SWITCH_DECLARE(char *) switch_core_media_process_sdp_filter(const char *sdp, con
                        if (patched_sdp) {
                                tmp_sdp = switch_core_media_filter_sdp(patched_sdp, command, arg);
                        } else {
-                               tmp_sdp = switch_core_media_filter_sdp(use_sdp, command, arg);
+                               tmp_sdp = switch_core_media_filter_sdp(sdp, command, arg);
                        }
 
 
                        switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, 
                                                          "%s Filter command %s(%s)\nFROM:\n==========\n%s\nTO:\n==========\n%s\n\n", 
                                                          switch_channel_get_name(channel),
-                                                         command, arg, patched_sdp ? patched_sdp : use_sdp, tmp_sdp);
-
+                                                         command, arg, patched_sdp ? patched_sdp : sdp, tmp_sdp);
+                       
 
                        if (tmp_sdp) {
                                switch_safe_free(patched_sdp);
-                               patched_sdp = use_sdp = tmp_sdp;
+                               patched_sdp = tmp_sdp;
                        }
                }
        }