]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7386
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 26 Mar 2015 22:48:39 +0000 (17:48 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 27 Mar 2015 04:52:53 +0000 (23:52 -0500)
Conflicts:
src/switch_core_media.c

src/include/switch_core_media.h
src/switch_channel.c
src/switch_core_media.c

index 1915b742ae756b181f7831b5faac64d6e0313ffb..808e22fc10b4515a4300f7c27eccf0953e6476ef 100644 (file)
@@ -282,7 +282,7 @@ SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_se
                                                                                                                                  uint32_t channels,
                                                                                                                                  uint8_t negotiated);
 
-
+SWITCH_DECLARE(switch_status_t) switch_core_media_check_autoadj(switch_core_session_t *session);
 SWITCH_DECLARE(switch_rtp_crypto_key_type_t) switch_core_media_crypto_str2type(const char *str);
 SWITCH_DECLARE(const char *) switch_core_media_crypto_type2str(switch_rtp_crypto_key_type_t type);
 SWITCH_DECLARE(int) switch_core_media_crypto_keylen(switch_rtp_crypto_key_type_t type);
index 3b96dcdc4dc40a6f64031c4479f2751741078d4c..64d42fb8d23db3a464fa8d2236750e1803b241ea 100644 (file)
@@ -3400,6 +3400,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_
 
                send_ind(channel, SWITCH_MESSAGE_PROGRESS_EVENT, file, func, line);
 
+               switch_core_media_check_autoadj(channel->session);
+
                return SWITCH_STATUS_SUCCESS;
        }
 
@@ -3689,7 +3691,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan
        switch_channel_set_callstate(channel, CCS_ACTIVE);
 
        send_ind(channel, SWITCH_MESSAGE_ANSWER_EVENT, file, func, line);
-
+       
+       switch_core_media_check_autoadj(channel->session);
 
        return SWITCH_STATUS_SUCCESS;
 }
index 7d6d443fbf9f5964aa2a2c29835e352d4e1fe121..a5099058de9d76e592dd8eef88166f01226eb29e 100644 (file)
@@ -426,7 +426,41 @@ static switch_t38_options_t * switch_core_media_process_udptl(switch_core_sessio
        return t38_options;
 }
 
+SWITCH_DECLARE(switch_status_t) switch_core_media_check_autoadj(switch_core_session_t *session)
+{
+       switch_rtp_engine_t *a_engine;
+       switch_rtp_engine_t *v_engine;
+       switch_media_handle_t *smh;
+       const char *val;
+       int x = 0;
 
+       switch_assert(session);
+
+       if (!(smh = session->media_handle)) {
+               return SWITCH_STATUS_FALSE;
+       }
+
+       a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
+       v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];      
+       
+       if (!switch_media_handle_test_media_flag(smh, SCMF_DISABLE_RTP_AUTOADJ) &&
+               !((val = switch_channel_get_variable(session->channel, "disable_rtp_auto_adjust")) && switch_true(val)) && 
+               !switch_channel_test_flag(session->channel, CF_AVPF)) {
+               /* Reactivate the NAT buster flag. */
+               
+               if (a_engine->rtp_session) {
+                       switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
+                       x++;
+               }
+               
+               if (v_engine->rtp_session) {
+                       switch_rtp_set_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
+                       x++;
+               }
+       }
+
+       return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
+}
 
 
 
@@ -4119,11 +4153,6 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
 
  done:
 
-
-
-
-
-
        if (parser) {
                sdp_parser_free(parser);
        }
@@ -4233,7 +4262,6 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session
                switch_channel_clear_flag(session->channel, CF_HOLD_LOCK);
 
                if (switch_channel_test_flag(session->channel, CF_PROTO_HOLD)) {
-                       const char *val;
                        int media_on_hold_a = switch_true(switch_channel_get_variable_dup(session->channel, "bypass_media_resume_on_hold", SWITCH_FALSE, -1));
                        int media_on_hold_b = 0;
                        int bypass_after_hold_a = 0;
@@ -4273,19 +4301,7 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session
                                }
                        }
 
-                       if (!switch_media_handle_test_media_flag(smh, SCMF_DISABLE_RTP_AUTOADJ) &&
-                               !((val = switch_channel_get_variable(session->channel, "disable_rtp_auto_adjust")) && switch_true(val)) && 
-                               !switch_channel_test_flag(session->channel, CF_WEBRTC)) {
-                               /* Reactivate the NAT buster flag. */
-
-                               if (a_engine->rtp_session) {
-                                       switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
-                               }
-
-                               if (v_engine->rtp_session) {
-                                       switch_rtp_set_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
-                               }
-                       }
+                       switch_core_media_check_autoadj(session);
 
                        switch_channel_clear_flag(session->channel, CF_PROTO_HOLD);
                        switch_channel_mark_hold(session->channel, SWITCH_FALSE);