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

[#1722] Added setRemoteCryptoInfo function in AudioSrtpSession/AudioRtpFactory

parent 01b09192
No related branches found
No related tags found
No related merge requests found
...@@ -110,7 +110,7 @@ void AudioRtpFactory::initAudioRtpSession (SIPCall * ca) ...@@ -110,7 +110,7 @@ void AudioRtpFactory::initAudioRtpSession (SIPCall * ca)
_rtpSession = new AudioSrtpSession (&Manager::instance(), ca); _rtpSession = new AudioSrtpSession (&Manager::instance(), ca);
_rtpSessionType = Sdes; _rtpSessionType = Sdes;
ca->getLocalSDP()->set_srtp_crypto(static_cast<AudioSrtpSession *> (_rtpSession)->getCryptoSdpInfo()); ca->getLocalSDP()->set_srtp_crypto(static_cast<AudioSrtpSession *> (_rtpSession)->getLocalCryptoInfo());
break; break;
default: default:
...@@ -197,4 +197,16 @@ sfl::AudioZrtpSession * AudioRtpFactory::getAudioZrtpSession() ...@@ -197,4 +197,16 @@ sfl::AudioZrtpSession * AudioRtpFactory::getAudioZrtpSession()
throw AudioRtpFactoryException(); throw AudioRtpFactoryException();
} }
} }
void AudioRtpFactory::setRemoteCryptoInfo()
{
if ( (_rtpSessionType != NULL) && (_rtpSessionType != Sdes)) {
static_cast<AudioSrtpSession *> (_rtpSession)->setRemoteCryptoInfo();
}
else {
throw AudioRtpFactoryException();
} }
}
}
...@@ -93,6 +93,12 @@ namespace sfl { ...@@ -93,6 +93,12 @@ namespace sfl {
*/ */
sfl::AudioZrtpSession * getAudioZrtpSession(); sfl::AudioZrtpSession * getAudioZrtpSession();
/**
* Set remote cryptographic info. Should be called after negotiation in SDP
* offer/answer session.
*/
void setRemoteCryptoInfo();
private: private:
void * _rtpSession; void * _rtpSession;
RtpMethod _rtpSessionType; RtpMethod _rtpSessionType;
......
...@@ -52,14 +52,14 @@ AudioSrtpSession::AudioSrtpSession (ManagerImpl * manager, SIPCall * sipcall) : ...@@ -52,14 +52,14 @@ AudioSrtpSession::AudioSrtpSession (ManagerImpl * manager, SIPCall * sipcall) :
initializeInputCryptoContext(); initializeInputCryptoContext();
initializeOutputCryptoContext(); initializeOutputCryptoContext();
outputCryptoCtx->deriveSrtpKeys(0); _outputCryptoCtx->deriveSrtpKeys(0);
setInQueueCryptoContext(inputCryptoCtx); setInQueueCryptoContext(_inputCryptoCtx);
setOutQueueCryptoContext(outputCryptoCtx); setOutQueueCryptoContext(_outputCryptoCtx);
} }
std::string AudioSrtpSession::getCryptoSdpInfo() { std::string AudioSrtpSession::getLocalCryptoInfo() {
_debug("Get Cryptographic info from this rtp session"); _debug("Get Cryptographic info from this rtp session");
...@@ -86,6 +86,13 @@ std::string AudioSrtpSession::getCryptoSdpInfo() { ...@@ -86,6 +86,13 @@ std::string AudioSrtpSession::getCryptoSdpInfo() {
} }
void AudioSrtpSession::setRemoteCryptoInfo() {
_debug("Set remote Cryptographic info for this rtp session");
}
void AudioSrtpSession::initializeMasterKey(void) void AudioSrtpSession::initializeMasterKey(void)
{ {
_masterKeyLength = 16; _masterKeyLength = 16;
...@@ -133,7 +140,7 @@ void AudioSrtpSession::initializeInputCryptoContext(void) ...@@ -133,7 +140,7 @@ void AudioSrtpSession::initializeInputCryptoContext(void)
// this one does not works // this one does not works
// inputCryptoCtx = new ost::CryptoContext(IncomingDataQueue::getLocalSSRCNetwork(), // inputCryptoCtx = new ost::CryptoContext(IncomingDataQueue::getLocalSSRCNetwork(),
inputCryptoCtx = new ost::CryptoContext(0x0, _inputCryptoCtx = new ost::CryptoContext(0x0,
0, // roc, 0, // roc,
0L, // keydr, 0L, // keydr,
SrtpEncryptionAESCM, // encryption algo SrtpEncryptionAESCM, // encryption algo
...@@ -155,7 +162,7 @@ void AudioSrtpSession::initializeOutputCryptoContext(void) ...@@ -155,7 +162,7 @@ void AudioSrtpSession::initializeOutputCryptoContext(void)
// this one works // this one works
// outputCryptoCtx = new ost::CryptoContext(OutgoingDataQueue::getLocalSSRC(), // outputCryptoCtx = new ost::CryptoContext(OutgoingDataQueue::getLocalSSRC(),
outputCryptoCtx = new ost::CryptoContext(OutgoingDataQueue::getLocalSSRC(), _outputCryptoCtx = new ost::CryptoContext(OutgoingDataQueue::getLocalSSRC(),
0, // roc, 0, // roc,
0L, // keydr, 0L, // keydr,
SrtpEncryptionAESCM, // encryption algo SrtpEncryptionAESCM, // encryption algo
......
...@@ -42,7 +42,9 @@ namespace sfl { ...@@ -42,7 +42,9 @@ namespace sfl {
AudioSrtpSession(ManagerImpl * manager, SIPCall * sipcall); AudioSrtpSession(ManagerImpl * manager, SIPCall * sipcall);
std::string getCryptoSdpInfo(void); std::string getLocalCryptoInfo(void);
void setRemoteCryptoInfo(void);
private: private:
...@@ -68,9 +70,9 @@ namespace sfl { ...@@ -68,9 +70,9 @@ namespace sfl {
int _masterSaltLength; int _masterSaltLength;
ost::CryptoContext* inputCryptoCtx; ost::CryptoContext* _inputCryptoCtx;
ost::CryptoContext* outputCryptoCtx; ost::CryptoContext* _outputCryptoCtx;
}; };
} }
......
...@@ -3217,6 +3217,8 @@ void call_on_media_update (pjsip_inv_session *inv, pj_status_t status) ...@@ -3217,6 +3217,8 @@ void call_on_media_update (pjsip_inv_session *inv, pj_status_t status)
pjmedia_sdp_attr *attribute; pjmedia_sdp_attr *attribute;
call->getLocalSDP()->get_remote_sdp_crypto_from_offer(remote_sdp, &attribute); call->getLocalSDP()->get_remote_sdp_crypto_from_offer(remote_sdp, &attribute);
// create remote cryptografic offer // create remote cryptografic offer
std::vector<std::string> remoteOffer; std::vector<std::string> remoteOffer;
...@@ -3231,6 +3233,14 @@ void call_on_media_update (pjsip_inv_session *inv, pj_status_t status) ...@@ -3231,6 +3233,14 @@ void call_on_media_update (pjsip_inv_session *inv, pj_status_t status)
sfl::SdesNegotiator sdesnego(localCapabilities, remoteOffer); sfl::SdesNegotiator sdesnego(localCapabilities, remoteOffer);
sdesnego.negotiate();
if(sdesnego.negotiate()) {
_debug("******************** Negociation Is Successfull *********************\n");
call->getAudioRtp()->setRemoteCryptoInfo();
}
try { try {
call->setAudioStart (true); call->setAudioStart (true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment