]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10778: Evaluate rtp_secure_media_mki variable with switch_channel_var_true
authorPiotr <piotr@dataandsignal.com>
Tue, 5 Dec 2017 15:34:52 +0000 (15:34 +0000)
committerMuteesa Fred <muteesafred@hotmail.com>
Tue, 24 Jul 2018 07:21:34 +0000 (07:21 +0000)
Previously rtp_secure_media_mki channel variable was checked only
for existence, now it is checked if it's defined and evaluates
to true with switch_channel_var_true().

src/switch_core_media.c
src/switch_rtp.c

index 83af54f9cc83ec01a298a4c9998f28d42522807a..12e8ae812e1666c9ee7a2d950c235f831c33f781 100644 (file)
@@ -1189,7 +1189,7 @@ static switch_status_t switch_core_media_build_crypto(switch_media_handle_t *smh
 
        if (index == SWITCH_NO_CRYPTO_TAG) index = ctype + 1;
 
-       if (switch_channel_get_variable(channel, "rtp_secure_media_mki")) {     
+       if (switch_channel_var_true(channel, "rtp_secure_media_mki")) { 
                engine->ssec[ctype].local_crypto_key = switch_core_session_sprintf(smh->session, "%d %s inline:%s|2^31|1:1", index, SUITES[ctype].name, b64_key);
        } else {
                engine->ssec[ctype].local_crypto_key = switch_core_session_sprintf(smh->session, "%d %s inline:%s", index, SUITES[ctype].name, b64_key);
@@ -1665,7 +1665,7 @@ static void switch_core_session_apply_crypto(switch_core_session_t *session, swi
 
        if (engine->ssec[engine->crypto_type].remote_crypto_key && switch_channel_test_flag(session->channel, CF_SECURE)) {
                
-               if (switch_channel_get_variable(session->channel, "rtp_secure_media_mki"))
+               if (switch_channel_var_true(session->channel, "rtp_secure_media_mki"))
                        switch_core_media_add_crypto(session, &engine->ssec[engine->crypto_type], SWITCH_RTP_CRYPTO_SEND);
 
                switch_core_media_add_crypto(session, &engine->ssec[engine->crypto_type], SWITCH_RTP_CRYPTO_RECV);
index aed9aecdcc330a049424479676d72ccc31744420..801a3e9053e4b3e6e4c066532ca2e7dbe53eb4fd 100644 (file)
@@ -3981,9 +3981,9 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
        if (key_material && (*key_material_n > 0)) {
 
                if (direction == SWITCH_RTP_CRYPTO_RECV) {
-                       rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV_MKI] = 1;
+                       rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV_MKI] = 1;        /* tell the rest of the environment MKI is used */
                } else {
-                       rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND_MKI] = 1;
+                       rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND_MKI] = 1;        /* tell the rest of the environment MKI is used */
                }
 
                /* key must be NULL for libsrtp to work correctly with MKI. */