diff --git a/sflphone-client-gnome/src/config/accountconfigdialog.c b/sflphone-client-gnome/src/config/accountconfigdialog.c index 764ca6a06abce5ea6580c356950a7f43e3e30440..0c16fea5c38b1536395d91d9a0f913ce3aed4123 100644 --- a/sflphone-client-gnome/src/config/accountconfigdialog.c +++ b/sflphone-client-gnome/src/config/accountconfigdialog.c @@ -730,7 +730,7 @@ GtkWidget * create_security_tab(account_t **a) keyExchangeCombo = gtk_combo_box_new_text(); gtk_label_set_mnemonic_widget (GTK_LABEL (label), keyExchangeCombo); gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "ZRTP"); - //gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "SDES"); + gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "SDES"); gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), _("Disabled")); advancedZrtpButton = gtk_button_new_from_stock(GTK_STOCK_PREFERENCES); @@ -738,13 +738,17 @@ GtkWidget * create_security_tab(account_t **a) if (g_strcmp0(curSRTPEnabled, "false") == 0) { - gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 1); + gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 2); gtk_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), FALSE); } else { if (strcmp(curKeyExchange, ZRTP) == 0) { gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo),0); - } else { - gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 1); + } + else if (strcmp(curKeyExchange, SDES) == 0) { + gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo),1); + } + else { + gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 2); gtk_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), FALSE); } } @@ -1152,7 +1156,12 @@ show_account_window (account_t * a) 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(ZRTP)); - } else { + } + else if(g_strcasecmp(keyExchange, "SDES") == 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(SDES)); + } + else { g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("false")); } diff --git a/sflphone-client-gnome/src/config/preferencesdialog.c b/sflphone-client-gnome/src/config/preferencesdialog.c index d83e711183961c79f3d71b7fafa35c25dc51b120..4b7d9af6f23db9bd6c520a073e37c0fd204f0c0b 100644 --- a/sflphone-client-gnome/src/config/preferencesdialog.c +++ b/sflphone-client-gnome/src/config/preferencesdialog.c @@ -120,10 +120,16 @@ 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(widget)), (gchar *) "ZRTP") == 0) { - gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE); - g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("true")); - g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_KEY_EXCHANGE), g_strdup(ZRTP)); - } else { + gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE); + g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("true")); + g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_KEY_EXCHANGE), g_strdup(ZRTP)); + } + else if (g_strcasecmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(widget)), (gchar *) "SDES") == 0) { + gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); + g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("true")); + g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_KEY_EXCHANGE), g_strdup(SDES)); + } + else { gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); DEBUG("Setting key exchange %s to %s\n", ACCOUNT_KEY_EXCHANGE, KEY_EXCHANGE_NONE); g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("false")); @@ -326,16 +332,20 @@ GtkWidget* create_direct_ip_calls_tab() keyExchangeCombo = gtk_combo_box_new_text(); gtk_label_set_mnemonic_widget (GTK_LABEL (label), keyExchangeCombo); gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "ZRTP"); - //gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "SDES"); + gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "SDES"); gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), _("Disabled")); advancedZrtpButton = gtk_button_new_from_stock(GTK_STOCK_PREFERENCES); g_signal_connect(G_OBJECT(advancedZrtpButton), "clicked", G_CALLBACK(show_advanced_zrtp_options_cb), directIpCallsProperties); if (g_strcasecmp(curKeyExchange, ZRTP) == 0) { - gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo),0); - } else { - gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 1); + gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo),0); + } + else if(g_strcasecmp(curKeyExchange, SDES) == 0) { + gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo),1); + } + else { + gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 2); gtk_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), FALSE); } diff --git a/sflphone-client-gnome/src/sflphone_const.h b/sflphone-client-gnome/src/sflphone_const.h index d8e7870b9efa49f0ee12d2a4b77e181a634851b9..52e786ade3e73803fe23fcf3943435c3fe7b7851 100644 --- a/sflphone-client-gnome/src/sflphone_const.h +++ b/sflphone-client-gnome/src/sflphone_const.h @@ -51,9 +51,9 @@ #define UNUSED __attribute__((__unused__)) #define ACCOUNT_TYPE "Account.type" -#define ACCOUNT_ALIAS "Account.alias" -#define ACCOUNT_ENABLED "Account.enable" -#define ACCOUNT_MAILBOX "Account.mailbox" +#define ACCOUNT_ALIAS "Account.alias" +#define ACCOUNT_ENABLED "Account.enable" +#define ACCOUNT_MAILBOX "Account.mailbox" #define ACCOUNT_RESOLVE_ONCE "Account.resolveOnce" #define ACCOUNT_REGISTRATION_EXPIRE "Account.expire" #define ACCOUNT_SIP_STUN_SERVER "STUN.server" @@ -71,7 +71,7 @@ #define ACCOUNT_DISPLAY_SAS_ONCE "ZRTP.displaySasOnce" #define KEY_EXCHANGE_NONE "0" #define ZRTP "1" -#define SDES_TLS "2" +#define SDES "2" #define TLS_ENABLE "TLS.enable" #define TLS_PORT "TLS.port" diff --git a/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp b/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp index 318bf8c727e9bda938b106b1cf82000eced3c4a6..69eeac0428255e0706393a7830658cff01b72332 100644 --- a/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp +++ b/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp @@ -20,6 +20,7 @@ #include "AudioRtpFactory.h" #include "AudioZrtpSession.h" +#include "AudioSrtpSession.h" #include "AudioSymmetricRtpSession.h" #include "manager.h" @@ -106,6 +107,11 @@ void AudioRtpFactory::initAudioRtpSession (SIPCall * ca) case Sdes: + _rtpSession = new AudioSrtpSession (&Manager::instance(), ca); + _rtpSessionType = Sdes; + + break; + default: throw UnsupportedRtpSessionType(); } @@ -125,6 +131,9 @@ void AudioRtpFactory::start (void) switch (_rtpSessionType) { case Sdes: + if (static_cast<AudioSrtpSession *> (_rtpSession)->startRtpThread() != 0) { + throw AudioRtpFactoryException ("Failed to start AudioSRtpSession thread"); + } break; case Symmetric: diff --git a/sflphone-common/src/audio/audiortp/AudioRtpFactory.h b/sflphone-common/src/audio/audiortp/AudioRtpFactory.h index 0eefcbfc8264339055a0cb98520fd95d1f7d9879..9d827a5d878739479de03ed97278313d3af69a1f 100644 --- a/sflphone-common/src/audio/audiortp/AudioRtpFactory.h +++ b/sflphone-common/src/audio/audiortp/AudioRtpFactory.h @@ -25,11 +25,13 @@ class SIPCall; namespace sfl { class AudioZrtpSession; + class AudioSrtpSession; } namespace sfl { class AudioZrtpSession; + class AudioSrtpSession; // Possible kind of rtp session typedef enum RtpMethod {