Stop generating SWITCH_RTP_CRYPTO_SEND upon late offer i.e ack with sdp

This commit is contained in:
bmoradiy 2023-12-20 12:27:56 +05:30
parent f1fb05214e
commit 2a10e4efa1
3 changed files with 11 additions and 2 deletions

View File

@ -1630,6 +1630,7 @@ typedef enum {
CF_VIDEO_READ_TAPPED,
CF_VIDEO_WRITE_TAPPED,
CF_DEVICES_CHANGED,
CF_LATE_OFFER,
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
/* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */
CF_FLAG_MAX

View File

@ -7496,6 +7496,10 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
if (r_sdp) {
switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp);
if (ss_state == nua_callstate_ready && status == 200) {
switch_channel_set_flag(tech_pvt->channel, CF_LATE_OFFER);
}
if (!(profile->mndlb & SM_NDLB_ALLOW_NONDUP_SDP) || (!zstr(tech_pvt->mparams.remote_sdp_str) && !strcmp(tech_pvt->mparams.remote_sdp_str, r_sdp))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Duplicate SDP\n%s\n", r_sdp);
is_dup_sdp = 1;

View File

@ -1731,8 +1731,12 @@ SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_sessio
}
switch_channel_set_variable(session->channel, varname, vval);
switch_core_media_build_crypto(session->media_handle, type, crypto_tag, ctype, SWITCH_RTP_CRYPTO_SEND, 1, use_alias);
switch_rtp_add_crypto_key(engine->rtp_session, SWITCH_RTP_CRYPTO_SEND, atoi(crypto), &engine->ssec[engine->crypto_type]);
if (!switch_channel_test_flag(session->channel, CF_LATE_OFFER) || !switch_true(switch_channel_get_variable(session->channel, "disable_crypto_rekeying_on_late_offer"))) {
switch_core_media_build_crypto(session->media_handle, type, crypto_tag, ctype, SWITCH_RTP_CRYPTO_SEND, 1, use_alias);
switch_rtp_add_crypto_key(engine->rtp_session, SWITCH_RTP_CRYPTO_SEND, atoi(crypto), &engine->ssec[engine->crypto_type]);
}
switch_channel_clear_flag(session->channel, CF_LATE_OFFER);
}
if (a && b && !strncasecmp(a, b, 23)) {