diff --git a/sflphone-client-gnome/src/config/accountwindow.c b/sflphone-client-gnome/src/config/accountwindow.c index d12f0f60aa32c6bce4c61635758d49e3d1ad3166..18d6f225c6683560ceab6ab19d0a415b3b6ee5b8 100644 --- a/sflphone-client-gnome/src/config/accountwindow.c +++ b/sflphone-client-gnome/src/config/accountwindow.c @@ -754,6 +754,7 @@ show_account_window (account_t * a) gchar* keyExchange = (gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(keyExchangeCombo)); if (g_strcasecmp(keyExchange, "ZRTP") == 0) { g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("TRUE")); + g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_KEY_EXCHANGE), g_strdup("1")); } else { g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("FALSE")); } diff --git a/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp b/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp index 4745bd9160c33aaada3adfa58f97d194076df488..e603c13731745ed6dbf6f45326dbea95921356e9 100644 --- a/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp +++ b/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp @@ -58,8 +58,8 @@ namespace sfl { assert(ca); if (_rtpSession != NULL) { - _debugException("An audio rtp thread was already created but not \ - destroyed. Forcing it before continuing.\n"); + _debugException("An audio rtp thread was already created but not" \ + "destroyed. Forcing it before continuing.\n"); stop(); } @@ -113,27 +113,23 @@ namespace sfl { void AudioRtpFactory::start(void) { if (_rtpSession == NULL) { - throw AudioRtpFactoryException(); - } - - try { - switch(_rtpSessionType) { - case Sdes: - case Symmetric: - _debug("Starting symmetric rtp thread\n"); - if(static_cast<AudioSymmetricRtpSession *>(_rtpSession)->startRtpThread() != 0) { - throw AudioRtpFactoryException(); - } - break; - case Zrtp: - if(static_cast<AudioZrtpSession *>(_rtpSession)->startRtpThread() != 0) { - throw AudioRtpFactoryException(); - } - break; - } - } catch (...) { - throw AudioRtpFactoryException(); + throw AudioRtpFactoryException("_rtpSession was null when trying to start audio thread"); } + + switch(_rtpSessionType) { + case Sdes: + case Symmetric: + _debug("Starting symmetric rtp thread\n"); + if(static_cast<AudioSymmetricRtpSession *>(_rtpSession)->startRtpThread() != 0) { + throw AudioRtpFactoryException("Failed to start AudioSymmetricRtpSession thread"); + } + break; + case Zrtp: + if(static_cast<AudioZrtpSession *>(_rtpSession)->startRtpThread() != 0) { + throw AudioRtpFactoryException("Failed to start AudioZrtpSession thread"); + } + break; + } } void AudioRtpFactory::stop(void) @@ -141,8 +137,7 @@ namespace sfl { ost::MutexLock mutex(_audioRtpThreadMutex); _debug("Stopping audio rtp session\n"); if (_rtpSession == NULL) { - _debugException("_rtpSession is null\n"); - throw AudioRtpFactoryException(); + throw AudioRtpFactoryException("_rtpSession is null when trying to stop"); } try { switch(_rtpSessionType) { diff --git a/sflphone-common/src/audio/audiortp/AudioRtpFactory.h b/sflphone-common/src/audio/audiortp/AudioRtpFactory.h index 964a2b4f13a7d12da3b528124961def22dcb0893..0eefcbfc8264339055a0cb98520fd95d1f7d9879 100644 --- a/sflphone-common/src/audio/audiortp/AudioRtpFactory.h +++ b/sflphone-common/src/audio/audiortp/AudioRtpFactory.h @@ -19,7 +19,7 @@ #ifndef __SFL_AUDIO_RTP_FACTORY_H__ #define __SFL_AUDIO_RTP_FACTORY_H__ -#include <exception> +#include <stdexcept> #include <cc++/thread.h> class SIPCall; @@ -38,20 +38,15 @@ namespace sfl { Sdes } RtpMethod; - class UnsupportedRtpSessionType: public std::exception - { - virtual const char* what() const throw() - { - return "Could not create RTP session of the given type"; - } - }; - class AudioRtpFactoryException: public std::exception - { - virtual const char* what() const throw() - { - return "An AudioRtpFactoryException occured"; - } + class UnsupportedRtpSessionType : public std::logic_error { + public: + UnsupportedRtpSessionType(const std::string& msg = "") : std::logic_error(msg) {} + }; + + class AudioRtpFactoryException : public std::logic_error { + public: + AudioRtpFactoryException(const std::string& msg = "") : std::logic_error(msg) {} }; class AudioRtpFactory { diff --git a/sflphone-common/src/audio/audiortp/ZrtpSessionCallback.cpp b/sflphone-common/src/audio/audiortp/ZrtpSessionCallback.cpp index 7e6cc999a9233cd74eef2c5add723a1fff607e5f..6eb7779249d102dc622d55276d622216d943411c 100644 --- a/sflphone-common/src/audio/audiortp/ZrtpSessionCallback.cpp +++ b/sflphone-common/src/audio/audiortp/ZrtpSessionCallback.cpp @@ -143,29 +143,30 @@ namespace sfl { if (sev == Info) { msg = _infoMap[subCode]; if (msg != NULL) { - _debug("ZRTP Debug: %s\n", msg->c_str()); + _debug("ZRTP Debug:\n", msg->c_str()); } } if (sev == Warning) { msg = _warningMap[subCode]; if (msg != NULL) { - _debug("ZRTP Debug: %s\n", msg->c_str()); + _debug("ZRTP Debug:\n", msg->c_str()); } } if (sev == Severe) { msg = _severeMap[subCode]; if (msg != NULL) { - _debug("ZRTP Debug: %s\n", msg->c_str()); + _debug("ZRTP Debug:\n", msg->c_str()); } } if (sev == ZrtpError) { if (subCode < 0) { // received an error packet from peer subCode *= -1; - _debug("Received an error packet from peer: %s\n", msg->c_str()); + _debug("Received an error packet from peer:\n"); } else { - _debug("Sent error packet to peer: %s\n", msg->c_str()); + _debug("Sent error packet to peer:\n"); } + msg = _zrtpMap[subCode]; if (msg != NULL) { _debug("ZRTP Debug: %s\n", msg->c_str()); @@ -180,10 +181,10 @@ namespace sfl { if (severity == ZrtpError) { if (subCode < 0) { // received an error packet from peer subCode *= -1; - _debug("Received error packet: "); + _debug("Received error packet: \n"); } else { - _debug("Sent error packet: "); + _debug("Sent error packet: \n"); } msg = _zrtpMap[subCode]; if (msg != NULL) {