diff --git a/sflphone-client-gnome/src/config/accountconfigdialog.c b/sflphone-client-gnome/src/config/accountconfigdialog.c index 0cfd91f7a86ae120178ca57d17ac843986c3f7b7..22b5a1956f8ec923583735291ad2c1ff1331eb2e 100644 --- a/sflphone-client-gnome/src/config/accountconfigdialog.c +++ b/sflphone-client-gnome/src/config/accountconfigdialog.c @@ -38,6 +38,7 @@ #include <accountconfigdialog.h> #include <zrtpadvanceddialog.h> #include <tlsadvanceddialog.h> +#include <audioconf.h> // From version 2.16, gtk provides the functionalities libsexy used to provide #if GTK_CHECK_VERSION(2,16,0) @@ -97,6 +98,8 @@ GtkWidget * publishedAddressLabel; GtkWidget * publishedPortLabel; GtkWidget * stunServerLabel; GtkWidget * stunServerEntry; +GtkWidget * enableTone; +GtkWidget * fileChooser; GtkWidget * displayNameEntry; @@ -1207,6 +1210,19 @@ GtkWidget* create_advanced_tab (account_t **a) { return ret; } +void ringtone_enabled(GtkWidget *widget UNUSED, gpointer fileChooser, const gchar *accountID) +{ + gboolean isEnabled = gtk_widget_get_sensitive(GTK_WIDGET(fileChooser)); + + if(isEnabled) { + gtk_widget_set_sensitive(GTK_WIDGET(fileChooser), FALSE); + } + else { + gtk_widget_set_sensitive(GTK_WIDGET(fileChooser), TRUE); + } +} + + GtkWidget* create_codecs_configuration (account_t **a) { // Main widget @@ -1253,6 +1269,36 @@ GtkWidget* create_codecs_configuration (account_t **a) { gtk_table_attach ( GTK_TABLE( table ), sipinfo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); } + // Box for the ringtones + gnome_main_section_new_with_table (_("Ringtones"), &frame, &table, 1, 2); + gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); + + fileChooser = gtk_file_chooser_button_new(_("Choose a ringtone"), GTK_FILE_CHOOSER_ACTION_OPEN); + + p = g_hash_table_lookup(currentAccount->properties, g_strdup(CONFIG_RINGTONE_ENABLED)); + gboolean ringtoneEnabled = (g_strcmp0(p, "true") == 0) ? TRUE : FALSE; + + enableTone = gtk_check_button_new_with_mnemonic( _("_Enable ringtones")); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enableTone), ringtoneEnabled); + g_signal_connect(G_OBJECT( enableTone) , "clicked" , G_CALLBACK( ringtone_enabled ), fileChooser); + gtk_table_attach ( GTK_TABLE( table ), enableTone, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + + // file chooser button + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER( fileChooser) , g_get_home_dir()); + p = g_hash_table_lookup(currentAccount->properties, g_strdup(CONFIG_RINGTONE_PATH)); + gtk_file_chooser_set_filename(GTK_FILE_CHOOSER( fileChooser) , p); + gtk_widget_set_sensitive(GTK_WIDGET(fileChooser), ringtoneEnabled); + + GtkFileFilter *filter = gtk_file_filter_new(); + gtk_file_filter_set_name( filter , _("Audio Files") ); + gtk_file_filter_add_pattern(filter , "*.wav" ); + gtk_file_filter_add_pattern(filter , "*.ul" ); + gtk_file_filter_add_pattern(filter , "*.au" ); + gtk_file_chooser_add_filter( GTK_FILE_CHOOSER( fileChooser ) , filter); + gtk_table_attach ( GTK_TABLE( table ), fileChooser, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + + + gtk_widget_show_all(ret); return ret; @@ -1475,6 +1521,16 @@ void show_account_window (account_t * a) { g_hash_table_replace(currentAccount->properties, g_strdup(TLS_ENABLE), g_strdup(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(useSipTlsCheckBox)) ? "true":"false")); } + + gboolean toneEnabled = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enableTone)); + g_hash_table_replace(currentAccount->properties, + g_strdup(CONFIG_RINGTONE_ENABLED), + g_strdup(toneEnabled ? "true" : "false")); + + + g_hash_table_replace(currentAccount->properties, + g_strdup(CONFIG_RINGTONE_PATH), + g_strdup((gchar *)gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( fileChooser )))); g_hash_table_replace(currentAccount->properties, g_strdup(LOCAL_INTERFACE), diff --git a/sflphone-client-gnome/src/config/audioconf.c b/sflphone-client-gnome/src/config/audioconf.c index b96532e4426fc3e658ac69c4befa754b0c9f4050..6e53c63702e24b5126d18ec00df3dda07f379ee8 100644 --- a/sflphone-client-gnome/src/config/audioconf.c +++ b/sflphone-client-gnome/src/config/audioconf.c @@ -629,33 +629,6 @@ static void codec_move_down(GtkButton *button UNUSED, gpointer data) { codec_move (FALSE, data); } - int -is_ringtone_enabled( void ) -{ - return dbus_is_ringtone_enabled(); -} - - void -ringtone_enabled(GtkWidget *widget UNUSED, gpointer fileChooser) -{ - dbus_ringtone_enabled(); - gtk_widget_set_sensitive(GTK_WIDGET(fileChooser), dbus_is_ringtone_enabled()); -} - - void -ringtone_changed( GtkFileChooser *chooser , GtkLabel *label UNUSED) -{ - gchar* tone = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( chooser )); - dbus_set_ringtone_choice( tone ); -} - - gchar* -get_ringtone_choice( void ) -{ - return dbus_get_ringtone_choice(); -} - - GtkWidget* codecs_box (account_t **a) { GtkWidget *ret; @@ -900,27 +873,6 @@ GtkWidget* alsa_box() gtk_table_attach(GTK_TABLE(table), input, 2, 3, 3, 4, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0); gtk_widget_show(input); - - DEBUG("Audio: Configuration rintgtone"); - item = gtk_label_new(_("Ringtone")); - gtk_misc_set_alignment(GTK_MISC(item), 0, 0.5); - gtk_table_attach(GTK_TABLE(table), item, 1, 2, 4, 5, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0); - gtk_widget_show(item); - // set choices of ringtone devices - ringtonelist = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); - preferences_dialog_fill_ringtone_audio_device_list(); - ringtone = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ringtonelist)); - select_active_ringtone_audio_device(); - gtk_label_set_mnemonic_widget(GTK_LABEL(item), output); - g_signal_connect(G_OBJECT(ringtone), "changed", G_CALLBACK(select_audio_ringtone_device), output); - - // Set rendering - renderer = gtk_cell_renderer_text_new(); - gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(ringtone), renderer, TRUE); - gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(ringtone), renderer, "text", 0, NULL); - gtk_table_attach(GTK_TABLE(table), ringtone, 2, 3, 4, 5, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0); - gtk_widget_show(ringtone); - gtk_widget_show_all(ret); DEBUG("done"); @@ -1008,31 +960,6 @@ GtkWidget* create_audio_configuration() g_signal_connect( G_OBJECT( folderChooser ) , "selection_changed" , G_CALLBACK( record_path_changed ) , NULL ); gtk_table_attach(GTK_TABLE(table), folderChooser, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); - // Box for the ringtones - gnome_main_section_new_with_table (_("Ringtones"), &frame, &table, 1, 2); - gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); - - GtkWidget *enableTone; - GtkWidget *fileChooser = gtk_file_chooser_button_new(_("Choose a ringtone"), GTK_FILE_CHOOSER_ACTION_OPEN); - - enableTone = gtk_check_button_new_with_mnemonic( _("_Enable ringtones")); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enableTone), dbus_is_ringtone_enabled() ); - g_signal_connect(G_OBJECT( enableTone) , "clicked" , G_CALLBACK( ringtone_enabled ) , fileChooser); - gtk_table_attach ( GTK_TABLE( table ), enableTone, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - - // file chooser button - gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER( fileChooser) , g_get_home_dir()); - gtk_file_chooser_set_filename(GTK_FILE_CHOOSER( fileChooser) , get_ringtone_choice()); - gtk_widget_set_sensitive(GTK_WIDGET(fileChooser), dbus_is_ringtone_enabled()); - g_signal_connect( G_OBJECT( fileChooser ) , "selection_changed" , G_CALLBACK( ringtone_changed ) , NULL ); - - GtkFileFilter *filter = gtk_file_filter_new(); - gtk_file_filter_set_name( filter , _("Audio Files") ); - gtk_file_filter_add_pattern(filter , "*.wav" ); - gtk_file_filter_add_pattern(filter , "*.ul" ); - gtk_file_filter_add_pattern(filter , "*.au" ); - gtk_file_chooser_add_filter( GTK_FILE_CHOOSER( fileChooser ) , filter); - gtk_table_attach ( GTK_TABLE( table ), fileChooser, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); // Box for the voice enhancement configuration gnome_main_section_new_with_table (_("Voice enhancement settings"), &frame, &table, 2, 1); diff --git a/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml b/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml old mode 100644 new mode 100755 index 9088954a21196964b799cbccdec78393c6efbfb4..8c8fc90c0018ebafec8e87e1376b5dc59c52f209 --- a/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml +++ b/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml @@ -338,6 +338,7 @@ <tp:docstring> Return true if ringtone is enabled, false otherwise </tp:docstring> + <arg type="s" name="accountID" direction="in" /> <arg type="i" name="bool" direction="out"> <tp:docstring> </tp:docstring> @@ -346,14 +347,15 @@ <method name="ringtoneEnabled" tp:name-for-bindings="ringtoneEnabled"> <tp:docstring> - Unused </tp:docstring> + <arg type="s" name="accountID" direction="in"/> </method> <method name="getRingtoneChoice" tp:name-for-bindings="getRingtoneChoice"> <tp:docstring> Get current ringtone .au file selected </tp:docstring> + <arg type="s" name="accountID" direction="in"/> <arg type="s" name="tone" direction="out"> <tp:docstring> </tp:docstring> @@ -364,6 +366,7 @@ <tp:docstring> Set current ringtone .au file from list acquired using <tp:member-ref>getAccountList</tp:member-ref> </tp:docstring> + <arg type="s" name="accountID" direction="in"/> <arg type="s" name="tone" direction="in"> <tp:docstring> A valid .au file path @@ -633,20 +636,6 @@ </arg> </method> - <method name="setNotify" tp:name-for-bindings="setNotify"> - <tp:docstring> - </tp:docstring> - </method> - - <method name="getNotify" tp:name-for-bindings="getNotify"> - <tp:docstring> - </tp:docstring> - <arg type="i" name="level" direction="out"> - <tp:docstring> - </tp:docstring> - </arg> - </method> - <method name="setMailNotify" tp:name-for-bindings="setMailNotify"> <tp:docstring> </tp:docstring> @@ -661,69 +650,6 @@ </arg> </method> - <method name="getDialpad" tp:name-for-bindings="getDialpad"> - <tp:docstring> - </tp:docstring> - <arg type="i" name="state" direction="out"> - <tp:docstring> - </tp:docstring> - </arg> - </method> - - <method name="setDialpad" tp:name-for-bindings="setDialpad"> - <tp:docstring> - </tp:docstring> - <arg type="b" name="display" direction="in"> - <tp:docstring> - </tp:docstring> - </arg> - </method> - - <method name="getSearchbar" tp:name-for-bindings="getSearchbar"> - <tp:docstring> - </tp:docstring> - <arg type="i" name="state" direction="out"> - <tp:docstring> - </tp:docstring> - </arg> - </method> - - <method name="setSearchbar" tp:name-for-bindings="setSearchbar"> - <tp:docstring> - </tp:docstring> - </method> - - <method name="setHistoryEnabled" tp:name-for-bindings="setHistoryEnabled"> - <tp:docstring> - </tp:docstring> - </method> - - <method name="getHistoryEnabled" tp:name-for-bindings="getHistoryEnabled"> - <tp:docstring> - </tp:docstring> - <arg type="s" name="state" direction="out"> - <tp:docstring> - </tp:docstring> - </arg> - </method> - - <method name="getVolumeControls" tp:name-for-bindings="getVolumeControls"> - <tp:docstring> - </tp:docstring> - <arg type="i" name="state" direction="out"> - <tp:docstring> - </tp:docstring> - </arg> - </method> - - <method name="setVolumeControls" tp:name-for-bindings="setVolumeControls"> - <tp:docstring> - </tp:docstring> - <arg type="b" name="display" direction="in"> - <tp:docstring> - </tp:docstring> - </arg> - </method> <method name="getHistoryLimit" tp:name-for-bindings="getHistoryLimit"> <tp:docstring> @@ -743,136 +669,6 @@ </arg> </method> - <method name="startHidden" tp:name-for-bindings="startHidden"> - <tp:docstring> - </tp:docstring> - </method> - - <method name="isStartHidden" tp:name-for-bindings="isStartHidden"> - <tp:docstring> - </tp:docstring> - <arg type="i" name="state" direction="out"> - <tp:docstring> - </tp:docstring> - </arg> - </method> - - <method name="popupMode" tp:name-for-bindings="popupMode"> - <tp:docstring> - </tp:docstring> - <arg type="i" name="state" direction="out"> - <tp:docstring> - </tp:docstring> - </arg> - </method> - - <method name="switchPopupMode" tp:name-for-bindings="switchPopupMode"> - <tp:docstring> - </tp:docstring> - </method> - - <method name="getWindowWidth" tp:name-for-bindings="getWindowWidth"> - <tp:docstring> - Unused - </tp:docstring> - <arg type="i" name="width" direction="out"> - <tp:docstring> - </tp:docstring> - </arg> - </method> - - <method name="getWindowHeight" tp:name-for-bindings="getWindowHeight"> - <tp:docstring> - Unused - </tp:docstring> - <arg type="i" name="height" direction="out"> - <tp:docstring> - </tp:docstring> - </arg> - </method> - - <method name="setWindowWidth" tp:name-for-bindings="setWindowWidth"> - <tp:docstring> - Unused - </tp:docstring> - <arg type="i" name="width" direction="in"> - <tp:docstring> - </tp:docstring> - </arg> - </method> - - <method name="setWindowHeight" tp:name-for-bindings="setWindowHeight"> - <tp:docstring> - Unused - </tp:docstring> - <arg type="i" name="height" direction="in"> - <tp:docstring> - </tp:docstring> - </arg> - </method> - - <method name="getWindowPositionX" tp:name-for-bindings="getWindowPositionX"> - <tp:docstring> - Unused - </tp:docstring> - <arg type="i" name="posX" direction="out"> - <tp:docstring> - </tp:docstring> - </arg> - </method> - - <method name="setWindowPositionX" tp:name-for-bindings="setWindowPositionX"> - <tp:docstring> - Unused - </tp:docstring> - <arg type="i" name="posX" direction="in"> - <tp:docstring> - </tp:docstring> - </arg> - </method> - - <method name="getWindowPositionY" tp:name-for-bindings="getWindowPositionY"> - <tp:docstring> - Unused - </tp:docstring> - <arg type="i" name="posY" direction="out"> - <tp:docstring> - </tp:docstring> - </arg> - </method> - - <method name="setWindowPositionY" tp:name-for-bindings="setWindowPositionY"> - <tp:docstring> - Unused - </tp:docstring> - <arg type="i" name="posY" direction="in"> - <tp:docstring> - </tp:docstring> - </arg> - </method> - - <method name="enableStatusIcon" tp:name-for-bindings="enableStatusIcon"> - <tp:docstring> - Allow SFLphone icon to be displayed in system tray - </tp:docstring> - <arg type="s" name="value" direction="in"> - <tp:docstring> - true/false - </tp:docstring> - </arg> - </method> - - <method name="isStatusIconEnabled" tp:name-for-bindings="isStatusIconEnabled"> - <tp:docstring> - Test if SFLphone icon is displayed in system tray. - </tp:docstring> - <arg type="s" name="value" direction="out"> - <tp:docstring> - true/false - </tp:docstring> - </arg> - </method> - <!-- Addressbook configuration --> <method name="getAddressbookSettings" tp:name-for-bindings="getAddressbookSettings"> diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index b3d4dc16f1fdc13eb78c645018bd154f39223673..4c8fe85ff303055dceba2e3dd32a9ba0aa0ee60c 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -1572,12 +1572,12 @@ dbus_set_noise_suppress_state(gchar* state) gchar* -dbus_get_ringtone_choice() +dbus_get_ringtone_choice(const gchar *accountID) { gchar* tone; GError* error = NULL; org_sflphone_SFLphone_ConfigurationManager_get_ringtone_choice( - configurationManagerProxy, &tone, &error); + configurationManagerProxy, accountID, &tone, &error); if (error) { g_error_free(error); @@ -1586,11 +1586,11 @@ dbus_get_ringtone_choice() } void -dbus_set_ringtone_choice(const gchar* tone) +dbus_set_ringtone_choice(const gchar *accountID, const gchar* tone) { GError* error = NULL; org_sflphone_SFLphone_ConfigurationManager_set_ringtone_choice( - configurationManagerProxy, tone, &error); + configurationManagerProxy, accountID, tone, &error); if (error) { g_error_free(error); @@ -1598,12 +1598,12 @@ dbus_set_ringtone_choice(const gchar* tone) } int -dbus_is_ringtone_enabled() +dbus_is_ringtone_enabled(const gchar *accountID) { int res; GError* error = NULL; org_sflphone_SFLphone_ConfigurationManager_is_ringtone_enabled( - configurationManagerProxy, &res, &error); + configurationManagerProxy, accountID, &res, &error); if (error) { g_error_free(error); @@ -1612,11 +1612,13 @@ dbus_is_ringtone_enabled() } void -dbus_ringtone_enabled() +dbus_ringtone_enabled(const gchar *accountID) { + DEBUG("DBUS: Ringtone enabled %s", accountID); + GError* error = NULL; org_sflphone_SFLphone_ConfigurationManager_ringtone_enabled( - configurationManagerProxy, &error); + configurationManagerProxy, accountID, &error); if (error) { g_error_free(error); @@ -1663,71 +1665,6 @@ dbus_is_iax2_enabled() return res; } -int -dbus_get_dialpad() -{ - int state; - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_dialpad( - configurationManagerProxy, &state, &error); - if (error) - { - g_error_free(error); - } - return state; -} - -void -dbus_set_dialpad(gboolean display) -{ - - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_dialpad( - configurationManagerProxy, display, &error); - if (error) - { - g_error_free(error); - } -} - -int -dbus_get_searchbar() -{ - int state; - GError* error = NULL; - if (!org_sflphone_SFLphone_ConfigurationManager_get_searchbar( - configurationManagerProxy, &state, &error)) - { - if (error->domain == DBUS_GERROR && error->code - == DBUS_GERROR_REMOTE_EXCEPTION) - { - ERROR ("Caught remote method (get_searchbar) exception %s: %s", dbus_g_error_get_name(error), error->message); - } - else - { - ERROR("Error while calling get_searchbar: %s", error->message); - } - g_error_free(error); - return -1; - } - else - { - return state; - } -} - -void -dbus_set_searchbar() -{ - GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_searchbar( - configurationManagerProxy, &error); - if (error) - { - g_error_free(error); - } -} - void dbus_join_participant(const gchar* sel_callID, const gchar* drag_callID) { @@ -2355,150 +2292,6 @@ dbus_get_all_ip_interface_by_name(void) } } -guint -dbus_get_window_width(void) -{ - - GError *error = NULL; - guint value; - - org_sflphone_SFLphone_ConfigurationManager_get_window_width( - configurationManagerProxy, &value, &error); - - if (error != NULL) - { - ERROR ("Failed to call get_window_width() on ConfigurationManager: %s", - error->message); - g_error_free(error); - } - return value; -} - -guint -dbus_get_window_height(void) -{ - - GError *error = NULL; - guint value; - - org_sflphone_SFLphone_ConfigurationManager_get_window_height( - configurationManagerProxy, &value, &error); - - if (error != NULL) - { - ERROR ("Failed to call get_window_height() on ConfigurationManager: %s", - error->message); - g_error_free(error); - } - return value; -} - -void -dbus_set_window_width(const guint width) -{ - - GError *error = NULL; - - org_sflphone_SFLphone_ConfigurationManager_set_window_width( - configurationManagerProxy, width, &error); - - if (error != NULL) - { - ERROR ("Failed to call set_window_width() on ConfigurationManager: %s", - error->message); - g_error_free(error); - } -} - -void -dbus_set_window_height(const guint height) -{ - - GError *error = NULL; - - org_sflphone_SFLphone_ConfigurationManager_set_window_height( - configurationManagerProxy, height, &error); - - if (error != NULL) - { - ERROR ("Failed to call set_window_height() on ConfigurationManager: %s", - error->message); - g_error_free(error); - } -} - -guint -dbus_get_window_position_x(void) -{ - - GError *error = NULL; - guint value; - - org_sflphone_SFLphone_ConfigurationManager_get_window_position_x( - configurationManagerProxy, &value, &error); - - if (error != NULL) - { - ERROR ("Failed to call get_window_position_x() on ConfigurationManager: %s", - error->message); - g_error_free(error); - } - return value; -} - -guint -dbus_get_window_position_y(void) -{ - - GError *error = NULL; - guint value; - - org_sflphone_SFLphone_ConfigurationManager_get_window_position_y( - configurationManagerProxy, &value, &error); - - if (error != NULL) - { - ERROR ("Failed to call get_window_position_y() on ConfigurationManager: %s", - error->message); - g_error_free(error); - } - return value; -} - -void -dbus_set_window_position_x(const guint posx) -{ - - GError *error = NULL; - - org_sflphone_SFLphone_ConfigurationManager_set_window_position_x( - configurationManagerProxy, posx, &error); - - if (error != NULL) - { - ERROR ("Failed to call set_window_position_x() on ConfigurationManager: %s", - error->message); - g_error_free(error); - } -} - -void -dbus_set_window_position_y(const guint posy) -{ - - GError *error = NULL; - - org_sflphone_SFLphone_ConfigurationManager_set_window_position_y( - configurationManagerProxy, posy, &error); - - if (error != NULL) - { - ERROR ("Failed to call set_window_position_y() on ConfigurationManager: %s", - error->message); - g_error_free(error); - } -} - GHashTable* dbus_get_shortcuts(void) { diff --git a/sflphone-client-gnome/src/dbus/dbus.h b/sflphone-client-gnome/src/dbus/dbus.h index d028b66ae474c33274fd7c9232d79bc63966a5da..9abaa0cc96f2bb3b37ddd3e5f7f381f4cb043783 100644 --- a/sflphone-client-gnome/src/dbus/dbus.h +++ b/sflphone-client-gnome/src/dbus/dbus.h @@ -370,49 +370,25 @@ int dbus_is_iax2_enabled( void ); * @return int 1 if enabled * 0 otherwise */ -int dbus_is_ringtone_enabled( void ); +int dbus_is_ringtone_enabled( const gchar *accountID ); /** * ConfigurationManager - Set the ringtone option * Inverse current value */ -void dbus_ringtone_enabled( void ); +void dbus_ringtone_enabled( const gchar *accountID ); /** * ConfigurationManager - Get the ringtone * @return gchar* The file name selected as a ringtone */ -gchar* dbus_get_ringtone_choice( void ); +gchar* dbus_get_ringtone_choice( const gchar *accountID ); /** * ConfigurationManager - Set a ringtone * @param tone The file name of the ringtone */ -void dbus_set_ringtone_choice( const gchar* tone ); - -/** - * ConfigurationManager - Set the dialpad visible or not - */ -void dbus_set_dialpad (gboolean display); - -/** - * ConfigurationManager - Tells if the user wants to display the dialpad or not - * @return int 1 if dialpad has to be displayed - * 0 otherwise - */ -int dbus_get_dialpad( void ); - -/** - * ConfigurationManager - Set the searchbar visible or not - */ -void dbus_set_searchbar( ); - -/** - * ConfigurationManager - Tells if the user wants to display the search bar or not - * @return int 1 if the search bar has to be displayed - * 0 otherwise - */ -int dbus_get_searchbar( void ); +void dbus_set_ringtone_choice( const gchar *accountID, const gchar* tone ); /** * ConfigurationManager - Gives the maximum number of days the user wants to have in the history @@ -572,15 +548,6 @@ gchar** dbus_get_supported_tls_method(); gchar** dbus_get_participant_list (const char * confID); -guint dbus_get_window_width (void); -guint dbus_get_window_height (void); -void dbus_set_window_height (const guint height); -void dbus_set_window_width (const guint width); -guint dbus_get_window_position_x (void); -guint dbus_get_window_position_y (void); -void dbus_set_window_position_x (const guint posx); -void dbus_set_window_position_y (const guint posy); - GHashTable* dbus_get_shortcuts(void); void dbus_set_shortcuts(GHashTable * shortcuts); diff --git a/sflphone-client-gnome/src/sflphone_const.h b/sflphone-client-gnome/src/sflphone_const.h index 0f46a82cb38cb2ad4c26c1b6abcbc0833ccb7da6..5ecdd75ea6576b702831c2cdee4eff8e2d7cce92 100644 --- a/sflphone-client-gnome/src/sflphone_const.h +++ b/sflphone-client-gnome/src/sflphone_const.h @@ -91,6 +91,9 @@ #define ZRTP "1" #define SDES "2" +#define CONFIG_RINGTONE_PATH "Account.ringtonePath" +#define CONFIG_RINGTONE_ENABLED "Account.ringtoneEnabled" + #define TLS_LISTENER_PORT "TLS.listenerPort" #define TLS_ENABLE "TLS.enable" #define TLS_PORT "TLS.port" diff --git a/sflphone-client-gnome/src/shortcuts.c b/sflphone-client-gnome/src/shortcuts.c index 5ac0e48900433880962693a0f16f669cf823aa36..ce9900c1f46feb769d77aec51d74e212178f1867 100644 --- a/sflphone-client-gnome/src/shortcuts.c +++ b/sflphone-client-gnome/src/shortcuts.c @@ -131,8 +131,8 @@ popup_window_callback () { gtk_widget_hide (GTK_WIDGET(get_main_window())); gtk_widget_show (GTK_WIDGET(get_main_window())); - gtk_window_move (GTK_WINDOW (get_main_window ()), - dbus_get_window_position_x (), dbus_get_window_position_y ()); + //gtk_window_move (GTK_WINDOW (get_main_window ()), + // dbus_get_window_position_x (), dbus_get_window_position_y ()); } static void diff --git a/sflphone-client-gnome/src/statusicon.c b/sflphone-client-gnome/src/statusicon.c index 72511091f05e8591ce022a2b64984329715c2dd3..d3ace0f97db9f87e66289861da625e2bde88c24d 100644 --- a/sflphone-client-gnome/src/statusicon.c +++ b/sflphone-client-gnome/src/statusicon.c @@ -46,8 +46,8 @@ popup_main_window(void) if (__POPUP_WINDOW) { gtk_widget_show(get_main_window()); - gtk_window_move(GTK_WINDOW (get_main_window ()), - dbus_get_window_position_x(), dbus_get_window_position_y()); + //gtk_window_move(GTK_WINDOW (get_main_window ()), + // dbus_get_window_position_x(), dbus_get_window_position_y()); set_minimized(FALSE); } } diff --git a/sflphone-common/src/account.cpp b/sflphone-common/src/account.cpp index df26904f5b079d19fd6e95b59af9bea66883e9e2..66f78f4786547b35207a70e04b7861a4e61c8835 100644 --- a/sflphone-common/src/account.cpp +++ b/sflphone-common/src/account.cpp @@ -40,6 +40,8 @@ Account::Account (const AccountID& accountID, std::string type) : , _type (type) , _codecOrder () , _codecStr("") + , _ringtonePath("/usr/share/sflphone/ringtones/konga.ul") + , _ringtoneEnabled(true) , _displayName("") , _useragent("SFLphone") { diff --git a/sflphone-common/src/account.h b/sflphone-common/src/account.h index 183b6789b1214b7d9c81ae31271361d55fa7a91d..521e79e2b11a47a8a96c64a7273fb59dac74a7b8 100644 --- a/sflphone-common/src/account.h +++ b/sflphone-common/src/account.h @@ -78,6 +78,8 @@ typedef enum RegistrationState { #define CONFIG_ACCOUNT_REGISTRATION_EXPIRE "Account.expire" #define CONFIG_CREDENTIAL_NUMBER "Credential.count" #define ACCOUNT_DTMF_TYPE "Account.dtmfType" +#define CONFIG_RINGTONE_PATH "Account.ringtonePath" +#define CONFIG_RINGTONE_ENABLED "Account.ringtoneEnabled" #define HOSTNAME "hostname" #define USERNAME "username" @@ -142,7 +144,9 @@ const Conf::Key hostnameKey("hostname"); const Conf::Key accountEnableKey("enable"); const Conf::Key mailboxKey("mailbox"); -const Conf::Key codecsKey("codecs"); // 0/9/110/111/112/ +const Conf::Key codecsKey("codecs"); // 0/9/110/111/112/ +const Conf::Key ringtonePathKey("ringtonePath"); +const Conf::Key ringtoneEnabledKey("ringtoneEnabled"); const Conf::Key displayNameKey("displayName"); #define find_in_map(X, Y) if((iter = map_cpy.find(X)) != map_cpy.end()) { Y = iter->second; } @@ -259,9 +263,15 @@ class Account : public Serializable{ * Accessor to data structures * @return CodecOrder& The list that reflects the user's choice */ - inline CodecOrder& getActiveCodecs() { return _codecOrder; } + inline CodecOrder& getActiveCodecs(void) { return _codecOrder; } void setActiveCodecs (const std::vector <std::string>& list); + inline std::string getRingtonePath(void) { return _ringtonePath; } + inline void setRingtonePath(std::string path) { _ringtonePath = path; } + + inline bool getRingtoneEnabled(void) { return _ringtoneEnabled; } + inline void setRingtoneEnabled(bool enabl) { _ringtoneEnabled = enabl; } + inline std::string getDisplayName(void) { return _displayName; } inline void setDisplayName(std::string name) { _displayName = name; } @@ -344,9 +354,24 @@ class Account : public Serializable{ */ std::string _codecStr; - // Display Name that can be used in SIP URI. + /** + * Ringtone .au file used for this account + */ + std::string _ringtonePath; + + /** + * Play ringtone when receiving a call + */ + bool _ringtoneEnabled; + + /** + * Display name when calling + */ std::string _displayName; + /** + * Useragent used for registration + */ std::string _useragent; }; diff --git a/sflphone-common/src/dbus/configurationmanager-introspec.xml b/sflphone-common/src/dbus/configurationmanager-introspec.xml index 20baa7de554395765935be09bf061d0bd43d2c2c..f76826b008e9edd621a7eaa5f02f333a6ee725dd 100755 --- a/sflphone-common/src/dbus/configurationmanager-introspec.xml +++ b/sflphone-common/src/dbus/configurationmanager-introspec.xml @@ -331,6 +331,7 @@ <method name="isRingtoneEnabled" tp:name-for-bindings="isRingtoneEnabled"> <tp:docstring> </tp:docstring> + <arg type="s" name="accountID" direction="in" /> <arg type="i" name="bool" direction="out"> <tp:docstring> </tp:docstring> @@ -340,11 +341,13 @@ <method name="ringtoneEnabled" tp:name-for-bindings="ringtoneEnabled"> <tp:docstring> </tp:docstring> + <arg type="s" name="accountID" direction="in"/> </method> <method name="getRingtoneChoice" tp:name-for-bindings="getRingtoneChoice"> <tp:docstring> </tp:docstring> + <arg type="s" name="accountID" direction="in"/> <arg type="s" name="tone" direction="out"> <tp:docstring> </tp:docstring> @@ -354,6 +357,7 @@ <method name="setRingtoneChoice" tp:name-for-bindings="setRingtoneChoice"> <tp:docstring> </tp:docstring> + <arg type="s" name="accountID" direction="in"/> <arg type="s" name="tone" direction="in"> <tp:docstring> </tp:docstring> diff --git a/sflphone-common/src/dbus/configurationmanager.cpp b/sflphone-common/src/dbus/configurationmanager.cpp index 7369affa107eef7b4585246339a18ab2d3ca209a..06c7836d60b2242b8c1bb4893eef5bcf411d0eeb 100755 --- a/sflphone-common/src/dbus/configurationmanager.cpp +++ b/sflphone-common/src/dbus/configurationmanager.cpp @@ -541,20 +541,20 @@ int32_t ConfigurationManager::isIax2Enabled(void) { return Manager::instance().isIax2Enabled(); } -void ConfigurationManager::ringtoneEnabled(void) { - Manager::instance().ringtoneEnabled(); +void ConfigurationManager::ringtoneEnabled(const std::string& accountID) { + Manager::instance().ringtoneEnabled(accountID); } -int32_t ConfigurationManager::isRingtoneEnabled(void) { - return Manager::instance().isRingtoneEnabled(); +int32_t ConfigurationManager::isRingtoneEnabled(const std::string& accountID) { + return Manager::instance().isRingtoneEnabled(accountID); } -std::string ConfigurationManager::getRingtoneChoice(void) { - return Manager::instance().getRingtoneChoice(); +std::string ConfigurationManager::getRingtoneChoice(const std::string& accountID) { + return Manager::instance().getRingtoneChoice(accountID); } -void ConfigurationManager::setRingtoneChoice(const std::string& tone) { - Manager::instance().setRingtoneChoice(tone); +void ConfigurationManager::setRingtoneChoice(const std::string& accountID, const std::string& tone) { + Manager::instance().setRingtoneChoice(accountID, tone); } std::string ConfigurationManager::getRecordPath(void) { diff --git a/sflphone-common/src/dbus/configurationmanager.h b/sflphone-common/src/dbus/configurationmanager.h index c767eee15face47b6af28275e1862f1e911caaa9..6c6083fad430a80a9468597ec29adeb2f192f55c 100755 --- a/sflphone-common/src/dbus/configurationmanager.h +++ b/sflphone-common/src/dbus/configurationmanager.h @@ -103,10 +103,10 @@ public: bool isMd5CredentialHashing (void); void setMd5CredentialHashing (const bool& enabled); int32_t isIax2Enabled( void ); - int32_t isRingtoneEnabled( void ); - void ringtoneEnabled( void ); - std::string getRingtoneChoice( void ); - void setRingtoneChoice( const std::string& tone ); + int32_t isRingtoneEnabled( const std::string& accountID ); + void ringtoneEnabled( const std::string& accountID ); + std::string getRingtoneChoice( const std::string& accountID ); + void setRingtoneChoice( const std::string& accountID, const std::string& tone ); std::string getRecordPath( void ); void setRecordPath(const std::string& recPath ); diff --git a/sflphone-common/src/iax/iaxaccount.cpp b/sflphone-common/src/iax/iaxaccount.cpp index 73c04ca0e57a85247d857cde180e7541bd669178..b0af8857985bf151b953dbaa3b45900b2b2bf06f 100644 --- a/sflphone-common/src/iax/iaxaccount.cpp +++ b/sflphone-common/src/iax/iaxaccount.cpp @@ -202,9 +202,9 @@ int IAXAccount::registerVoIPLink() _link->init(); // Stuff needed for IAX registration - setHostname (Manager::instance().getConfigString (_accountID, HOSTNAME)); - setUsername (Manager::instance().getConfigString (_accountID, USERNAME)); - setPassword (Manager::instance().getConfigString (_accountID, PASSWORD)); + setHostname (_hostname); + setUsername (_username); + setPassword (_password); _link->sendRegister (_accountID); diff --git a/sflphone-common/src/iax/iaxvoiplink.cpp b/sflphone-common/src/iax/iaxvoiplink.cpp index 0649b34df34770174505e3618ddab47c0512aad1..415bda1f6eb01bdeafeb5a5a6a925ca2c51b1baa 100644 --- a/sflphone-common/src/iax/iaxvoiplink.cpp +++ b/sflphone-common/src/iax/iaxvoiplink.cpp @@ -413,14 +413,18 @@ IAXVoIPLink::sendRegister (AccountID id) IAXAccount *account; bool result; + _debug("IAX: Sending registration"); + result = false; account = dynamic_cast<IAXAccount *> (getAccountPtr()); if (account->getHostname().empty()) { + _error("IAX: Error: Account hostname is empty"); return false; } if (account->getUsername().empty()) { + _error("IAX: Error: Account username is empty"); return false; } @@ -435,11 +439,11 @@ IAXVoIPLink::sendRegister (AccountID id) _regSession = iax_session_new(); if (!_regSession) { - _debug ("Error when generating new session for register"); + _debug ("IAX: Error when generating new session for register"); } else { - _debug ("IAX Sending registration to %s with user %s", account->getHostname().c_str() , account->getUsername().c_str()); + _debug ("IAX: Sending registration to %s with user %s", account->getHostname().c_str() , account->getUsername().c_str()); int val = iax_register (_regSession, account->getHostname().data(), account->getUsername().data(), account->getPassword().data(), 120); - _debug ("Return value: %d", val); + _debug ("IAX: Return value: %d", val); // set the time-out to 15 seconds, after that, resend a registration request. // until we unregister. _nextRefreshStamp = time (NULL) + 10; diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 662c7f16462e24229e526a1f4a9bec41ac2d5280..ebda50b2ddf0d0028bf0a86290fd82716613cf8f 100755 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -1613,7 +1613,7 @@ bool ManagerImpl::incomingCall (Call* call, const AccountID& accountId) { _debug ("Manager: Has no current call"); call->setConnectionState(Call::Ringing); - ringtone(); + ringtone(accountId); } else { @@ -1905,7 +1905,7 @@ void ManagerImpl::ringback () { /** * Multi Thread */ -void ManagerImpl::ringtone () { +void ManagerImpl::ringtone (const AccountID& accountID) { std::string ringchoice; AudioLayer *audiolayer; AudioCodec *codecForTone; @@ -1914,13 +1914,20 @@ void ManagerImpl::ringtone () { _debug("Manager: Ringtone"); - if (isRingtoneEnabled()) { + Account *account = getAccount(accountID); + + if(!account) { + _warn("Manager: Warning: invalid account in ringtone"); + return; + } + + if (account->getRingtoneEnabled()) { _debug ("Manager: Tone is enabled"); //TODO Comment this because it makes the daemon crashes since the main thread //synchronizes the ringtone thread. - ringchoice = audioPreference.getRingchoice(); + ringchoice = account->getRingtonePath(); //if there is no / inside the path if (ringchoice.find(DIR_SEPARATOR_CH) == std::string::npos) { @@ -2350,19 +2357,42 @@ int ManagerImpl::isIax2Enabled (void) { #endif } -int ManagerImpl::isRingtoneEnabled (void) { - return preferences.getRingtoneEnabled() ? 1 : 0; +int ManagerImpl::isRingtoneEnabled (const AccountID& id) { + Account *account = getAccount(id); + + if(!account) { + _warn("Manager: Warning: invalid account in ringtone enabled"); + return 0; + } + + return account->getRingtoneEnabled() ? 1 : 0; } -void ManagerImpl::ringtoneEnabled (void) { +void ManagerImpl::ringtoneEnabled (const AccountID& id) { + + Account *account = getAccount(id); + + if(!account) { + _warn("Manager: Warning: invalid account in ringtone enabled"); + return; + } - preferences.getRingtoneEnabled() ? preferences.setRingtoneEnabled(false) : preferences.setRingtoneEnabled(true); + account->getRingtoneEnabled() ? account->setRingtoneEnabled(false) : account->setRingtoneEnabled(true); } -std::string ManagerImpl::getRingtoneChoice (void) { - // we need the absolute path - std::string tone_name = audioPreference.getRingchoice(); +std::string ManagerImpl::getRingtoneChoice (const AccountID& id) { + + // retreive specified account id + Account *account = getAccount(id); + + if(!account) { + _warn("Manager: Warning: Not a valid account ID for ringone choice"); + return std::string(""); + } + + // we need the absolute path + std::string tone_name = account->getRingtonePath(); std::string tone_path; if (tone_name.find(DIR_SEPARATOR_CH) == std::string::npos) { @@ -2374,14 +2404,25 @@ std::string ManagerImpl::getRingtoneChoice (void) { tone_path = tone_name; } - _debug ("%s", tone_path.c_str()); + _debug ("Manager: get ringtone path %s", tone_path.c_str()); return tone_path; } -void ManagerImpl::setRingtoneChoice (const std::string& tone) { +void ManagerImpl::setRingtoneChoice (const std::string& tone, const AccountID& id) { + + _debug("Manager: Set ringtone path %s to account", tone.c_str()); + + // retreive specified account id + Account *account = getAccount(id); + + if(!account) { + _warn("Manager: Warning: Not a valid account ID for ringtone choice"); + return; + } + // we save the absolute path - audioPreference.setRingchoice(tone); + account->setRingtonePath(tone); } std::string ManagerImpl::getRecordPath (void) { @@ -2389,7 +2430,7 @@ std::string ManagerImpl::getRecordPath (void) { } void ManagerImpl::setRecordPath (const std::string& recPath) { - _debug ("ManagerImpl::setRecordPath(%s)! ", recPath.c_str()); + _debug ("Manager: Set record path %s", recPath.c_str()); audioPreference.setRecordpath(recPath); } @@ -3952,3 +3993,4 @@ std::vector<std::string> ManagerImpl::getParticipantList ( return v; } + diff --git a/sflphone-common/src/managerimpl.h b/sflphone-common/src/managerimpl.h index a03bde90cb3695a182ae9dad2b3fb273232a5c22..8f7edc30cfdef339e6879553541c3a2595247022 100755 --- a/sflphone-common/src/managerimpl.h +++ b/sflphone-common/src/managerimpl.h @@ -613,25 +613,25 @@ class ManagerImpl { * @return int 1 if enabled * 0 otherwise */ - int isRingtoneEnabled( void ); + int isRingtoneEnabled( const AccountID& id ); /** * Set the ringtone option * Inverse current value */ - void ringtoneEnabled( void ); + void ringtoneEnabled( const AccountID& id ); /** * Get the ringtone * @return gchar* The file name selected as a ringtone */ - std::string getRingtoneChoice( void ); + std::string getRingtoneChoice( const AccountID& id); /** * Set a ringtone * @param tone The file name of the ringtone */ - void setRingtoneChoice( const std::string& ); + void setRingtoneChoice( const std::string&, const AccountID& id); /** * Get the recording path from configuration tree @@ -926,7 +926,7 @@ class ManagerImpl { /** * Handle played music when an incoming call occurs */ - void ringtone (); + void ringtone (const AccountID& accountID); /** * Handle played music when a congestion occurs diff --git a/sflphone-common/src/preferences.cpp b/sflphone-common/src/preferences.cpp index 2663346dedf1bc7c0d74f791014a94f6bfc3ebed..0a69cd78919e3d286e8e37b65909690aa3ca5d8b 100644 --- a/sflphone-common/src/preferences.cpp +++ b/sflphone-common/src/preferences.cpp @@ -31,15 +31,15 @@ #include "preferences.h" #include <sstream> #include "global.h" +#include "user_cfg.h" Preferences::Preferences() : _accountOrder("") , _audioApi(0) , _historyLimit(30) , _historyMaxCalls(20) , _notifyMails(false) - , _zoneToneChoice("North America") // DFT_ZONE + , _zoneToneChoice(DFT_ZONE) // DFT_ZONE , _registrationExpire(180) - , _ringtoneEnabled(true) // CONFIG_RINGTONE , _portNum(5060) , _searchBarDisplay(true) , _zeroConfenable(false) @@ -69,7 +69,6 @@ void Preferences::serialize(Conf::YamlEmitter *emiter) Conf::ScalarNode zoneToneChoice(_zoneToneChoice); std::stringstream expirestr; expirestr << _registrationExpire; Conf::ScalarNode registrationExpire(expirestr.str()); - Conf::ScalarNode ringtoneEnabled(_ringtoneEnabled ? "true" : "false"); std::stringstream portstr; portstr << _portNum; Conf::ScalarNode portNum(portstr.str()); Conf::ScalarNode searchBarDisplay(_searchBarDisplay ? "true" : "false"); @@ -83,7 +82,6 @@ void Preferences::serialize(Conf::YamlEmitter *emiter) preferencemap.setKeyValue(notifyMailsKey, ¬ifyMails); preferencemap.setKeyValue(zoneToneChoiceKey, &zoneToneChoice); preferencemap.setKeyValue(registrationExpireKey, ®istrationExpire); - preferencemap.setKeyValue(ringtoneEnabledKey, &ringtoneEnabled); preferencemap.setKeyValue(portNumKey, &portNum); preferencemap.setKeyValue(searchBarDisplayKey, &searchBarDisplay); preferencemap.setKeyValue(zeroConfenableKey, &zeroConfenable); @@ -113,8 +111,6 @@ void Preferences::unserialize(Conf::MappingNode *map) if(val) { _zoneToneChoice = val->getValue(); val = NULL; } val = (Conf::ScalarNode *)(map->getValue(registrationExpireKey)); if(val) { _registrationExpire = atoi(val->getValue().data()); val = NULL; } - val = (Conf::ScalarNode *)(map->getValue(ringtoneEnabledKey)); - if(val) { _registrationExpire = atoi(val->getValue().data()); val = NULL; } val = (Conf::ScalarNode *)(map->getValue(portNumKey)); if(val) { _portNum = atoi(val->getValue().data()); val = NULL; } val = (Conf::ScalarNode *)(map->getValue(searchBarDisplayKey)); @@ -131,10 +127,10 @@ void Preferences::unserialize(Conf::MappingNode *map) VoipPreference::VoipPreference() : _playDtmf(true) , _playTones(true) - , _pulseLength(250)// DFT_PULSE_LENGTH_STR + , _pulseLength(atoi(DFT_PULSE_LENGTH_STR))// DFT_PULSE_LENGTH_STR , _sendDtmfAs(0) , _symmetricRtp(true) - , _zidFile("zidFile")// ZRTP_ZID_FILENAME + , _zidFile(ZRTP_ZIDFILE)// ZRTP_ZID_FILENAME { } @@ -314,19 +310,18 @@ void HookPreference::unserialize(Conf::MappingNode *map) -AudioPreference::AudioPreference() : _cardin(0) // ALSA_DFT_CARD - , _cardout(0) // ALSA_DFT_CARD - , _cardring(0) // ALSA_DFT_CARD - , _framesize(20) // DFT_FRAME_SIZE +AudioPreference::AudioPreference() : _cardin(atoi(ALSA_DFT_CARD)) // ALSA_DFT_CARD + , _cardout(atoi(ALSA_DFT_CARD)) // ALSA_DFT_CARD + , _cardring(atoi(ALSA_DFT_CARD)) // ALSA_DFT_CARD + , _framesize(atoi(DFT_FRAME_SIZE)) // DFT_FRAME_SIZE , _plugin("default") // PCM_DEFAULT , _smplrate(44100) // DFT_SAMPLE_RATE , _devicePlayback("") , _deviceRecord("") , _deviceRingtone("") , _recordpath("") // DFT_RECORD_PATH - , _ringchoice("/usr/share/sflphone/ringtones/konga.ul") //DFT_RINGTONE - , _volumemic(100) // DFT_VOL_SPKR_STR - , _volumespkr(100) // DFT_VOL_MICRO_STR + , _volumemic(atoi(DFT_VOL_SPKR_STR)) // DFT_VOL_SPKR_STR + , _volumespkr(atoi(DFT_VOL_MICRO_STR)) // DFT_VOL_MICRO_STR { } @@ -361,14 +356,12 @@ void AudioPreference::serialize(Conf::YamlEmitter *emitter) // general preference Conf::ScalarNode recordpath(_recordpath); //: /home/msavard/Bureau - Conf::ScalarNode ringchoice(_ringchoice); // : /usr/share/sflphone/ringtones/konga.ul std::stringstream micstr; micstr << _volumemic; Conf::ScalarNode volumemic(micstr.str()); //: 100 std::stringstream spkrstr; spkrstr << _volumespkr; Conf::ScalarNode volumespkr(spkrstr.str()); //: 100 preferencemap.setKeyValue(recordpathKey, &recordpath); - preferencemap.setKeyValue(ringchoiceKey, &ringchoice); preferencemap.setKeyValue(volumemicKey, &volumemic); preferencemap.setKeyValue(volumespkrKey, &volumespkr); @@ -415,8 +408,6 @@ void AudioPreference::unserialize(Conf::MappingNode *map) val = (Conf::ScalarNode *)(map->getValue(recordpathKey)); if(val) { _recordpath = val->getValue(); val = NULL; } - val = (Conf::ScalarNode *)(map->getValue(ringchoiceKey)); - if(val) { _ringchoice = val->getValue(); val = NULL; } val = (Conf::ScalarNode *)(map->getValue(volumemicKey)); if(val) { _volumemic = atoi(val->getValue().data()); val = NULL; } val = (Conf::ScalarNode *)(map->getValue(volumespkrKey)); diff --git a/sflphone-common/src/preferences.h b/sflphone-common/src/preferences.h index 9ef4de1edf5d58adb06a618d92461029edcc9bd8..c9569e7d0ba08c9562cb528c289508889d879836 100755 --- a/sflphone-common/src/preferences.h +++ b/sflphone-common/src/preferences.h @@ -41,7 +41,6 @@ const Conf::Key historyMaxCallsKey("historyMaxCalls"); // : 20 const Conf::Key notifyMailsKey("notifyMails"); // : false const Conf::Key zoneToneChoiceKey("zoneToneChoice"); // : North America const Conf::Key registrationExpireKey("registrationExpire");// : 180 -const Conf::Key ringtoneEnabledKey("ringtoneEnabled"); // : true const Conf::Key portNumKey("portNum"); // : 5060 const Conf::Key searchBarDisplayKey("searchBarDisplay"); // : true const Conf::Key zeroConfenableKey("zeroConfenable"); // : false @@ -72,7 +71,7 @@ const Conf::Key sipEnabledKey("sipEnabled"); //: false const Conf::Key urlCommandKey("urlCommand"); //: x-www-browser const Conf::Key urlSipFieldKey("urlSipField"); //: X-sflphone-url - +// audio preferences const Conf::Key alsamapKey("alsa"); const Conf::Key pulsemapKey("pulse"); const Conf::Key cardinKey("cardin");// : 0 @@ -85,7 +84,6 @@ const Conf::Key devicePlaybackKey("devicePlayback");//: const Conf::Key deviceRecordKey("deviceRecord");// : const Conf::Key deviceRingtoneKey("deviceRingtone");// : const Conf::Key recordpathKey("recordpath");//: /home/msavard/Bureau -const Conf::Key ringchoiceKey("ringchoice");//: /usr/share/sflphone/ringtones/konga.ul const Conf::Key volumemicKey("volumemic");//: 100 const Conf::Key volumespkrKey("volumespkr");//: 100 @@ -124,9 +122,6 @@ class Preferences : public Serializable { int getRegistrationExpire(void) { return _registrationExpire; } void setRegistrationExpire(int exp) { _registrationExpire = exp; } - bool getRingtoneEnabled(void) { return _ringtoneEnabled; } - void setRingtoneEnabled(bool ring) { _ringtoneEnabled = ring; } - int getPortNum(void) { return _portNum; } void setPortNum(int port) { _portNum = port; } @@ -150,7 +145,6 @@ class Preferences : public Serializable { bool _notifyMails; std::string _zoneToneChoice; int _registrationExpire; - bool _ringtoneEnabled; int _portNum; bool _searchBarDisplay; bool _zeroConfenable; @@ -333,9 +327,6 @@ class AudioPreference : public Serializable { std::string getRecordpath(void) { return _recordpath; } void setRecordpath(std::string r) { _recordpath = r; } - std::string getRingchoice(void) { return _ringchoice; } - void setRingchoice(std::string r) { _ringchoice = r; } - int getVolumemic(void) { return _volumemic; } void setVolumemic(int m) { _volumemic = m; } @@ -359,7 +350,6 @@ class AudioPreference : public Serializable { // general preference std::string _recordpath; //: /home/msavard/Bureau - std::string _ringchoice; // : /usr/share/sflphone/ringtones/konga.ul int _volumemic; //: 100 int _volumespkr; //: 100 diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp index fad078f22ff9ee61aa8e27cf9c45a4959ad13054..4a9bfb8b88a53b67b73de87cbd4024ba7e133263 100755 --- a/sflphone-common/src/sip/sipaccount.cpp +++ b/sflphone-common/src/sip/sipaccount.cpp @@ -116,8 +116,6 @@ SIPAccount::SIPAccount (const AccountID& accountID) , _stunServer(DFT_STUN_SERVER) , _tlsEnabled(false) , _stunEnabled(false) - // , _routeSet("") - // , _tlsListenerPort("5061") , _srtpEnabled(false) , _srtpKeyExchange("sdes") , _srtpFallback(false) @@ -185,6 +183,8 @@ void SIPAccount::serialize(Conf::YamlEmitter *emitter) { Conf::ScalarNode sameasLocal(_publishedSameasLocal ? "true" : "false"); Conf::ScalarNode resolveOnce(_resolveOnce ? "true" : "false"); Conf::ScalarNode codecs(_codecStr); + Conf::ScalarNode ringtonePath(_ringtonePath); + Conf::ScalarNode ringtoneEnabled(_ringtoneEnabled ? "true" : "false"); Conf::ScalarNode stunServer(_stunServer); Conf::ScalarNode stunEnabled(_stunEnabled ? "true" : "false"); Conf::ScalarNode displayName(_displayName); @@ -237,6 +237,8 @@ void SIPAccount::serialize(Conf::YamlEmitter *emitter) { accountmap.setKeyValue(dtmfTypeKey, &dtmfType); accountmap.setKeyValue(displayNameKey, &displayName); accountmap.setKeyValue(codecsKey, &codecs); + accountmap.setKeyValue(ringtonePathKey, &ringtonePath); + accountmap.setKeyValue(ringtoneEnabledKey, &ringtoneEnabled); accountmap.setKeyValue(srtpKey, &srtpmap); srtpmap.setKeyValue(srtpEnableKey, &srtpenabled); @@ -304,6 +306,10 @@ void SIPAccount::unserialize(Conf::MappingNode *map) val = (Conf::ScalarNode *)(map->getValue(codecsKey)); if(val) { _codecStr = val->getValue(); val = NULL; } + val = (Conf::ScalarNode *)(map->getValue(ringtonePathKey)); + if(val) { _ringtonePath = val->getValue(); val = NULL; } + val = (Conf::ScalarNode *)(map->getValue(ringtoneEnabledKey)); + if(val) { _ringtoneEnabled = (val->getValue() == "true") ? true : false; val = NULL; } val = (Conf::ScalarNode *)(map->getValue(expireKey)); if(val) { _registrationExpire = val->getValue(); val = NULL; } @@ -419,6 +425,8 @@ void SIPAccount::setAccountDetails(const std::map<std::string, std::string>& det std::string password; std::string mailbox; std::string accountEnable; + std::string ringtonePath; + std::string ringtoneEnabled; // Account setting common to SIP and IAX find_in_map(CONFIG_ACCOUNT_ALIAS, alias) @@ -428,13 +436,17 @@ void SIPAccount::setAccountDetails(const std::map<std::string, std::string>& det find_in_map(PASSWORD, password) find_in_map(CONFIG_ACCOUNT_MAILBOX, mailbox); find_in_map(CONFIG_ACCOUNT_ENABLE, accountEnable); + find_in_map(CONFIG_RINGTONE_PATH, ringtonePath); + find_in_map(CONFIG_RINGTONE_ENABLED, ringtoneEnabled); setAlias(alias); setType(type); setUsername(username); setHostname(hostname); setPassword(password); - setEnabled((accountEnable.compare("true") == 0) ? true : false); + setEnabled((accountEnable == "true")); + setRingtonePath(ringtonePath); + setRingtoneEnabled((ringtoneEnabled == "true")); // SIP specific account settings if(getType() == "SIP") { @@ -607,6 +619,9 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() a.insert(std::pair<std::string, std::string>(USERNAME, getUsername())); a.insert(std::pair<std::string, std::string>(PASSWORD, getPassword())); + a.insert(std::pair<std::string, std::string>(CONFIG_RINGTONE_PATH, getRingtonePath())); + a.insert(std::pair<std::string, std::string>(CONFIG_RINGTONE_ENABLED, getRingtoneEnabled() ? "true" : "false")); + RegistrationState state = Unregistered; std::string registrationStateCode; std::string registrationStateDescription; @@ -631,6 +646,7 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() a.insert(std::pair<std::string, std::string>(REGISTRATION_STATE_CODE, registrationStateCode)); a.insert(std::pair<std::string, std::string>(REGISTRATION_STATE_DESCRIPTION, registrationStateDescription)); + // Add sip specific details if(getType() == "SIP") { diff --git a/sflphone-common/src/user_cfg.h b/sflphone-common/src/user_cfg.h index 910e3f9e15691e625918a4eab7920034ca078ca7..3d950e71009b3ff37e27287f99d0697124a28c46 100644 --- a/sflphone-common/src/user_cfg.h +++ b/sflphone-common/src/user_cfg.h @@ -81,10 +81,9 @@ #define WINDOW_POSITION_Y "Window.positionY" #define SHOW_STATUSICON "Statusicon.show" - #define IP2IP_PROFILE "IP2IP" #define SIGNALISATION "VoIPLink" /** Section Signalisation */ -#define ZRTP_ZIDFILE "ZRTP.zidFile" /** The filename used for storing ZIDs */ +#define ZRTP_ZIDFILE "zidFile" /** The filename used for storing ZIDs */ #define PLAY_DTMF "DTMF.playDtmf" /** Whether or not should play dtmf */ #define PLAY_TONES "DTMF.playTones" /** Whether or not should play tones */ #define PULSE_LENGTH "DTMF.pulseLength" /** Length of the DTMF in millisecond */ diff --git a/sippxml/g711a.pcap b/sippxml/g711a.pcap new file mode 100644 index 0000000000000000000000000000000000000000..bafea386f396eacbd14871f0156aed76df0166ee Binary files /dev/null and b/sippxml/g711a.pcap differ diff --git a/sippxml/voice b/sippxml/voice new file mode 100644 index 0000000000000000000000000000000000000000..c881cf2d1b97c326d0f5d78ad4beebde51bd4b15 Binary files /dev/null and b/sippxml/voice differ