Skip to content
Snippets Groups Projects
Commit 05ccb471 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#4243] Init audio srtp remote crypto context in call_on_media_update

parent 277655f6
No related branches found
No related tags found
No related merge requests found
......@@ -45,6 +45,8 @@
#include <cerrno>
bool remoteIsSet;
namespace sfl
{
......@@ -59,6 +61,7 @@ AudioSrtpSession::AudioSrtpSession (ManagerImpl * manager, SIPCall * sipcall) :
_remoteMasterSaltLength (0)
{
remoteIsSet = false;
// initLocalCryptoInfo();
}
......@@ -113,28 +116,31 @@ std::vector<std::string> AudioSrtpSession::getLocalCryptoInfo()
void AudioSrtpSession::setRemoteCryptoInfo (sfl::SdesNegotiator& nego)
{
if (!remoteIsSet) {
_debug ("----------------------------------------------- AudioSrtp: Set remote Cryptographic info for Srtp");
_debug ("----------------------------------------------- AudioSrtp: Set remote Cryptographic info for Srtp");
_debug ("%s", nego.getKeyInfo().c_str());
_debug ("%s", nego.getKeyInfo().c_str());
// Use second crypto suite if key length is 32 bit, default is 80;
_debug ("--------------------------------------------------- auth tag %s", nego.getAuthTagLength().c_str());
// Use second crypto suite if key length is 32 bit, default is 80;
_debug ("--------------------------------------------------- auth tag %s", nego.getAuthTagLength().c_str());
if (nego.getAuthTagLength() == "32") {
_debug ("--------------------------- AudioSrtp: Using %s byte authentication tag length", nego.getAuthTagLength().c_str());
_localCryptoSuite = 1;
_remoteCryptoSuite = 1;
}
if (nego.getAuthTagLength() == "32") {
_debug ("--------------------------- AudioSrtp: Using %s byte authentication tag length", nego.getAuthTagLength().c_str());
_localCryptoSuite = 1;
_remoteCryptoSuite = 1;
}
// decode keys
unBase64ConcatenatedKeys (nego.getKeyInfo());
// decode keys
unBase64ConcatenatedKeys (nego.getKeyInfo());
// init crypto content in Srtp session
initializeRemoteCryptoContext();
setInQueueCryptoContext (_remoteCryptoCtx);
// init crypto content in Srtp session
initializeRemoteCryptoContext();
setInQueueCryptoContext (_remoteCryptoCtx);
// initLocalCryptoInfo();
remoteIsSet = true;
}
// initLocalCryptoInfo();
}
......
......@@ -3337,7 +3337,7 @@ void call_on_media_update (pjsip_inv_session *inv, pj_status_t status)
}
/*
// Get the crypto attribute containing srtp's cryptographic context (keys, cipher)
CryptoOffer crypto_offer;
call->getLocalSDP()->get_remote_sdp_crypto_from_offer (remote_sdp, crypto_offer);
......@@ -3365,7 +3365,7 @@ void call_on_media_update (pjsip_inv_session *inv, pj_status_t status)
try {
call->getAudioRtp()->setRemoteCryptoInfo (sdesnego);
call->getAudioRtp()->initLocalCryptoInfo (call);
// call->getAudioRtp()->initLocalCryptoInfo (call);
} catch (...) {}
DBusManager::instance().getCallManager()->secureSdesOn (call->getCallId());
......@@ -3399,7 +3399,6 @@ void call_on_media_update (pjsip_inv_session *inv, pj_status_t status)
// enabled for this call, make a try using RTP only...
_debug ("UserAgent: SDES not initialized for this call\n");
}
*/
Sdp *sdpSession = call->getLocalSDP();
......@@ -3965,7 +3964,6 @@ mod_on_rx_request (pjsip_rx_data *rdata)
call->getAudioRtp()->initAudioRtpConfig (call);
call->getAudioRtp()->initAudioRtpSession (call);
call->getAudioRtp()->setRemoteCryptoInfo (sdesnego);
_debug ("------------------------------------------------ init local crypto info");
call->getAudioRtp()->initLocalCryptoInfo (call);
} catch (...) {
_warn ("UserAgent: Error: Failed to create rtp thread from answer");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment