diff --git a/sflphone-client-gnome/src/config/accountconfigdialog.c b/sflphone-client-gnome/src/config/accountconfigdialog.c index 0c16fea5c38b1536395d91d9a0f913ce3aed4123..9f994d74a0555b05484e880550483754a0cc6a20 100644 --- a/sflphone-client-gnome/src/config/accountconfigdialog.c +++ b/sflphone-client-gnome/src/config/accountconfigdialog.c @@ -422,10 +422,16 @@ static void editing_started_cb (GtkCellRenderer *cell, GtkCellEditable * editabl static void show_advanced_zrtp_options_cb(GtkWidget *widget UNUSED, gpointer data) { - DEBUG("Advanced options for ZRTP"); - show_advanced_zrtp_options((GHashTable *) data); + DEBUG("Advanced options for SRTP"); + if (g_strcasecmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(keyExchangeCombo)), (gchar *) "ZRTP") == 0) { + show_advanced_zrtp_options((GHashTable *) data); + } + else { + show_advanced_sdes_options((GHashTable *) data); + } } + static void show_advanced_tls_options_cb(GtkWidget *widget UNUSED, gpointer data) { DEBUG("Advanced options for TLS"); @@ -434,8 +440,12 @@ static void show_advanced_tls_options_cb(GtkWidget *widget UNUSED, gpointer data static void key_exchange_changed_cb(GtkWidget *widget, gpointer data) { - DEBUG("Key exchange changed"); - if (g_strcasecmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(keyExchangeCombo)), (gchar *) "ZRTP") == 0) { + DEBUG("Key exchange changed %s", gtk_combo_box_get_active_text(GTK_COMBO_BOX(keyExchangeCombo))); + + int isSdes = g_strcasecmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(keyExchangeCombo)), (gchar *) "SDES"); + int isZrtp = g_strcasecmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(keyExchangeCombo)), (gchar *) "ZRTP"); + + if ((isSdes == 0) || (isZrtp == 0)) { gtk_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), TRUE); } else { gtk_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), FALSE); diff --git a/sflphone-common/src/account.h b/sflphone-common/src/account.h index e1a9705b2f126878ec78bfbbae3d615a3b10f18e..892c3d294709e57f840657f150682c055416c5fe 100644 --- a/sflphone-common/src/account.h +++ b/sflphone-common/src/account.h @@ -91,6 +91,7 @@ typedef enum RegistrationState { #define SRTP_ENABLE "SRTP.enable" #define SRTP_KEY_EXCHANGE "SRTP.keyExchange" #define SRTP_ENCRYPTION_ALGO "SRTP.encryptionAlgorithm" // Provided by ccRTP,0=NULL,1=AESCM,2=AESF8 +#define SRTP_RTP_FALLBACK "SRTP.rtpFallback" #define ZRTP_HELLO_HASH "ZRTP.helloHashEnable" #define ZRTP_DISPLAY_SAS "ZRTP.displaySAS" #define ZRTP_NOT_SUPP_WARNING "ZRTP.notSuppWarning" diff --git a/sflphone-common/src/dbus/configurationmanager.cpp b/sflphone-common/src/dbus/configurationmanager.cpp index e067cb7d6ea3e28ffc2c46c36c3c1fa2602bb8ed..2ea657c07934980aca342d64c2caa8c6e130ba6a 100644 --- a/sflphone-common/src/dbus/configurationmanager.cpp +++ b/sflphone-common/src/dbus/configurationmanager.cpp @@ -72,6 +72,7 @@ ConfigurationManager::getIp2IpDetails (void) ip2ipAccountDetails.insert (std::pair<std::string, std::string> (ACCOUNT_ID, IP2IP_PROFILE)); ip2ipAccountDetails.insert (std::pair<std::string, std::string> (SRTP_KEY_EXCHANGE, Manager::instance().getConfigString (IP2IP_PROFILE, SRTP_KEY_EXCHANGE))); ip2ipAccountDetails.insert (std::pair<std::string, std::string> (SRTP_ENABLE, Manager::instance().getConfigString (IP2IP_PROFILE, SRTP_ENABLE))); + ip2ipAccountDetails.insert (std::pair<std::string, std::string> (SRTP_RTP_FALLBACK, Manager::instance().getConfigString (IP2IP_PROFILE, SRTP_RTP_FALLBACK))); ip2ipAccountDetails.insert (std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS, Manager::instance().getConfigString (IP2IP_PROFILE, ZRTP_DISPLAY_SAS))); ip2ipAccountDetails.insert (std::pair<std::string, std::string> (ZRTP_HELLO_HASH, Manager::instance().getConfigString (IP2IP_PROFILE, ZRTP_HELLO_HASH))); ip2ipAccountDetails.insert (std::pair<std::string, std::string> (ZRTP_NOT_SUPP_WARNING, Manager::instance().getConfigString (IP2IP_PROFILE, ZRTP_NOT_SUPP_WARNING))); @@ -112,6 +113,12 @@ ConfigurationManager::setIp2IpDetails (const std::map< std::string, std::string Manager::instance().setConfig (IP2IP_PROFILE, SRTP_ENABLE, it->second); } + it = map_cpy.find (SRTP_RTP_FALLBACK); + + if (it != details.end()) { + Manager::instance().setConfig(IP2IP_PROFILE, SRTP_RTP_FALLBACK, it->second); + } + it = map_cpy.find (SRTP_KEY_EXCHANGE); if (it != details.end()) { diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 4146b1620a4c6f13e792ae34300170e26c8da0bc..d6e56d37bfb454eaf589fe7648450e98dab78ab3 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -2238,6 +2238,7 @@ ManagerImpl::initConfigFile (bool load_user_value, std::string alternate) // Peer to peer settings _config.addDefaultValue (std::pair<std::string, std::string> (SRTP_ENABLE, FALSE_STR), IP2IP_PROFILE); + _config.addDefaultValue (std::pair<std::string, std::string> (SRTP_RTP_FALLBACK, FALSE_STR), IP2IP_PROFILE); _config.addDefaultValue (std::pair<std::string, std::string> (SRTP_KEY_EXCHANGE, "1"), IP2IP_PROFILE); _config.addDefaultValue (std::pair<std::string, std::string> (ZRTP_HELLO_HASH, TRUE_STR), IP2IP_PROFILE); _config.addDefaultValue (std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS, TRUE_STR), IP2IP_PROFILE); @@ -3516,6 +3517,7 @@ std::map< std::string, std::string > ManagerImpl::getAccountDetails (const Accou a.insert (std::pair<std::string, std::string> (REGISTRATION_STATE_DESCRIPTION, registrationStateDescription)); a.insert (std::pair<std::string, std::string> (SRTP_KEY_EXCHANGE, getConfigString (accountID, SRTP_KEY_EXCHANGE))); a.insert (std::pair<std::string, std::string> (SRTP_ENABLE, getConfigString (accountID, SRTP_ENABLE))); + a.insert (std::pair<std::string, std::string> (SRTP_RTP_FALLBACK, getConfigString (accountID, SRTP_RTP_FALLBACK))); a.insert (std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS, getConfigString (accountID, ZRTP_DISPLAY_SAS))); a.insert (std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS_ONCE, getConfigString (accountID, ZRTP_DISPLAY_SAS_ONCE))); a.insert (std::pair<std::string, std::string> (ZRTP_HELLO_HASH, getConfigString (accountID, ZRTP_HELLO_HASH))); @@ -3732,6 +3734,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma std::string stunEnable; std::string stunServer; std::string srtpEnable; + std::string srtpRtpFallback; std::string zrtpDisplaySas; std::string zrtpDisplaySasOnce; std::string zrtpNotSuppWarning; @@ -3793,6 +3796,10 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma srtpEnable = iter->second; } + if ( (iter = map_cpy.find (SRTP_RTP_FALLBACK)) != map_cpy.end()) { + srtpRtpFallback = iter->second; + } + if ( (iter = map_cpy.find (ZRTP_DISPLAY_SAS)) != map_cpy.end()) { zrtpDisplaySas = iter->second; } @@ -3903,6 +3910,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma setConfig (accountID, PUBLISHED_PORT, publishedPort); setConfig (accountID, DISPLAY_NAME, displayName); setConfig (accountID, SRTP_ENABLE, srtpEnable); + setConfig (accountID, SRTP_RTP_FALLBACK, srtpRtpFallback); setConfig (accountID, ZRTP_DISPLAY_SAS, zrtpDisplaySas); setConfig (accountID, ZRTP_DISPLAY_SAS_ONCE, zrtpDisplaySasOnce); setConfig (accountID, ZRTP_NOT_SUPP_WARNING, zrtpNotSuppWarning); diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp index bd58638899e8272834a94a6cda819a16582de220..13342e7f04d4fda32d92df6f050f4d746ee8dd41 100644 --- a/sflphone-common/src/sip/sipvoiplink.cpp +++ b/sflphone-common/src/sip/sipvoiplink.cpp @@ -3222,11 +3222,14 @@ void call_on_media_update (pjsip_inv_session *inv, pj_status_t status) // We did not found any crypto context for this media // @TODO if SRTPONLY, CallFail - // if RTPFALLBACK, change RTP session _debug("Did not found any crypto or negociation failed but Sdes enabled"); call->getAudioRtp()->stop(); call->getAudioRtp()->setSrtpEnabled(false); - call->getAudioRtp()->initAudioRtpSession(call); + + // if RTPFALLBACK, change RTP session + AccountID accountID = Manager::instance().getAccountFromCall (call->getCallId()); + if(Manager::instance().getConfigString (accountID, SRTP_RTP_FALLBACK) == "true") + call->getAudioRtp()->initAudioRtpSession(call); } if(nego_success && call->getAudioRtp()->getAudioRtpType() != sfl::Sdes) {