Commit 320e5ae2 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

#13892: Make ZRTP and optional feature

parent 0f5bafaa
......@@ -163,13 +163,11 @@ PKG_CHECK_MODULES([CCRTP], [libccrtp] >= ${LIBCCRTP_MIN_VERSION},, [
###############################################################################################################################
# TLS #
# required dependency(ies): libssl #
###############################################################################################################################
# TLS
# required dependency(ies): libssl
dnl Check for OpenSSL to link against pjsip and provide SIPS TLS support
AC_ARG_WITH([tls],
[ AS_HELP_STRING([--without-tls], [disable support tls]) ],
[ AS_HELP_STRING([--without-tls], [disable tls support]) ],
[],
[with_tls=yes])
AS_IF([test "xwith_tls" = "xyes"], [
......@@ -180,14 +178,26 @@ AC_DEFINE_UNQUOTED([HAVE_TLS], `if test "x$with_tls" = "xyes"; then echo 1; else
AM_CONDITIONAL(BUILD_TLS, test "x$with_tls" = "xyes" )
###############################################################################################################################
# ZRTP #
# required dependency(ies): libzrtp #
###############################################################################################################################
# ZRTP
# required dependency(ies): libzrtp
dnl Check for libzrtpcpp, a ccRTP extension providing zrtp key exchange
LIBZRTPCPP_MIN_VERSION=1.3.0
PKG_CHECK_MODULES(ZRTPCPP, libzrtpcpp >= ${LIBZRTPCPP_MIN_VERSION},, AC_MSG_ERROR([Missing zrtp development package: libzrtpcpp-dev]))
AC_ARG_WITH([zrtp],
[ AS_HELP_STRING([--without-zrtp], [disable zrtp support]) ],
[],
[with_zrtp=yes])
AS_IF([test "xwith_zrtp" = "xyes"], [
PKG_CHECK_MODULES(ZRTPCPP, libzrtpcpp >= ${LIBZRTPCPP_MIN_VERSION},, AC_MSG_ERROR([Missing zrtp development package: libzrtpcpp-dev]))
]);
AC_DEFINE_UNQUOTED([HAVE_ZRTP], `if test "x$with_zrtp" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have zrtp support])
AM_CONDITIONAL(BUILD_ZRTP, test "x$with_zrtp" = "xyes" )
# DBUS
# required dependency(ies): libdbus-c++
dnl DBus-C++ detection
dnl pkg-config doesn't like 0.6.0-pre1 version number, it assumes that it is
dnl more recent than (unreleased) 0.6.0
......@@ -197,10 +207,8 @@ AC_MSG_ERROR([You need the DBus-c++ libraries (version $DBUS_CPP_REQUIRED_VERSIO
###############################################################################################################################
# Instant Messaging #
# required dependency(ies): libxpat #
###############################################################################################################################
# Instant Messaging
# required dependency(ies): libxpat
AC_ARG_WITH([instant_messaging],
[ AS_HELP_STRING([--without-instant_messaging], [disable support for instant-messaging]) ],
[],
......@@ -214,14 +222,16 @@ AS_IF([test "x$with_instant_messaging" = "xyes"], [
AC_DEFINE_UNQUOTED([HAVE_INSTANT_MESSAGING], `if test "x$with_instant_messaging" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have instant messaging support])
AM_CONDITIONAL(BUILD_INSTANT_MESSAGING, test "x$with_instant_messaging" = "xyes" )
# PTHREAD
# required dependency(ies): libxpat
AX_PTHREAD
###############################################################################################################################
# SDES Key Exchange #
# required dependency(ies): libpcre #
###############################################################################################################################
# SDES Key Exchange
# required dependency(ies): libpcre
AC_ARG_WITH([sdes],
[ AS_HELP_STRING([--without-sdes], [disable support for sdes key exchange]) ],
[],
......@@ -240,10 +250,8 @@ PKG_CHECK_MODULES(CPPUNIT, cppunit >= ${CPPUNIT_MIN_VERSION}, AM_CONDITIONAL(BUI
###############################################################################################################################
# GSM CODEC #
# required dependency(ies): libgsm #
###############################################################################################################################
# GSM CODEC
# required dependency(ies): libgsm
dnl check for libgsm1 (doesn't use pkg-config)
dnl Check for libgsm
AC_ARG_WITH([gsm], [AS_HELP_STRING([--without-gsm],
......@@ -262,10 +270,8 @@ AM_CONDITIONAL(BUILD_GSM, test "x$with_gsm" = "xyes" )
###############################################################################################################################
# SPEEX CODEC #
# required dependency(ies): libspeex #
###############################################################################################################################
# SPEEX CODEC
# required dependency(ies): libspeex
dnl Check for libspeex
AC_ARG_WITH([speex],
[AS_HELP_STRING([--without-speex],
......@@ -285,10 +291,8 @@ AM_CONDITIONAL(BUILD_SPEEX, test "x$with_speex" = "xyes" )
###############################################################################################################################
# SPEEX DSP #
# required dependency(ies): libspeexdsp #
###############################################################################################################################
# SPEEX DSP
# required dependency(ies): libspeexdsp
dnl check in case the libspeexdsp is not installed
AC_ARG_WITH([speexdsp],
[AS_HELP_STRING([--without-speexdsp],
......@@ -308,10 +312,8 @@ AM_CONDITIONAL(BUILD_SPEEXDSP, test "x$with_speexdsp" = "xyes" )
###############################################################################################################################
# IAX #
# required dependency(ies): libiax2 (static) #
###############################################################################################################################
# IAX
# required dependency(ies): libiax2 (static)
dnl Check for IAX
AC_ARG_WITH([iax2], [AS_HELP_STRING([--without-iax2],
[disable support for the iax2 protocol])], [], [with_iax2=yes])
......@@ -321,6 +323,8 @@ AM_CONDITIONAL(USE_IAX, test "x$with_iax2" = "xyes" )
# NETWORK MANAGER
# required dependency(ies): libiax2 (static)
dnl Check for network-manager
AC_ARG_WITH([networkmanager], [AS_HELP_STRING([--without-networkmanager],
[disable support for network-manager events])], [],
......@@ -330,10 +334,8 @@ AM_CONDITIONAL(USE_NETWORKMANAGER, test "x$with_networkmanager" = "xyes" )
###############################################################################################################################
# DOXYGEN #
# required dependency(ies): doxygen #
###############################################################################################################################
# DOXYGEN
# required dependency(ies): doxygen
# check for doxygen, mostly stolen from http://log4cpp.sourceforge.net/
# ----------------------------------------------------------------------------
AC_DEFUN([BB_ENABLE_DOXYGEN],
......
......@@ -2,19 +2,19 @@ include $(top_srcdir)/globals.mak
noinst_LTLIBRARIES = libaudiortp.la
if BUILD_ZRTP
SFL_ZRTP_SRC=audio_zrtp_session.h audio_zrtp_session.cpp zrtp_session_callback.cpp zrtp_session_callback.h
endif
libaudiortp_la_SOURCES = \
$(SFL_ZRTP_SRC) \
audio_rtp_session.cpp \
audio_symmetric_rtp_session.cpp \
audio_rtp_record_handler.cpp \
audio_rtp_factory.cpp \
audio_zrtp_session.cpp \
zrtp_session_callback.cpp \
audio_srtp_session.cpp \
audio_rtp_session.h \
audio_rtp_record_handler.h \
audio_rtp_factory.h \
audio_symmetric_rtp_session.h \
audio_zrtp_session.h \
zrtp_session_callback.h \
audio_srtp_session.h
......@@ -29,7 +29,9 @@
*/
#include "audio_rtp_factory.h"
#if HAVE_ZRTP
#include "audio_zrtp_session.h"
#endif
#include "audio_symmetric_rtp_session.h"
#include "manager.h"
#include "sip/sdp.h"
......@@ -37,6 +39,7 @@
#include "sip/sipaccount.h"
#include "sip/sdes_negotiator.h"
#include "logger.h"
#include "config.h"
namespace sfl {
......@@ -69,10 +72,14 @@ void AudioRtpFactory::initConfig()
srtpEnabled_ = account->getSrtpEnabled();
std::string key(account->getSrtpKeyExchange());
if (srtpEnabled_) {
#if HAVE_ZRTP
if (key == "sdes")
keyExchangeProtocol_ = SDES;
else if (key == "zrtp")
keyExchangeProtocol_ = ZRTP;
#else
keyExchangeProtocol_ = SDES;
#endif
} else {
keyExchangeProtocol_ = NONE;
}
......@@ -93,7 +100,7 @@ void AudioRtpFactory::initSession()
const std::string zidFilename(Manager::instance().voipPreferences.getZidFile());
switch (keyExchangeProtocol_) {
#if HAVE_ZRTP
case ZRTP:
rtpSession_ = new AudioZrtpSession(*ca_, zidFilename);
// TODO: be careful with that. The hello hash is computed asynchronously. Maybe it's
......@@ -101,7 +108,7 @@ void AudioRtpFactory::initSession()
if (helloHashEnabled_)
ca_->getLocalSDP()->setZrtpHash(static_cast<AudioZrtpSession *>(rtpSession_)->getHelloHash());
break;
#endif
case SDES:
rtpSession_ = new AudioSrtpSession(*ca_);
break;
......@@ -152,6 +159,7 @@ void AudioRtpFactory::updateDestinationIpAddress()
rtpSession_->updateDestinationIpAddress();
}
#if HAVE_ZRTP
sfl::AudioZrtpSession * AudioRtpFactory::getAudioZrtpSession()
{
if (keyExchangeProtocol_ == ZRTP)
......@@ -159,6 +167,7 @@ sfl::AudioZrtpSession * AudioRtpFactory::getAudioZrtpSession()
else
throw AudioRtpFactoryException("rtpSession_ is NULL in getAudioZrtpSession");
}
#endif
void sfl::AudioRtpFactory::initLocalCryptoInfo()
{
......
......@@ -46,7 +46,9 @@ class SIPCall;
namespace sfl {
#if HAVE_ZRTP
class AudioZrtpSession;
#endif
class AudioCodec;
class UnsupportedRtpSessionType : public std::logic_error {
......@@ -115,12 +117,14 @@ class AudioRtpFactory {
srtpEnabled_ = enable;
}
#if HAVE_ZRTP
/**
* Get the current AudioZrtpSession. Throws an AudioRtpFactoryException
* if the current rtp thread is null, or if it's not of the correct type.
* @return The current AudioZrtpSession thread.
*/
sfl::AudioZrtpSession * getAudioZrtpSession();
sfl::AudioZrtpSession* getAudioZrtpSession();
#endif
void initLocalCryptoInfo();
void initLocalCryptoInfoOnOffHold();
......
......@@ -37,7 +37,9 @@
#include "sip/sipvoiplink.h"
#include "audio/audiolayer.h"
#include "audio/audiortp/audio_rtp_factory.h"
#if HAVE_ZRTP
#include "audio/audiortp/audio_zrtp_session.h"
#endif
#include "logger.h"
#include "manager.h"
......@@ -307,6 +309,7 @@ CallManager::startTone(const int32_t& start , const int32_t& type)
// for conferencing in order to get
// the right pointer for the given
// callID.
#if HAVE_ZRTP
sfl::AudioZrtpSession *
CallManager::getAudioZrtpSession(const std::string& callID)
{
......@@ -330,60 +333,81 @@ CallManager::getAudioZrtpSession(const std::string& callID)
return zSession;
}
#endif
void
CallManager::setSASVerified(const std::string& callID)
{
#if HAVE_ZRTP
try {
sfl::AudioZrtpSession * zSession;
zSession = getAudioZrtpSession(callID);
zSession->SASVerified();
} catch (...) {
}
#else
ERROR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str());
#endif
}
void
CallManager::resetSASVerified(const std::string& callID)
{
#if HAVE_ZRTP
try {
sfl::AudioZrtpSession * zSession;
zSession = getAudioZrtpSession(callID);
zSession->resetSASVerified();
} catch (...) {
}
#else
ERROR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str());
#endif
}
void
CallManager::setConfirmGoClear(const std::string& callID)
{
#if HAVE_ZRTP
try {
sfl::AudioZrtpSession * zSession;
zSession = getAudioZrtpSession(callID);
zSession->goClearOk();
} catch (...) {
}
#else
ERROR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str());
#endif
}
void
CallManager::requestGoClear(const std::string& callID)
{
#if HAVE_ZRTP
try {
sfl::AudioZrtpSession * zSession;
zSession = getAudioZrtpSession(callID);
zSession->requestGoClear();
} catch (...) {
}
#else
ERROR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str());
#endif
}
void
CallManager::acceptEnrollment(const std::string& callID, const bool& accepted)
{
#if HAVE_ZRTP
try {
sfl::AudioZrtpSession * zSession;
zSession = getAudioZrtpSession(callID);
zSession->acceptEnrollment(accepted);
} catch (...) {
}
#else
ERROR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str());
#endif
}
void
......
......@@ -127,7 +127,9 @@ class CallManager
private:
#if HAVE_ZRTP
sfl::AudioZrtpSession * getAudioZrtpSession(const std::string& callID);
#endif
};
#endif//CALLMANAGER_H
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment