From 55d03810ce06060f8c16bc1c69bb9c1fe7064e94 Mon Sep 17 00:00:00 2001 From: Ajay Sabat Date: Wed, 11 Nov 2020 12:55:27 -0800 Subject: [PATCH] Fix [switch_core_media.c]: Store the last local crypto key Now storing the local key corresponding to the crypto type that was negotiated with the remote side in the channel variable 'rtp_last_audio_local_crypto_key'. --- src/switch_core_media.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index e0416e0768..9b515a31b1 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -1211,7 +1211,6 @@ static switch_status_t switch_core_media_build_crypto(switch_media_handle_t *smh engine->ssec[ctype].local_crypto_key = switch_core_session_sprintf(smh->session, "%d %s inline:%s", index, (use_alias ? SUITES[ctype].alias : SUITES[ctype].name), b64_key); } - switch_channel_set_variable_name_printf(smh->session->channel, engine->ssec[ctype].local_crypto_key, "rtp_last_%s_local_crypto_key", type2str(type)); switch_channel_set_flag(smh->session->channel, CF_SECURE); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG, "Set Local %s crypto Key [%s]\n", @@ -1895,6 +1894,7 @@ SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_sessio if (engine->type == SWITCH_MEDIA_TYPE_AUDIO) { switch_channel_set_variable(session->channel, "srtp_remote_audio_crypto_key", crypto); switch_channel_set_variable_printf(session->channel, "srtp_remote_audio_crypto_type", "%s", switch_core_media_crypto_type2str(ctype)); + switch_channel_set_variable_printf(session->channel, "rtp_last_audio_local_crypto_key", "%s", engine->ssec[engine->crypto_type].local_crypto_key); } else if (engine->type == SWITCH_MEDIA_TYPE_VIDEO) { switch_channel_set_variable(session->channel, "srtp_remote_video_crypto_key", crypto); switch_channel_set_variable_printf(session->channel, "srtp_remote_video_crypto_type", "%s", switch_core_media_crypto_type2str(ctype));