send_ind(channel, SWITCH_MESSAGE_PROGRESS_EVENT, file, func, line);
+ switch_core_media_check_autoadj(channel->session);
+
return SWITCH_STATUS_SUCCESS;
}
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;
}
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;
+}
done:
-
-
-
-
-
if (parser) {
sdp_parser_free(parser);
}
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;
}
}
- 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);