Conflicts:
	src/switch_core_media.c
This commit is contained in:
Anthony Minessale 2015-03-26 17:48:39 -05:00
parent 183570bd94
commit 2c92ef31e3
3 changed files with 40 additions and 21 deletions

View 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);

View 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;
}

View 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);