Commit afc102cc authored by Alexandre Savard's avatar Alexandre Savard
Browse files

Merge branch 'optionalfeature'

parents 68f5391b 320e5ae2
......@@ -163,23 +163,41 @@ 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
PKG_CHECK_MODULES([libssl], libssl,, AC_MSG_ERROR([Missing ssl development package: libssl-dev]))
AC_ARG_WITH([tls],
[ AS_HELP_STRING([--without-tls], [disable tls support]) ],
[],
[with_tls=yes])
AS_IF([test "xwith_tls" = "xyes"], [
PKG_CHECK_MODULES([libssl], libssl,, AC_MSG_ERROR([Missing ssl development package: libssl-dev]))
]);
AC_DEFINE_UNQUOTED([HAVE_TLS], `if test "x$with_tls" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have tls support])
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
......@@ -189,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]) ],
[],
......@@ -206,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]) ],
[],
......@@ -232,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],
......@@ -254,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],
......@@ -277,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],
......@@ -300,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])
......@@ -313,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])], [],
......@@ -322,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],
......
if USE_IAX
SUBDIRS = iax2
endif
EXTRA_DIST=pjproject
......@@ -5,31 +5,29 @@ libexec_PROGRAMS = sflphoned
if SFL_VIDEO
SFL_VIDEO_SUBDIR = video
SFL_VIDEO_LIB=./video/libvideo.la
endif
if BUILD_INSTANT_MESSAGING
INSTANT_MESSAGING_SUBDIR = im
IM_LIB=./im/libim.la
endif
SUBDIRS = dbus audio config hooks history sip iax $(INSTANT_MESSAGING_SUBDIR) $(SFL_VIDEO_SUBDIR)
sflphoned_SOURCES = main.cpp
# Redefine the USE_IAX variable here, so that it could be used in managerimpl
if USE_IAX
IAX_SUBDIR=iax
IAX_CXXFLAG=-DUSE_IAX
IAX_LIB=./iax/libiaxlink.la
else
IAX_CXXFLAG=
IAX_LIB=
IAX_LIB=./iax/libiaxlink.la $(top_builddir)/libs/iax2/libiax2.la
endif
if USE_NETWORKMANAGER
NETWORKMANAGER=-DUSE_NETWORKMANAGER
else
NETWORKMANAGER=
endif
SUBDIRS = dbus audio config hooks history sip $(IAX_SUBDIR) $(INSTANT_MESSAGING_SUBDIR) $(SFL_VIDEO_SUBDIR)
sflphoned_SOURCES = main.cpp
sflphoned_CXXFLAGS = \
-DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\" $(IAX_CXXFLAG) $(NETWORKMANAGER) \
-DVERSION=\"$(VERSION)\"
......@@ -62,16 +60,7 @@ noinst_HEADERS = \
account_schema.h \
registration_states.h
if SFL_VIDEO
SFL_VIDEO_LIB=./video/libvideo.la
endif
if BUILD_INSTANT_MESSAGING
IM_LIB=./im/libim.la
endif
libsflphone_la_LIBADD = \
$(top_builddir)/libs/iax2/libiax2.la \
$(IAX_LIB) \
./sip/libsiplink.la \
./audio/libaudio.la \
......
......@@ -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
......@@ -105,7 +105,7 @@ void InstantMessaging::send_sip_message(pjsip_inv_session *session, const std::s
sip_send(session, id, *iter);
}
#if HAVE_IAX
void InstantMessaging::send_iax_message(iax_session *session, const std::string &/* id */, const std::string &message)
{
std::vector<std::string> msgs(split_message(message));
......@@ -114,6 +114,7 @@ void InstantMessaging::send_iax_message(iax_session *session, const std::string
for (iter = msgs.begin(); iter != msgs.end(); ++iter)
iax_send_text(session, (*iter).c_str());
}
#endif
std::vector<std::string> InstantMessaging::split_message(std::string text)
......
......@@ -47,6 +47,8 @@
#include <iax-client.h>
#include "config.h"
#define EMPTY_MESSAGE pj_str((char*)"")
#define MAXIMUM_MESSAGE_LENGTH 1560 /* PJSIP's sip message limit */
......@@ -87,7 +89,9 @@ namespace InstantMessaging {
void sip_send(pjsip_inv_session*, const std::string& id, const std::string&);
void send_sip_message(pjsip_inv_session*, const std::string& id, const std::string&);
#if HAVE_IAX
void send_iax_message(iax_session *session, const std::string& id, const std::string&);
#endif
std::vector<std::string> split_message(std::string);
......
......@@ -55,7 +55,9 @@
#include "sipaccount.h"
#include "pjsip/sip_types.h"
#if HAVE_TLS
#include "pjsip/sip_transport_tls.h"
#endif
#include "dbus/dbusmanager.h"
#include "dbus/configurationmanager.h"
......@@ -248,7 +250,7 @@ pj_status_t SipTransport::destroyStunResolver(const std::string &serverName)
return PJ_SUCCESS;
}
#if HAVE_TLS
pjsip_tpfactory* SipTransport::createTlsListener(SIPAccount &account)
{
pj_sockaddr_in local_addr;
......@@ -278,7 +280,6 @@ pjsip_tpfactory* SipTransport::createTlsListener(SIPAccount &account)
return listener;
}
pjsip_transport *
SipTransport::createTlsTransport(SIPAccount &account)
{
......@@ -317,6 +318,7 @@ SipTransport::createTlsTransport(SIPAccount &account)
RETURN_IF_FAIL(transport != NULL, NULL, "Could not create new TLS transport");
return transport;
}
#endif
namespace {
std::string transportMapKey(const std::string &interface, int port)
......@@ -331,9 +333,13 @@ void SipTransport::createSipTransport(SIPAccount &account)
{
shutdownSipTransport(account);
#if HAVE_TLS
if (account.isTlsEnabled()) {
account.transport_ = createTlsTransport(account);
} else if (account.isStunEnabled()) {
#else
if (account.isStunEnabled()) {
#endif
account.transport_ = createStunTransport(account);
if (account.transport_ == NULL) {
WARN("falling back to UDP transport");
......@@ -352,9 +358,11 @@ void SipTransport::createSipTransport(SIPAccount &account)
}
if (!account.transport_) {
#if HAVE_TLS
if (account.isTlsEnabled())
throw std::runtime_error("Could not create TLS connection");
else
#endif
throw std::runtime_error("Could not create new UDP transport");
}
}
......
......@@ -43,6 +43,8 @@
#include <pjnath/stun_config.h>
#include "noncopyable.h"
#include "config.h"
class SIPAccount;
class SipTransport {
......@@ -136,6 +138,8 @@ class SipTransport {
pjsip_transport *
createStunTransport(SIPAccount &account);
#if HAVE_TLS
/**
* Create a connection oriented TLS transport and register to the specified remote address.
* First, initialize the TLS listener sole instance. This means that, for the momment, only one TLS transport
......@@ -154,6 +158,7 @@ class SipTransport {
*/
pjsip_tpfactory *
createTlsListener(SIPAccount &account);
#endif
/**
* Create a new stun resolver. Store it inside the array. Resolve public address for this
......
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