diff --git a/sflphone-client-gnome/doc/C/figures/conference.png b/sflphone-client-gnome/doc/C/figures/conference.png new file mode 100644 index 0000000000000000000000000000000000000000..91fbc4904ba21ded7969ef39c5ebdbc663f9bb44 Binary files /dev/null and b/sflphone-client-gnome/doc/C/figures/conference.png differ diff --git a/sflphone-client-gnome/doc/C/figures/conference_attached.png b/sflphone-client-gnome/doc/C/figures/conference_attached.png new file mode 100644 index 0000000000000000000000000000000000000000..06c3dad51fef67e0f7a3133f150291c9879bea51 Binary files /dev/null and b/sflphone-client-gnome/doc/C/figures/conference_attached.png differ diff --git a/sflphone-client-gnome/doc/C/figures/conference_detached.png b/sflphone-client-gnome/doc/C/figures/conference_detached.png new file mode 100644 index 0000000000000000000000000000000000000000..4100a23dd508ae2087056efa77c4b97363b3a3a7 Binary files /dev/null and b/sflphone-client-gnome/doc/C/figures/conference_detached.png differ diff --git a/sflphone-client-gnome/doc/C/figures/drag_n_drop.png b/sflphone-client-gnome/doc/C/figures/drag_n_drop.png new file mode 100644 index 0000000000000000000000000000000000000000..5a9a96d00f33b101bff4824ce9dbf092d9ad7c24 Binary files /dev/null and b/sflphone-client-gnome/doc/C/figures/drag_n_drop.png differ diff --git a/sflphone-client-gnome/doc/C/sflphone.xml b/sflphone-client-gnome/doc/C/sflphone.xml index 07f31faa79783e77400404002ca196a58ac94b6c..b104b8b2f8493a28a289d5a41f861170ddbadcf5 100644 --- a/sflphone-client-gnome/doc/C/sflphone.xml +++ b/sflphone-client-gnome/doc/C/sflphone.xml @@ -523,6 +523,30 @@ added the same way, dragging a call on the conference icon. </para> + <!-- ==== Figure ==== --> + <figure id="drag_n_frop-fig"> + <title>Creating a new conference</title> + <screenshot> + <mediaobject> + <imageobject> + <imagedata fileref="figures/drag_n_drop.png" format="PNG"/> + </imageobject> + </mediaobject> + </screenshot> + </figure> + <!-- ==== End of Figure ==== --> + <!-- ==== Figure ==== --> + <figure id="conference-fig"> + <title>Conference call</title> + <screenshot> + <mediaobject> + <imageobject> + <imagedata fileref="figures/conference.png" format="PNG"/> + </imageobject> + </mediaobject> + </screenshot> + </figure> + <!-- ==== End of Figure ==== --> </listitem> <listitem> <guilabel>Leave a conference</guilabel> @@ -530,9 +554,33 @@ SFLphone conference model let you leave a conference that you are currently hosting to answer any other incoming communication or even initiate new ones. The conference is - not interupted Double clicking the conference icon - let you reintroduce the conference. - </para> + not interupted, double clicking the conference icon + let you reintroduce it at any momment. + </para> + <!-- ==== Figure ==== --> + <figure id="conference_detached-fig"> + <title>Conference detached</title> + <screenshot> + <mediaobject> + <imageobject> + <imagedata fileref="figures/conference_detached.png" format="PNG"/> + </imageobject> + </mediaobject> + </screenshot> + </figure> + <!-- ==== End of Figure ==== --> + <!-- ==== Figure ==== --> + <figure id="conference_attached-fig"> + <title>Conference attached</title> + <screenshot> + <mediaobject> + <imageobject> + <imagedata fileref="figures/conference_attached.png" format="PNG"/> + </imageobject> + </mediaobject> + </screenshot> + </figure> + <!-- ==== End of Figure ==== --> </listitem> <listitem> <guilabel>Multiple conference</guilabel> @@ -546,11 +594,9 @@ <listitem> <guilabel>Hangup/Hold a conference</guilabel> <para> - Right click the conference icon. - Holding the conference put all - participants on hold. - Hangup a conference hangup all - participants. + Select the conference icon and press hangup/hold button + on the toolbar. The selected action is applied on every + conference participants. </para> </listitem> </itemizedlist> diff --git a/sflphone-client-gnome/doc/Makefile.am b/sflphone-client-gnome/doc/Makefile.am index b98e32348b0dbc2bd444dd6b3c7a5c0f0faa5ecc..2993072194d2eb793d34df550ab2eb2439f2b3ca 100644 --- a/sflphone-client-gnome/doc/Makefile.am +++ b/sflphone-client-gnome/doc/Makefile.am @@ -17,11 +17,15 @@ DOC_FIGURES = figures/addressbook-button.png \ figures/transfer-go.png \ figures/voicemail.png \ figures/rec-settings.png \ - figures/desktop-notif-settings.png \ - figures/callshistory-settings.png \ - figures/configfile-settings.png \ + figures/desktop-notif-settings.png \ + figures/callshistory-settings.png \ + figures/configfile-settings.png \ figures/notif-example.png \ - figures/systemtray-settings.png \ + figures/systemtray-settings.png \ figures/voicemail-notif.png \ - figures/account_advanced.png + figures/account_advanced.png \ + figures/drag_n_drop.png \ + figures/conference.png \ + figures/conference_detached.png \ + figures/conference_attached.png DOC_LINGUAS = fr de es it zh_TW zh_HK zh_CN ko pl pt_BR pt ru diff --git a/sflphone-client-gnome/pixmaps/Makefile.am b/sflphone-client-gnome/pixmaps/Makefile.am index 8374f0304f9b05357810d230695b55d18108caaa..ee8fcf97c525a23827e41726a12ebd2bd6be4534 100644 --- a/sflphone-client-gnome/pixmaps/Makefile.am +++ b/sflphone-client-gnome/pixmaps/Makefile.am @@ -40,7 +40,8 @@ buttons_DATA = current.svg \ lock_confirmed.svg \ lock_error.svg \ lock_off.svg \ - lock_unconfirmed.svg + lock_unconfirmed.svg \ + phone.svg buttonsdir = $(datadir)/sflphone EXTRA_DIST = $(buttons_DATA) $(icon_DATA) diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c index 1775d54761890615cdf6e7283f24c0e4e979fd6a..28db999a2deeda2e6d1066634148b465b2d4443e 100644 --- a/sflphone-client-gnome/src/actions.c +++ b/sflphone-client-gnome/src/actions.c @@ -1085,7 +1085,7 @@ sflphone_fill_codec_list() for(pl=codecs; *codecs; codecs++) { details = (gchar **)dbus_codec_details(atoi(*codecs)); - if(codec_list_get_by_payload((gconstpointer)atoi(*codecs))!=NULL){ + if(codec_list_get_by_payload((gconstpointer)(size_t)atoi(*codecs))!=NULL){ // does nothing - the codec is already in the list, so is active. } else{ diff --git a/sflphone-client-gnome/src/config/preferencesdialog.c b/sflphone-client-gnome/src/config/preferencesdialog.c index fc4a2b0389342a16528813e5ef50630ad1dcca88..93c1982f7ded3c705d178c1ec2d7c71444fbd40e 100644 --- a/sflphone-client-gnome/src/config/preferencesdialog.c +++ b/sflphone-client-gnome/src/config/preferencesdialog.c @@ -62,29 +62,29 @@ GHashTable * directIpCallsProperties = NULL; static void update_ip_address_port_cb ( GtkSpinButton *button UNUSED, void *ptr ) { - // dbus_set_sip_port(gtk_spin_button_get_value_as_int((GtkSpinButton *)(ptr))); - gchar* local_address = g_strdup((gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(localAddressCombo))); - gchar* local_port = g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(localPortSpinBox))); + // dbus_set_sip_port(gtk_spin_button_get_value_as_int((GtkSpinButton *)(ptr))); + gchar* local_address = g_strdup((gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(localAddressCombo))); + gchar* local_port = g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(localPortSpinBox))); - gchar* ip_interface = g_strconcat(local_address, ":", local_port, NULL); + gchar* ip_interface = g_strconcat(local_address, ":", local_port, NULL); - DEBUG("update_ip_address_port_cb %s\n", ip_interface); + DEBUG("update_ip_address_port_cb %s\n", ip_interface); - dbus_set_sip_address(ip_interface); + dbus_set_sip_address(ip_interface); } -static void + static void set_md5_hash_cb(GtkWidget *widget UNUSED, gpointer data UNUSED) { - gboolean enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); - dbus_set_md5_credential_hashing(enabled); + gboolean enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); + dbus_set_md5_credential_hashing(enabled); } -static void + static void start_hidden( void ) { - dbus_start_hidden(); + dbus_start_hidden(); } static void set_popup_mode (GtkWidget *widget, gpointer *userdata) @@ -94,503 +94,502 @@ static void set_popup_mode (GtkWidget *widget, gpointer *userdata) } - void + void set_notif_level( ) { - dbus_set_notify(); + dbus_set_notify(); } static void history_limit_cb (GtkSpinButton *button, void *ptr) { - history_limit = gtk_spin_button_get_value_as_int((GtkSpinButton *)(ptr)); + history_limit = gtk_spin_button_get_value_as_int((GtkSpinButton *)(ptr)); } static void history_enabled_cb (GtkWidget *widget) { - history_enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); - gtk_widget_set_sensitive (GTK_WIDGET (history_value), history_enabled); - - // Toggle it through D-Bus - dbus_set_history_enabled (); + history_enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); + gtk_widget_set_sensitive (GTK_WIDGET (history_value), history_enabled); + + // Toggle it through D-Bus + dbus_set_history_enabled (); } - + void clean_history( void ) { - calllist_clean_history(); + calllist_clean_history(); } 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 ZRTP"); + show_advanced_zrtp_options((GHashTable *) data); } static void show_advanced_tls_options_cb(GtkWidget *widget UNUSED, gpointer data) { - DEBUG("Advanced options for TLS"); - show_advanced_tls_options((GHashTable *) data); + DEBUG("Advanced options for TLS"); + show_advanced_tls_options((GHashTable *) 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(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), 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")); - g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_KEY_EXCHANGE), g_strdup(KEY_EXCHANGE_NONE)); - } + 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), 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")); + g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_KEY_EXCHANGE), g_strdup(KEY_EXCHANGE_NONE)); + } } static void use_sip_tls_cb(GtkWidget *widget, gpointer data) { - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { - DEBUG("Using sips"); - gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE); - g_hash_table_replace(directIpCallsProperties, + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { + DEBUG("Using sips"); + gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE); + g_hash_table_replace(directIpCallsProperties, g_strdup(TLS_ENABLE), g_strdup("true")); - } else { - gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); - g_hash_table_replace(directIpCallsProperties, + } else { + gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); + g_hash_table_replace(directIpCallsProperties, g_strdup(TLS_ENABLE), g_strdup("false")); - } + } } static void ip2ip_local_address_changed_cb(GtkWidget *widget, gpointer data) { - DEBUG("ip2ip_local_address_changed_cb\n"); - g_hash_table_replace(directIpCallsProperties, g_strdup(LOCAL_ADDRESS), g_strdup((gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(widget)))); + DEBUG("ip2ip_local_address_changed_cb\n"); + g_hash_table_replace(directIpCallsProperties, g_strdup(LOCAL_ADDRESS), g_strdup((gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(widget)))); } static void ip2ip_local_port_changed_cb(GtkWidget *widget, gpointer data) { - DEBUG("ip2ip_local_port_changed_cb\n"); - gint new_port = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget)); - DEBUG("new_port %i", new_port); - g_hash_table_replace(directIpCallsProperties, - g_strdup(LOCAL_PORT), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(GTK_SPIN_BUTTON(widget))))); + DEBUG("ip2ip_local_port_changed_cb\n"); + gint new_port = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget)); + DEBUG("new_port %i", new_port); + g_hash_table_replace(directIpCallsProperties, + g_strdup(LOCAL_PORT), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(GTK_SPIN_BUTTON(widget))))); } GtkWidget* create_direct_ip_calls_tab() { - GtkWidget * frame; - GtkWidget * table; - GtkWidget * label; - GtkWidget * explanationLabel; - - GtkWidget * localPortLabel; - // GtkWidget * localPortSpinBox; - GtkWidget * localAddressLabel; - // GtkWidget * localAddressCombo; - - GtkWidget * keyExchangeCombo; - GtkWidget * advancedZrtpButton; - GtkWidget * useSipTlsCheckBox; - - gchar * curSRTPEnabled = "false"; - gchar * curTlsEnabled = "false"; - gchar * curKeyExchange = "0"; - gchar * description; - - gchar * local_address; - gchar * local_port; - - //directIpCallsProperties = sflphone_get_ip2ip_properties(); - sflphone_get_ip2ip_properties(&directIpCallsProperties); - - if(directIpCallsProperties != NULL) { - DEBUG("got a directIpCallsProperties"); - local_address = g_hash_table_lookup(directIpCallsProperties, LOCAL_ADDRESS); - local_port = g_hash_table_lookup(directIpCallsProperties, LOCAL_PORT); - DEBUG(" local address = %s", local_address); - DEBUG(" local port = %s", local_port); - curSRTPEnabled = g_hash_table_lookup(directIpCallsProperties, ACCOUNT_SRTP_ENABLED); - DEBUG(" curSRTPEnabled = %s", curSRTPEnabled); - curKeyExchange = g_hash_table_lookup(directIpCallsProperties, ACCOUNT_KEY_EXCHANGE); - curTlsEnabled = g_hash_table_lookup(directIpCallsProperties, TLS_ENABLE); - } - - - - GtkWidget * vbox = gtk_vbox_new(FALSE, 10); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); - - description = g_markup_printf_escaped(_("This profile is used when you want to reach a remote peer simply by typing a sip URI such as <b>sip:remotepeer</b>. The settings you define here will also be used if no account can be matched to an incoming or outgoing call.")); - explanationLabel = gtk_label_new(NULL); - gtk_label_set_markup(GTK_LABEL(explanationLabel), description); - gtk_misc_set_alignment(GTK_MISC(explanationLabel), 0, 0.5); - gtk_box_pack_start(GTK_BOX(vbox), explanationLabel, FALSE, FALSE, 0); - - /** - * Network Interface Section - */ - gnome_main_section_new_with_table (_("Network Interface"), &frame, &table, 2, 3); - gtk_container_set_border_width (GTK_CONTAINER(table), 10); - gtk_table_set_row_spacings (GTK_TABLE(table), 10); - gtk_table_set_col_spacings( GTK_TABLE(table), 10); - gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); - - /** - * Retreive the list of IP interface from the - * the daemon and build the combo box. - */ - - GtkListStore * ipInterfaceListStore; - GtkTreeIter iter; - - ipInterfaceListStore = gtk_list_store_new( 1, G_TYPE_STRING ); - localAddressLabel = gtk_label_new_with_mnemonic (_("Local address")); - gtk_table_attach ( GTK_TABLE( table ), localAddressLabel, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_misc_set_alignment(GTK_MISC (localAddressLabel), 0, 0.5); - - GtkTreeIter current_local_address_iter = iter; - gchar ** iface_list = NULL; - iface_list = (gchar**) dbus_get_all_ip_interface(); - gchar ** iface = NULL; - - gboolean iface_found = FALSE; - - if (iface_list != NULL) { - - for (iface = iface_list; *iface; iface++) { - DEBUG("Interface %s", *iface); - gtk_list_store_append(ipInterfaceListStore, &iter ); - gtk_list_store_set(ipInterfaceListStore, &iter, 0, *iface, -1 ); - - if (!iface_found && (g_strcmp0(*iface, local_address) == 0)) { - DEBUG("Setting active local address combo box"); - current_local_address_iter = iter; - iface_found = TRUE; + GtkWidget * frame; + GtkWidget * table; + GtkWidget * label; + GtkWidget * explanationLabel; + + GtkWidget * localPortLabel; + // GtkWidget * localPortSpinBox; + GtkWidget * localAddressLabel; + // GtkWidget * localAddressCombo; + + GtkWidget * keyExchangeCombo; + GtkWidget * advancedZrtpButton; + GtkWidget * useSipTlsCheckBox; + + gchar * curSRTPEnabled = "false"; + gchar * curTlsEnabled = "false"; + gchar * curKeyExchange = "0"; + gchar * description; + + gchar * local_address; + gchar * local_port; + + //directIpCallsProperties = sflphone_get_ip2ip_properties(); + sflphone_get_ip2ip_properties(&directIpCallsProperties); + + if(directIpCallsProperties != NULL) { + DEBUG("got a directIpCallsProperties"); + local_address = g_hash_table_lookup(directIpCallsProperties, LOCAL_ADDRESS); + local_port = g_hash_table_lookup(directIpCallsProperties, LOCAL_PORT); + DEBUG(" local address = %s", local_address); + DEBUG(" local port = %s", local_port); + curSRTPEnabled = g_hash_table_lookup(directIpCallsProperties, ACCOUNT_SRTP_ENABLED); + DEBUG(" curSRTPEnabled = %s", curSRTPEnabled); + curKeyExchange = g_hash_table_lookup(directIpCallsProperties, ACCOUNT_KEY_EXCHANGE); + curTlsEnabled = g_hash_table_lookup(directIpCallsProperties, TLS_ENABLE); + } + + + + GtkWidget * vbox = gtk_vbox_new(FALSE, 10); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); + + description = g_markup_printf_escaped(_("This profile is used when you want to reach a remote peer simply by typing a sip URI such as <b>sip:remotepeer</b>. The settings you define here will also be used if no account can be matched to an incoming or outgoing call.")); + explanationLabel = gtk_label_new(NULL); + gtk_label_set_markup(GTK_LABEL(explanationLabel), description); + gtk_misc_set_alignment(GTK_MISC(explanationLabel), 0, 0.5); + gtk_box_pack_start(GTK_BOX(vbox), explanationLabel, FALSE, FALSE, 0); + + /** + * Network Interface Section + */ + gnome_main_section_new_with_table (_("Network Interface"), &frame, &table, 2, 3); + gtk_container_set_border_width (GTK_CONTAINER(table), 10); + gtk_table_set_row_spacings (GTK_TABLE(table), 10); + gtk_table_set_col_spacings( GTK_TABLE(table), 10); + gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); + + /** + * Retreive the list of IP interface from the + * the daemon and build the combo box. + */ + + GtkListStore * ipInterfaceListStore; + GtkTreeIter iter; + + ipInterfaceListStore = gtk_list_store_new( 1, G_TYPE_STRING ); + localAddressLabel = gtk_label_new_with_mnemonic (_("Local address")); + gtk_table_attach ( GTK_TABLE( table ), localAddressLabel, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment(GTK_MISC (localAddressLabel), 0, 0.5); + + GtkTreeIter current_local_address_iter = iter; + gchar ** iface_list = NULL; + iface_list = (gchar**) dbus_get_all_ip_interface(); + gchar ** iface; + + gboolean iface_found = FALSE; + + if (iface_list != NULL) { + + for (iface = iface_list; *iface; iface++) { + gtk_list_store_append(ipInterfaceListStore, &iter ); + gtk_list_store_set(ipInterfaceListStore, &iter, 0, *iface, -1 ); + + if (!iface_found && (g_strcmp0(*iface, local_address) == 0)) { + DEBUG("Setting active local address combo box"); + current_local_address_iter = iter; + iface_found = TRUE; + } + } + + if(!iface_found) { + DEBUG("Did not find local ip address, take fisrt in the list"); + gtk_tree_model_get_iter_first(GTK_TREE_MODEL(ipInterfaceListStore), ¤t_local_address_iter); + } } - } - if(!iface_found) { - DEBUG("Did not find local ip address, take fisrt in the list"); - gtk_tree_model_get_iter_first(GTK_TREE_MODEL(ipInterfaceListStore), ¤t_local_address_iter); - } - } - - - localAddressCombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ipInterfaceListStore)); - gtk_label_set_mnemonic_widget(GTK_LABEL(localAddressLabel), localAddressCombo); - gtk_table_attach ( GTK_TABLE( table ), localAddressCombo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - g_object_unref(G_OBJECT(ipInterfaceListStore)); - GtkCellRenderer * ipInterfaceCellRenderer; - ipInterfaceCellRenderer = gtk_cell_renderer_text_new(); - gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(localAddressCombo), ipInterfaceCellRenderer, TRUE); - gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(localAddressCombo), ipInterfaceCellRenderer, "text", 0, NULL); - gtk_combo_box_set_active_iter(GTK_COMBO_BOX(localAddressCombo), ¤t_local_address_iter); - g_signal_connect (G_OBJECT(GTK_COMBO_BOX(localAddressCombo)), "changed", G_CALLBACK (ip2ip_local_address_changed_cb), localAddressCombo); + localAddressCombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ipInterfaceListStore)); + gtk_label_set_mnemonic_widget(GTK_LABEL(localAddressLabel), localAddressCombo); + gtk_table_attach ( GTK_TABLE( table ), localAddressCombo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + g_object_unref(G_OBJECT(ipInterfaceListStore)); - g_hash_table_replace(directIpCallsProperties, g_strdup(LOCAL_ADDRESS), g_strdup((gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(localAddressCombo)))); - + GtkCellRenderer * ipInterfaceCellRenderer; + ipInterfaceCellRenderer = gtk_cell_renderer_text_new(); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(localAddressCombo), ipInterfaceCellRenderer, TRUE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(localAddressCombo), ipInterfaceCellRenderer, "text", 0, NULL); + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(localAddressCombo), ¤t_local_address_iter); + g_signal_connect (G_OBJECT(GTK_COMBO_BOX(localAddressCombo)), "changed", G_CALLBACK (ip2ip_local_address_changed_cb), localAddressCombo); - /** - * Local port - */ - /** SIP port information */ - localPortLabel = gtk_label_new_with_mnemonic (_("Local port")); - gtk_table_attach_defaults(GTK_TABLE(table), localPortLabel, 0, 1, 1, 2); + g_hash_table_replace(directIpCallsProperties, g_strdup(LOCAL_ADDRESS), g_strdup((gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(localAddressCombo)))); - gtk_misc_set_alignment(GTK_MISC (localPortLabel), 0, 0.5); - localPortSpinBox = gtk_spin_button_new_with_range(1, 65535, 1); - gtk_label_set_mnemonic_widget (GTK_LABEL (localPortLabel), localPortSpinBox); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(localPortSpinBox), g_ascii_strtod(local_port, NULL)); - gtk_table_attach_defaults(GTK_TABLE(table), localPortSpinBox, 1, 2, 1, 2); - g_signal_connect (G_OBJECT(localPortSpinBox), "changed", G_CALLBACK (ip2ip_local_port_changed_cb), localPortSpinBox); + /** + * Local port + */ + /** SIP port information */ + localPortLabel = gtk_label_new_with_mnemonic (_("Local port")); + gtk_table_attach_defaults(GTK_TABLE(table), localPortLabel, 0, 1, 1, 2); + gtk_misc_set_alignment(GTK_MISC (localPortLabel), 0, 0.5); + localPortSpinBox = gtk_spin_button_new_with_range(1, 65535, 1); + gtk_label_set_mnemonic_widget (GTK_LABEL (localPortLabel), localPortSpinBox); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(localPortSpinBox), g_ascii_strtod(local_port, NULL)); - GtkWidget *applyModificationButton = gtk_button_new_from_stock(GTK_STOCK_APPLY); - g_signal_connect( G_OBJECT(applyModificationButton) , "clicked" , G_CALLBACK( update_ip_address_port_cb ), localPortSpinBox); - gtk_table_attach( GTK_TABLE(table), applyModificationButton, 2, 3, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); + gtk_table_attach_defaults(GTK_TABLE(table), localPortSpinBox, 1, 2, 1, 2); + g_signal_connect (G_OBJECT(localPortSpinBox), "changed", G_CALLBACK (ip2ip_local_port_changed_cb), localPortSpinBox); - /** - * Security Section - */ - gnome_main_section_new_with_table (_("Security"), &frame, &table, 2, 3); + GtkWidget *applyModificationButton = gtk_button_new_from_stock(GTK_STOCK_APPLY); + g_signal_connect( G_OBJECT(applyModificationButton) , "clicked" , G_CALLBACK( update_ip_address_port_cb ), localPortSpinBox); + gtk_table_attach( GTK_TABLE(table), applyModificationButton, 2, 3, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); + + + /** + * Security Section + */ + gnome_main_section_new_with_table (_("Security"), &frame, &table, 2, 3); gtk_container_set_border_width (GTK_CONTAINER(table), 10); gtk_table_set_row_spacings (GTK_TABLE(table), 10); - gtk_table_set_col_spacings( GTK_TABLE(table), 10); - gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); + gtk_table_set_col_spacings( GTK_TABLE(table), 10); + gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); GtkWidget * sipTlsAdvancedButton; sipTlsAdvancedButton = gtk_button_new_from_stock(GTK_STOCK_EDIT); - gtk_table_attach_defaults(GTK_TABLE(table), sipTlsAdvancedButton, 2, 3, 0, 1); + gtk_table_attach_defaults(GTK_TABLE(table), sipTlsAdvancedButton, 2, 3, 0, 1); gtk_widget_set_sensitive(GTK_WIDGET(sipTlsAdvancedButton), FALSE); - g_signal_connect(G_OBJECT(sipTlsAdvancedButton), "clicked", G_CALLBACK(show_advanced_tls_options_cb), directIpCallsProperties); - + g_signal_connect(G_OBJECT(sipTlsAdvancedButton), "clicked", G_CALLBACK(show_advanced_tls_options_cb), directIpCallsProperties); + useSipTlsCheckBox = gtk_check_button_new_with_mnemonic(_("Use TLS transport (sips)")); g_signal_connect (useSipTlsCheckBox, "toggled", G_CALLBACK(use_sip_tls_cb), sipTlsAdvancedButton); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(useSipTlsCheckBox), (g_strcmp0(curTlsEnabled, "false") == 0) ? FALSE:TRUE); gtk_table_attach_defaults(GTK_TABLE(table), useSipTlsCheckBox, 0, 2, 0, 1); - - label = gtk_label_new_with_mnemonic (_("SRTP key exchange")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); - 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), _("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_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), FALSE); - } - - g_signal_connect (G_OBJECT (GTK_COMBO_BOX(keyExchangeCombo)), "changed", G_CALLBACK (key_exchange_changed_cb), advancedZrtpButton); - - gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); - gtk_table_attach_defaults(GTK_TABLE(table), keyExchangeCombo, 1, 2, 1, 2); - gtk_table_attach_defaults(GTK_TABLE(table), advancedZrtpButton, 2, 3, 1, 2); - - gtk_widget_show_all(table); - - GtkRequisition requisition; - gtk_widget_size_request(GTK_WIDGET(table), &requisition); - gtk_widget_set_size_request(GTK_WIDGET(explanationLabel), requisition.width * 1.5, -1); - gtk_label_set_line_wrap(GTK_LABEL(explanationLabel), TRUE); - - gtk_widget_show_all(vbox); - - return vbox; + + label = gtk_label_new_with_mnemonic (_("SRTP key exchange")); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + 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), _("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_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), FALSE); + } + + g_signal_connect (G_OBJECT (GTK_COMBO_BOX(keyExchangeCombo)), "changed", G_CALLBACK (key_exchange_changed_cb), advancedZrtpButton); + + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); + gtk_table_attach_defaults(GTK_TABLE(table), keyExchangeCombo, 1, 2, 1, 2); + gtk_table_attach_defaults(GTK_TABLE(table), advancedZrtpButton, 2, 3, 1, 2); + + gtk_widget_show_all(table); + + GtkRequisition requisition; + gtk_widget_size_request(GTK_WIDGET(table), &requisition); + gtk_widget_set_size_request(GTK_WIDGET(explanationLabel), requisition.width * 1.5, -1); + gtk_label_set_line_wrap(GTK_LABEL(explanationLabel), TRUE); + + gtk_widget_show_all(vbox); + + return vbox; } /* -GtkWidget* create_network_tab() -{ - GtkWidget * frame; - GtkWidget * table; - GtkWidget * label; - GtkWidget * ret; - gchar * description; - - ret = gtk_vbox_new(FALSE, 10); - gtk_container_set_border_width(GTK_CONTAINER(ret), 10); - - // SIP port information - int curPort = dbus_get_sip_port(); - if(curPort <= 0 || curPort > 65535) { - curPort = 5060; - } - - int account_number = account_list_get_sip_account_number(); - DEBUG("sip account number = %i", account_number); - - gnome_main_section_new_with_table (_("SIP Port"), &frame, &table, 1, 3); - gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); - gtk_widget_set_sensitive(GTK_WIDGET(frame),(account_number == 0) ? FALSE:TRUE); - - GtkWidget *applySipPortButton = gtk_button_new_from_stock(GTK_STOCK_APPLY); - GtkWidget *entryPort; - - label = gtk_label_new(_("UDP Transport")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); - entryPort = gtk_spin_button_new_with_range(1, 65535, 1); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryPort); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(entryPort), curPort); - g_signal_connect( G_OBJECT( applySipPortButton) , "clicked" , G_CALLBACK( update_port_cb ) , entryPort); - - gtk_table_attach( GTK_TABLE(table), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); - gtk_table_attach( GTK_TABLE(table), entryPort, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); - gtk_table_attach( GTK_TABLE(table), applySipPortButton, 2, 3, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); - - gtk_widget_show_all(ret); - - return ret; + GtkWidget* create_network_tab() + { + GtkWidget * frame; + GtkWidget * table; + GtkWidget * label; + GtkWidget * ret; + gchar * description; + + ret = gtk_vbox_new(FALSE, 10); + gtk_container_set_border_width(GTK_CONTAINER(ret), 10); + +// SIP port information +int curPort = dbus_get_sip_port(); +if(curPort <= 0 || curPort > 65535) { +curPort = 5060; } -*/ - GtkWidget* +int account_number = account_list_get_sip_account_number(); +DEBUG("sip account number = %i", account_number); + +gnome_main_section_new_with_table (_("SIP Port"), &frame, &table, 1, 3); +gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); +gtk_widget_set_sensitive(GTK_WIDGET(frame),(account_number == 0) ? FALSE:TRUE); + +GtkWidget *applySipPortButton = gtk_button_new_from_stock(GTK_STOCK_APPLY); +GtkWidget *entryPort; + +label = gtk_label_new(_("UDP Transport")); +gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); +entryPort = gtk_spin_button_new_with_range(1, 65535, 1); +gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryPort); +gtk_spin_button_set_value(GTK_SPIN_BUTTON(entryPort), curPort); +g_signal_connect( G_OBJECT( applySipPortButton) , "clicked" , G_CALLBACK( update_port_cb ) , entryPort); + +gtk_table_attach( GTK_TABLE(table), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); +gtk_table_attach( GTK_TABLE(table), entryPort, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); +gtk_table_attach( GTK_TABLE(table), applySipPortButton, 2, 3, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); + +gtk_widget_show_all(ret); + +return ret; +} + */ + + GtkWidget* create_general_settings () { - GtkWidget *ret; + GtkWidget *ret; - GtkWidget *notifAll; + GtkWidget *notifAll; - GtkWidget *trayItem; - GtkWidget *frame; - GtkWidget *checkBoxWidget; - GtkWidget *label; - GtkWidget *table; + GtkWidget *trayItem; + GtkWidget *frame; + GtkWidget *checkBoxWidget; + GtkWidget *label; + GtkWidget *table; - // Load history configuration - history_load_configuration (); + // Load history configuration + history_load_configuration (); - // Main widget - ret = gtk_vbox_new(FALSE, 10); - gtk_container_set_border_width(GTK_CONTAINER(ret), 10); + // Main widget + ret = gtk_vbox_new(FALSE, 10); + gtk_container_set_border_width(GTK_CONTAINER(ret), 10); - // Notifications Frame - gnome_main_section_new_with_table (_("Desktop Notifications"), &frame, &table, 2, 1); - gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); + // Notifications Frame + gnome_main_section_new_with_table (_("Desktop Notifications"), &frame, &table, 2, 1); + gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); - // Notification All - notifAll = gtk_check_button_new_with_mnemonic( _("_Enable notifications")); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(notifAll), dbus_get_notify() ); - g_signal_connect(G_OBJECT( notifAll ) , "clicked" , G_CALLBACK( set_notif_level ) , NULL ); - gtk_table_attach( GTK_TABLE(table), notifAll, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); + // Notification All + notifAll = gtk_check_button_new_with_mnemonic( _("_Enable notifications")); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(notifAll), dbus_get_notify() ); + g_signal_connect(G_OBJECT( notifAll ) , "clicked" , G_CALLBACK( set_notif_level ) , NULL ); + gtk_table_attach( GTK_TABLE(table), notifAll, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); - // System Tray option frame - gnome_main_section_new_with_table (_("System Tray Icon"), &frame, &table, 3, 1); - gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); + // System Tray option frame + gnome_main_section_new_with_table (_("System Tray Icon"), &frame, &table, 3, 1); + gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); - GtkWidget* trayItem1 = gtk_radio_button_new_with_mnemonic(NULL, _("_Popup main window on incoming call")); - g_signal_connect(G_OBJECT (trayItem1), "toggled", G_CALLBACK (set_popup_mode), NULL); - gtk_table_attach( GTK_TABLE(table), trayItem1, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); + GtkWidget* trayItem1 = gtk_radio_button_new_with_mnemonic(NULL, _("_Popup main window on incoming call")); + g_signal_connect(G_OBJECT (trayItem1), "toggled", G_CALLBACK (set_popup_mode), NULL); + gtk_table_attach( GTK_TABLE(table), trayItem1, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); - trayItem = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON(trayItem1), _("Ne_ver popup main window")); - gtk_table_attach( GTK_TABLE(table), trayItem, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); + trayItem = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON(trayItem1), _("Ne_ver popup main window")); + gtk_table_attach( GTK_TABLE(table), trayItem, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); // Toggle according to the user configuration dbus_popup_mode () ? gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (trayItem1), TRUE) : gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (trayItem), TRUE); - trayItem = gtk_check_button_new_with_mnemonic(_("Hide SFLphone window on _startup")); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(trayItem), dbus_is_start_hidden() ); - g_signal_connect(G_OBJECT( trayItem ) , "clicked" , G_CALLBACK( start_hidden ) , NULL); - gtk_table_attach( GTK_TABLE(table), trayItem, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); - - // HISTORY CONFIGURATION - gnome_main_section_new_with_table (_("Calls History"), &frame, &table, 3, 1); - gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); - - checkBoxWidget = gtk_check_button_new_with_mnemonic(_("_Keep my history for at least")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkBoxWidget), history_enabled); - g_signal_connect (G_OBJECT (checkBoxWidget) , "clicked" , G_CALLBACK (history_enabled_cb) , NULL); - gtk_table_attach( GTK_TABLE(table), checkBoxWidget, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); - - history_value = gtk_spin_button_new_with_range(1, 99, 1); - gtk_spin_button_set_value (GTK_SPIN_BUTTON(history_value), history_limit); - g_signal_connect( G_OBJECT (history_value) , "value-changed" , G_CALLBACK (history_limit_cb) , history_value); - gtk_widget_set_sensitive (GTK_WIDGET (history_value), gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkBoxWidget))); - gtk_table_attach( GTK_TABLE(table), history_value, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); - - label = gtk_label_new(_("days")); - gtk_table_attach( GTK_TABLE(table), label, 2, 3, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); - - // Configuration File + trayItem = gtk_check_button_new_with_mnemonic(_("Hide SFLphone window on _startup")); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(trayItem), dbus_is_start_hidden() ); + g_signal_connect(G_OBJECT( trayItem ) , "clicked" , G_CALLBACK( start_hidden ) , NULL); + gtk_table_attach( GTK_TABLE(table), trayItem, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); + + // HISTORY CONFIGURATION + gnome_main_section_new_with_table (_("Calls History"), &frame, &table, 3, 1); + gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); + + checkBoxWidget = gtk_check_button_new_with_mnemonic(_("_Keep my history for at least")); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkBoxWidget), history_enabled); + g_signal_connect (G_OBJECT (checkBoxWidget) , "clicked" , G_CALLBACK (history_enabled_cb) , NULL); + gtk_table_attach( GTK_TABLE(table), checkBoxWidget, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); + + history_value = gtk_spin_button_new_with_range(1, 99, 1); + gtk_spin_button_set_value (GTK_SPIN_BUTTON(history_value), history_limit); + g_signal_connect( G_OBJECT (history_value) , "value-changed" , G_CALLBACK (history_limit_cb) , history_value); + gtk_widget_set_sensitive (GTK_WIDGET (history_value), gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkBoxWidget))); + gtk_table_attach( GTK_TABLE(table), history_value, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); + + label = gtk_label_new(_("days")); + gtk_table_attach( GTK_TABLE(table), label, 2, 3, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); + + // Configuration File // Commented out because not functional yet /* - gnome_main_section_new_with_table (_("Configuration File"), &frame, &table, 1, 1); - gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); - checkBoxWidget = gtk_check_button_new_with_mnemonic(_("Store SIP credentials as MD5 hash")); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(checkBoxWidget), dbus_is_md5_credential_hashing() ); - g_signal_connect(G_OBJECT( checkBoxWidget ) , "clicked" , G_CALLBACK(set_md5_hash_cb) , NULL); - gtk_table_attach( GTK_TABLE(table), checkBoxWidget, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); - */ - - gtk_widget_show_all(ret); - - return ret; + gnome_main_section_new_with_table (_("Configuration File"), &frame, &table, 1, 1); + gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); + checkBoxWidget = gtk_check_button_new_with_mnemonic(_("Store SIP credentials as MD5 hash")); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(checkBoxWidget), dbus_is_md5_credential_hashing() ); + g_signal_connect(G_OBJECT( checkBoxWidget ) , "clicked" , G_CALLBACK(set_md5_hash_cb) , NULL); + gtk_table_attach( GTK_TABLE(table), checkBoxWidget, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); + */ + + gtk_widget_show_all(ret); + + return ret; } void save_configuration_parameters (void) { - // Address book config - addressbook_config_save_parameters (); - hooks_save_parameters (); + // Address book config + addressbook_config_save_parameters (); + hooks_save_parameters (); + + // History config + dbus_set_history_limit (history_limit); - // History config - dbus_set_history_limit (history_limit); - - // Direct IP calls config - dbus_set_ip2ip_details(directIpCallsProperties); + // Direct IP calls config + dbus_set_ip2ip_details(directIpCallsProperties); } void history_load_configuration () { - history_limit = dbus_get_history_limit (); - history_enabled = TRUE; - if (g_strcasecmp (dbus_get_history_enabled (), "false") == 0) - history_enabled = FALSE; + history_limit = dbus_get_history_limit (); + history_enabled = TRUE; + if (g_strcasecmp (dbus_get_history_enabled (), "false") == 0) + history_enabled = FALSE; } /** * Show configuration window with tabs */ - void + void show_preferences_dialog () { - GtkDialog * dialog; - GtkWidget * notebook; - GtkWidget * tab; - guint result; - - dialogOpen = TRUE; - - dialog = GTK_DIALOG(gtk_dialog_new_with_buttons (_("Preferences"), - GTK_WINDOW(get_main_window()), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CLOSE, - GTK_RESPONSE_ACCEPT, - NULL)); - - // Set window properties - gtk_dialog_set_has_separator(dialog, FALSE); - gtk_window_set_default_size(GTK_WINDOW(dialog), 600, 400); - gtk_container_set_border_width(GTK_CONTAINER(dialog), 0); - - // Create tabs container - notebook = gtk_notebook_new(); - gtk_box_pack_start(GTK_BOX (dialog->vbox), notebook, TRUE, TRUE, 0); - gtk_container_set_border_width(GTK_CONTAINER(notebook), 10); - gtk_widget_show(notebook); - - // General settings tab - tab = create_general_settings(); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("General"))); - gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); - - // Audio tab - tab = create_audio_configuration(); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Audio"))); - gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); - - // Addressbook tab - tab = create_addressbook_settings(); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Address Book"))); - gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); - - // HookS tab - tab = create_hooks_settings(); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Hooks"))); - gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); - /* - // Network tab - tab = create_network_tab(); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Network"))); - gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); - */ - // Direct IP calls tab - tab = create_direct_ip_calls_tab(); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Direct IP calls"))); - gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); - - gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook) , 0); - - result = gtk_dialog_run(dialog); - - save_configuration_parameters (); - update_actions(); - - dialogOpen = FALSE; - - gtk_widget_destroy(GTK_WIDGET(dialog)); + GtkDialog * dialog; + GtkWidget * notebook; + GtkWidget * tab; + guint result; + + dialogOpen = TRUE; + + dialog = GTK_DIALOG(gtk_dialog_new_with_buttons (_("Preferences"), + GTK_WINDOW(get_main_window()), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, + GTK_RESPONSE_ACCEPT, + NULL)); + + // Set window properties + gtk_dialog_set_has_separator(dialog, FALSE); + gtk_window_set_default_size(GTK_WINDOW(dialog), 600, 400); + gtk_container_set_border_width(GTK_CONTAINER(dialog), 0); + + // Create tabs container + notebook = gtk_notebook_new(); + gtk_box_pack_start(GTK_BOX (dialog->vbox), notebook, TRUE, TRUE, 0); + gtk_container_set_border_width(GTK_CONTAINER(notebook), 10); + gtk_widget_show(notebook); + + // General settings tab + tab = create_general_settings(); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("General"))); + gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); + + // Audio tab + tab = create_audio_configuration(); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Audio"))); + gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); + + // Addressbook tab + tab = create_addressbook_settings(); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Address Book"))); + gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); + + // HookS tab + tab = create_hooks_settings(); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Hooks"))); + gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); + /* + // Network tab + tab = create_network_tab(); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Network"))); + gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); + */ + // Direct IP calls tab + tab = create_direct_ip_calls_tab(); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Direct IP calls"))); + gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); + + gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook) , 0); + + result = gtk_dialog_run(dialog); + + save_configuration_parameters (); + update_actions(); + + dialogOpen = FALSE; + + gtk_widget_destroy(GTK_WIDGET(dialog)); } diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index c01a3e890731593e65ef8afa698220240ec42a4d..5505e21d971bb54ad1d76b7ef4756b991893947b 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -583,33 +583,68 @@ calltree_update_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) if(c->_state == CALL_STATE_TRANSFERT) { + if(g_strcmp0("",c->_peer_name) == 0){ description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>Transfert to:%s</i> ", c->_peer_number, c->_peer_name, c->_trsft_to); + } + else { + description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>Transfert to:%s</i> ", + c->_peer_name, + c->_peer_number, + c->_trsft_to); + } } else { // c->_zrtp_confirmed == FALSE : Hack explained in callable_obj.h if((c->_sas != NULL) && (display_sas == TRUE) && (c->_srtp_state == SRTP_STATE_SAS_UNCONFIRMED) && (c->_zrtp_confirmed == FALSE)) { + + if(g_strcmp0("",c->_peer_name) == 0){ description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>Confirm SAS <b>%s</b> ?</i> ", c->_peer_number, c->_peer_name, c->_sas); + } + else { + + description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>Confirm SAS <b>%s</b> ?</i> ", + c->_peer_name, + c->_peer_number, + c->_sas); + } } else { DEBUG("Updating state code %d %s", c->_state_code, c->_state_code_description); - if (c->_state_code) { - description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>%s (%d)</i> <i>%s</i>", + if(g_strcmp0("",c->_peer_name) == 0){ + if (c->_state_code) { + description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>%s (%d)</i> <i>%s</i>", c->_peer_number, c->_peer_name, c->_state_code_description, c->_state_code, audio_codec); - } else { - description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>%s</i>", + } else { + description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>%s</i>", c->_peer_number, c->_peer_name, audio_codec); + } + } + else { + if (c->_state_code) { + description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>%s (%d)</i> <i>%s</i>", + c->_peer_name, + c->_peer_number, + c->_state_code_description, + c->_state_code, + audio_codec); + } else { + description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>%s</i>", + c->_peer_name, + c->_peer_number, + audio_codec); + } } } } @@ -721,18 +756,33 @@ void calltree_add_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) if(c->_state_code == 0) { + if(g_strcmp0("", c->_peer_name) == 0) { description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>", - c->_peer_number, - c->_peer_name); + c->_peer_name, + c->_peer_number); + } + else { + description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>", + c->_peer_name, + c->_peer_number); + } } else { - + if(g_strcmp0("", c->_peer_name) == 0) { description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>%s (%d)</i>", c->_peer_number, c->_peer_name, c->_state_code_description, c->_state_code); + } + else { + description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>%s (%d)</i>", + c->_peer_name, + c->_peer_number, + c->_state_code_description, + c->_state_code); + } } gtk_tree_store_prepend (tab->store, &iter, parent); @@ -839,9 +889,19 @@ void calltree_add_history_entry (callable_obj_t * c) // New call in the list gchar * description, *date="", *duration=""; - description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>", + + if(g_strcmp0("", c->_peer_name) == 0) { + + description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>", c->_peer_number, c->_peer_name); + } + else { + + description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>", + c->_peer_name, + c->_peer_number); + } gtk_tree_store_prepend (history->store, &iter, NULL); diff --git a/sflphone-common/src/Makefile.am b/sflphone-common/src/Makefile.am index 6df7edf547de482c996c7039f25fe1a98915f193..0d2b2da9cc12f78d4bf4898061de9359e26a5da6 100644 --- a/sflphone-common/src/Makefile.am +++ b/sflphone-common/src/Makefile.am @@ -94,3 +94,10 @@ libsflphone_la_LIBADD = \ ./history/libhistory.la libsflphone_la_SOURCES = + +indent: + @echo "Indenting code:" + if [ -f $(ASTYLERC) ] ; then \ + $(indent) --options=$(ASTYLERC) --recursive *.cpp *.h; \ + fi + diff --git a/sflphone-common/src/audio/audiolayer.h b/sflphone-common/src/audio/audiolayer.h index 35b7abd073cbdaaa14cb90498e3f7b2d90126350..ab70ddfd0701caadbb55cd6d15343403199cf0bf 100644 --- a/sflphone-common/src/audio/audiolayer.h +++ b/sflphone-common/src/audio/audiolayer.h @@ -206,12 +206,12 @@ class AudioLayer { /** * Set the audio recorder */ - void setRecorderInstance(Recordable* rec) {_recorder = NULL; _recorder = rec;} + inline void setRecorderInstance (Recordable* rec) {_recorder = NULL; _recorder = rec;} /** * Get the audio recorder */ - Recordable* getRecorderInstance(Recordable* rec) {return _recorder;} + inline Recordable* getRecorderInstance (void) {return _recorder;} protected: diff --git a/sflphone-common/src/audio/codecs/g722.cpp b/sflphone-common/src/audio/codecs/g722.cpp index 5280fa1f337869b0a9e4ab49b74fe660d4bcd236..8118b5757e7b330b9271252bcfac53abebab0e6a 100644 --- a/sflphone-common/src/audio/codecs/g722.cpp +++ b/sflphone-common/src/audio/codecs/g722.cpp @@ -49,8 +49,8 @@ class G722 : public AudioCodec decode_s = new g722_decode_state_t; encode_s = new g722_encode_state_t; - g722_decode_init (64000, 0); - g722_encode_init (64000, 0); + g722_decode_init (); + g722_encode_init (); } @@ -76,7 +76,7 @@ class G722 : public AudioCodec } - void g722_encode_init (int rate, int options) { + void g722_encode_init (void) { encode_s->itu_test_mode = FALSE; @@ -92,7 +92,7 @@ class G722 : public AudioCodec encode_s->band[1].det = 8; } - void g722_decode_init (int rate, int options) { + void g722_decode_init (void) { decode_s->itu_test_mode = FALSE; diff --git a/sflphone-common/src/audio/codecs/g722.h b/sflphone-common/src/audio/codecs/g722.h index 565bcf2e3c9e2a159d6e7d0900981480360171ef..4df3334c65b2a8a2d522758faaade819f1933056 100644 --- a/sflphone-common/src/audio/codecs/g722.h +++ b/sflphone-common/src/audio/codecs/g722.h @@ -130,11 +130,11 @@ typedef struct extern "C" { #endif -void g722_encode_init(int rate, int options); +void g722_encode_init (void); int g722_encode_release(); int g722_encode(uint8_t g722_data[], const int16_t amp[], int len); -void g722_decode_init(int rate, int options); +void g722_decode_init (void); int g722_decode_release(); int g722_decode(int16_t amp[], const uint8_t g722_data[], int len); diff --git a/sflphone-common/src/audio/pulseaudio/audiostream.cpp b/sflphone-common/src/audio/pulseaudio/audiostream.cpp index 8bd79c5d83fbd7254d5861fdba1c4ac184f4e090..d98251075a8bcfc241979556d433f4fb664c61d8 100644 --- a/sflphone-common/src/audio/pulseaudio/audiostream.cpp +++ b/sflphone-common/src/audio/pulseaudio/audiostream.cpp @@ -106,11 +106,11 @@ AudioStream::disconnectStream (void) if (_audiostream) { pa_stream_disconnect (_audiostream); - // make sure we don't get any further callback - pa_stream_set_state_callback(_audiostream, NULL, NULL); - pa_stream_set_write_callback (_audiostream, NULL, NULL); - pa_stream_set_underflow_callback (_audiostream, NULL, NULL); - pa_stream_set_overflow_callback (_audiostream, NULL, NULL); + // make sure we don't get any further callback + pa_stream_set_state_callback (_audiostream, NULL, NULL); + pa_stream_set_write_callback (_audiostream, NULL, NULL); + pa_stream_set_underflow_callback (_audiostream, NULL, NULL); + pa_stream_set_overflow_callback (_audiostream, NULL, NULL); pa_stream_unref (_audiostream); _audiostream = NULL; diff --git a/sflphone-common/src/dbus/callmanager.cpp b/sflphone-common/src/dbus/callmanager.cpp index 805731809da9df61d07278d481252adbc0085c20..3c3306fda8106fe19caf2479ce509c0346e3591c 100644 --- a/sflphone-common/src/dbus/callmanager.cpp +++ b/sflphone-common/src/dbus/callmanager.cpp @@ -258,7 +258,7 @@ CallManager::startTone (const int32_t& start , const int32_t& type) else Manager::instance().playToneWithMessage(); } else - Manager::instance().stopTone (true); + Manager::instance().stopTone (); } // TODO: this will have to be adapted diff --git a/sflphone-common/src/dbus/configurationmanager.cpp b/sflphone-common/src/dbus/configurationmanager.cpp index d971993194406f44ea716573ebe672a2a3ede843..e381e6d13d91cd1a7c3bb8854a967e9dc74e286e 100644 --- a/sflphone-common/src/dbus/configurationmanager.cpp +++ b/sflphone-common/src/dbus/configurationmanager.cpp @@ -95,11 +95,13 @@ ConfigurationManager::setIp2IpDetails (const std::map< std::string, std::string std::map<std::string, std::string>::iterator it; it = map_cpy.find (LOCAL_ADDRESS); + if (it != details.end()) { Manager::instance().setConfig (IP2IP_PROFILE, LOCAL_ADDRESS, it->second); } - it = map_cpy.find(LOCAL_PORT); + it = map_cpy.find (LOCAL_PORT); + if (it != details.end()) { Manager::instance().setConfig (IP2IP_PROFILE, LOCAL_PORT, it->second); } @@ -724,7 +726,7 @@ void ConfigurationManager::setSipAddress (const std::string& address) { _debug ("Manager received setSipAddress: %s", address.c_str()); - Manager::instance().setLocalIp2IpInfo(address); + Manager::instance().setLocalIp2IpInfo (address); } std::map<std::string, int32_t> ConfigurationManager::getAddressbookSettings (void) diff --git a/sflphone-common/src/iax/iaxvoiplink.cpp b/sflphone-common/src/iax/iaxvoiplink.cpp index bc41b6e1668f854532cd76e3bc3a46a47d87b5a8..7054e00d1aa4bb8e564320f10ff65b26b21e9bfb 100644 --- a/sflphone-common/src/iax/iaxvoiplink.cpp +++ b/sflphone-common/src/iax/iaxvoiplink.cpp @@ -304,7 +304,7 @@ IAXVoIPLink::sendAudioFromMic (void) if (currentCall) { - bool sessionIsConnected = (currentCall->getConnectionState() == Call::Connected); + // bool sessionIsConnected = (currentCall->getConnectionState() == Call::Connected); bool callIsActive = (currentCall->getState() == Call::Active); // if (sessionIsConnected || callIsActive) { @@ -831,6 +831,7 @@ IAXVoIPLink::iaxHandleCallEvent (iax_event* event, IAXCall* call) Manager::instance().peerAnsweredCall (id); // start audio here? + audiolayer->startStream(); audiolayer->flushMain(); } else { // deja connecté ? diff --git a/sflphone-common/src/logger.cpp b/sflphone-common/src/logger.cpp index cb2d2555b6de2c315c44b8a873057dc3bc9084b8..8c71ddf645f7b808a841075b1a50cf5560bec06d 100644 --- a/sflphone-common/src/logger.cpp +++ b/sflphone-common/src/logger.cpp @@ -1,6 +1,9 @@ #include "logger.h" -#include <syslog.h> #include <stdarg.h> +#include <string> +#include <stdio.h> + +using namespace std; namespace Logger { diff --git a/sflphone-common/src/logger.h b/sflphone-common/src/logger.h index b967ef27bb2d52edd859d3a5acd350587d84ef8b..f968d10f90480f65abf1a1c181f5ef0f54a655e2 100644 --- a/sflphone-common/src/logger.h +++ b/sflphone-common/src/logger.h @@ -1,11 +1,8 @@ #ifndef __LOGGER_H__ #define __LOGGER_H__ -#include <string> #include <syslog.h> -using namespace std; - namespace Logger { void log(const int, const char*, ...); diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index f3ab27a4afc1251c94154ceb168536b7c84dcd45..6b1d15aa1e61d9b901d0a557c39d1c70d63599e8 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -335,7 +335,7 @@ ManagerImpl::answerCall (const CallID& call_id) _debug ("ManagerImpl::answerCall(%s)", call_id.c_str()); - stopTone (true); + stopTone (); // store the current call id CallID current_call_id = getCurrentCallId(); @@ -418,8 +418,7 @@ ManagerImpl::hangupCall (const CallID& call_id) // store the current call id CallID current_call_id = getCurrentCallId(); - stopTone (false); - // switchCall (call_id); + stopTone (); /* Broadcast a signal over DBus */ _debug (" hangupCall: Send DBUS call state change (HUNGUP) for id %s", call_id.c_str()); @@ -447,6 +446,7 @@ ManagerImpl::hangupCall (const CallID& call_id) processRemainingParticipant (current_call_id, conf); } + } else { // we are not participating to a conference, current call switched to "" if (!isConference (current_call_id)) @@ -523,7 +523,7 @@ ManagerImpl::cancelCall (const CallID& id) AccountID accountid; bool returnValue; - stopTone (true); + stopTone (); /* Direct IP to IP call */ @@ -562,7 +562,7 @@ ManagerImpl::onHoldCall (const CallID& call_id) _debug ("ManagerImpl::onHoldCall(%s)", call_id.c_str()); - stopTone (true); + stopTone (); CallID current_call_id = getCurrentCallId(); @@ -613,7 +613,7 @@ ManagerImpl::offHoldCall (const CallID& call_id) _debug ("ManagerImpl::offHoldCall(%s)", call_id.c_str()); - stopTone (false); + stopTone (); CallID current_call_id = getCurrentCallId(); @@ -695,7 +695,7 @@ ManagerImpl::transferCall (const CallID& call_id, const std::string& to) AccountID accountid; bool returnValue; - stopTone (true); + stopTone (); CallID current_call_id = getCurrentCallId(); @@ -763,7 +763,7 @@ ManagerImpl::refuseCall (const CallID& id) CallID current_call_id = getCurrentCallId(); - stopTone (false); + stopTone (); int nbCalls = getCallList().size(); @@ -1256,8 +1256,6 @@ ManagerImpl::detachParticipant (const CallID& call_id, const CallID& current_id) CallID current_call_id = current_id; - if (current_call_id.compare ("") == 0); - current_call_id = getCurrentCallId(); if (call_id != default_id) { @@ -1527,7 +1525,7 @@ ManagerImpl::sendDtmf (const CallID& id, char code) AccountID accountid = getAccountFromCall (id); if (accountid == AccountNULL) { - playDtmf (code, false); + playDtmf (code); return false; } @@ -1538,7 +1536,7 @@ ManagerImpl::sendDtmf (const CallID& id, char code) switch (sendType) { case 0: // SIP INFO - playDtmf (code , true); + playDtmf (code); returnValue = getAccountLink (accountid)->carryingDTMFdigits (id, code); break; @@ -1557,7 +1555,7 @@ ManagerImpl::sendDtmf (const CallID& id, char code) //THREAD=Main | VoIPLink bool -ManagerImpl::playDtmf (char code, bool isTalking) +ManagerImpl::playDtmf (char code) { int pulselen, layer, size; bool ret = false; @@ -1566,7 +1564,7 @@ ManagerImpl::playDtmf (char code, bool isTalking) _debug ("ManagerImpl::playDtmf"); - stopTone (false); + stopTone (); bool hasToPlayTone = getConfigBool (SIGNALISATION, PLAY_DTMF); @@ -1682,7 +1680,7 @@ ManagerImpl::incomingCall (Call* call, const AccountID& accountId) PulseLayer *pulselayer; std::string from, number, display_name, display; - stopTone (false); + stopTone (); _debug ("Incoming call %s for account %s", call->getCallId().data(), accountId.c_str()); @@ -1790,7 +1788,7 @@ ManagerImpl::peerAnsweredCall (const CallID& id) { // The if statement is usefull only if we sent two calls at the same time. if (isCurrentCall (id)) { - stopTone (false); + stopTone (); } if (_dbus) _dbus->getCallManager()->callStateChanged (id, "CURRENT"); @@ -1843,7 +1841,7 @@ ManagerImpl::peerHungupCall (const CallID& call_id) } } else { if (isCurrentCall (call_id)) { - stopTone (true); + stopTone (); switchCall (""); } @@ -1909,20 +1907,35 @@ ManagerImpl::callBusy (const CallID& id) //THREAD=VoIP void -ManagerImpl::callFailure (const CallID& id) +ManagerImpl::callFailure (const CallID& call_id) { - if (_dbus) _dbus->getCallManager()->callStateChanged (id, "FAILURE"); + if (_dbus) _dbus->getCallManager()->callStateChanged (call_id, "FAILURE"); - _debug ("CALL ID = %s" , id.c_str()); - - if (isCurrentCall (id)) { + if (isCurrentCall (call_id)) { playATone (Tone::TONE_BUSY); switchCall (""); } - removeCallAccount (id); + CallID current_call_id = getCurrentCallId(); - removeWaitingCall (id); + if (participToConference (call_id)) { + + _debug ("Call %s participating to a conference failed\n", call_id.c_str()); + + Conference *conf = getConferenceFromCallID (call_id); + + if (conf != NULL) { + // remove this participant + removeParticipant (call_id); + + processRemainingParticipant (current_call_id, conf); + } + + } + + removeCallAccount (call_id); + + removeWaitingCall (call_id); } @@ -1989,7 +2002,7 @@ bool ManagerImpl::playATone (Tone::TONEID toneId) /** * Multi Thread */ -void ManagerImpl::stopTone (bool stopAudio=true) +void ManagerImpl::stopTone () { bool hasToPlayTone; @@ -2067,8 +2080,6 @@ ManagerImpl::ringtone() int layer, samplerate; bool loadFile; - // stopTone(true); - if (isRingtoneEnabled()) { _debug (" Tone is enabled"); @@ -2772,14 +2783,15 @@ ManagerImpl::getDialpad (void) void ManagerImpl::setDialpad (bool display) { - std::string set; + std::string set; + + display ? set = TRUE_STR : set = FALSE_STR; + // If the value we received is different from the one saved in the config file, save the new value + // Else do nothing - display ? set = TRUE_STR : set = FALSE_STR; - // If the value we received is different from the one saved in the config file, save the new value - // Else do nothing - if ((display && (getConfigString (PREFERENCES, CONFIG_DIALPAD) != TRUE_STR)) || - (!display && (getConfigString (PREFERENCES, CONFIG_DIALPAD) != FALSE_STR))) - setConfig (PREFERENCES, CONFIG_DIALPAD, set); + if ( (display && (getConfigString (PREFERENCES, CONFIG_DIALPAD) != TRUE_STR)) || + (!display && (getConfigString (PREFERENCES, CONFIG_DIALPAD) != FALSE_STR))) + setConfig (PREFERENCES, CONFIG_DIALPAD, set); } int @@ -2794,14 +2806,15 @@ ManagerImpl::getVolumeControls (void) void ManagerImpl::setVolumeControls (bool display) { - std::string set; + std::string set; - display ? set = TRUE_STR : set = FALSE_STR; - // If the value we received is different from the one saved in the config file, save the new value - // Else do nothing - if ((display && (getConfigString (PREFERENCES, CONFIG_VOLUME) != TRUE_STR)) || - (!display && (getConfigString (PREFERENCES, CONFIG_VOLUME) != FALSE_STR))) - setConfig (PREFERENCES, CONFIG_VOLUME, set); + display ? set = TRUE_STR : set = FALSE_STR; + // If the value we received is different from the one saved in the config file, save the new value + // Else do nothing + + if ( (display && (getConfigString (PREFERENCES, CONFIG_VOLUME) != TRUE_STR)) || + (!display && (getConfigString (PREFERENCES, CONFIG_VOLUME) != FALSE_STR))) + setConfig (PREFERENCES, CONFIG_VOLUME, set); } void @@ -3104,7 +3117,7 @@ void ManagerImpl::switchAudioManager (void) framesize = getConfigInt (AUDIO , ALSA_FRAME_SIZE); - _debug("samplerate: %i, framesize %i\n", samplerate, framesize); + _debug ("samplerate: %i, framesize %i\n", samplerate, framesize); alsaPlugin = getConfigString (AUDIO , ALSA_PLUGIN); @@ -3201,38 +3214,39 @@ void ManagerImpl::setMicVolume (unsigned short mic_vol) -void ManagerImpl::setLocalIp2IpInfo(const std::string& address) +void ManagerImpl::setLocalIp2IpInfo (const std::string& address) { - std::string ip_address = std::string(address); + std::string ip_address = std::string (address); - int index = ip_address.find_first_of(":"); + int index = ip_address.find_first_of (":"); - std::string local_address = ip_address.substr(0,index); - std::string local_port = ip_address.substr(index+1); - int newPort = atoi(local_port.c_str()); + std::string local_address = ip_address.substr (0,index); + std::string local_port = ip_address.substr (index+1); + int newPort = atoi (local_port.c_str()); _debug ("Setting new address %s and port %s for default account (ip to ip calls)", local_address.c_str(), local_port.c_str()); int prevPort = getConfigInt (IP2IP_PROFILE, LOCAL_PORT); - std::string prevAddress = getConfigString(IP2IP_PROFILE, LOCAL_ADDRESS); + std::string prevAddress = getConfigString (IP2IP_PROFILE, LOCAL_ADDRESS); - if ((prevPort != newPort) || (prevAddress.compare(local_address) != 0)) { + if ( (prevPort != newPort) || (prevAddress.compare (local_address) != 0)) { - - if(_directIpAccount) { - SIPAccount* account = dynamic_cast<SIPAccount*>(_directIpAccount); + if (_directIpAccount) { - account->setLocalPort(newPort); - account->setLocalAddress(local_address); - } + SIPAccount* account = dynamic_cast<SIPAccount*> (_directIpAccount); + + account->setLocalPort (newPort); + account->setLocalAddress (local_address); + } setConfig (IP2IP_PROFILE, LOCAL_ADDRESS, local_address); + setConfig (IP2IP_PROFILE, LOCAL_PORT, newPort); - SIPVoIPLink* siplink = SIPVoIPLink::instance (""); - // if(siplink) - siplink->updateAccountInfo(_directIpAccount->getAccountID()); + SIPVoIPLink* siplink = SIPVoIPLink::instance (""); + // if(siplink) + siplink->updateAccountInfo (_directIpAccount->getAccountID()); // this->restartPJSIP (); } } @@ -3241,7 +3255,7 @@ void ManagerImpl::setLocalIp2IpInfo(const std::string& address) int ManagerImpl::getLocalIp2IpPort (void) { /* The SIP port used for default account (IP to IP) calls */ - _debug("Default account port %i", getConfigInt (IP2IP_PROFILE, LOCAL_PORT)); + _debug ("Default account port %i", getConfigInt (IP2IP_PROFILE, LOCAL_PORT)); return getConfigInt (IP2IP_PROFILE, LOCAL_PORT); @@ -3485,7 +3499,7 @@ std::map< std::string, std::string > ManagerImpl::getAccountDetails (const Accou Account * account = _accountMap[accountID]; if (account == NULL) { - _debug ("Cannot getAccountDetails on a non-existing accountID %s. Defaults will be used.", accountID.c_str()); + _debug ("Cannot getAccountDetails on a non-existing accountID %s. Defaults will be used.", accountID.c_str()); } a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ALIAS, getConfigString (accountID, CONFIG_ACCOUNT_ALIAS))); @@ -3946,7 +3960,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma acc->loadConfig(); if (acc->isEnabled()) { - // acc->unregisterVoIPLink(); // do not need to send an unregister + // acc->unregisterVoIPLink(); // do not need to send an unregister acc->registerVoIPLink(); } else { acc->unregisterVoIPLink(); @@ -4132,7 +4146,7 @@ short ManagerImpl::loadAccountMap() { - _debug("ManagerImpl::loadAccountMap\n"); + _debug ("ManagerImpl::loadAccountMap\n"); short nbAccount = 0; TokenList sections = _config.getSections(); @@ -4157,7 +4171,7 @@ ManagerImpl::loadAccountMap() // No registration in the sense of // the REGISTER method is performed. _debug ("Succeed to create direct ip calls \"account\"\n"); - _accountMap[IP2IP_PROFILE] = _directIpAccount; + _accountMap[IP2IP_PROFILE] = _directIpAccount; _directIpAccount->registerVoIPLink(); } @@ -4190,6 +4204,7 @@ ManagerImpl::loadAccountMap() iter++; } + /* if (_directIpAccount == NULL) { _debug ("Failed to create direct ip calls \"account\""); @@ -4199,7 +4214,7 @@ ManagerImpl::loadAccountMap() // the REGISTER method is performed. _debug ("Succeed to create direct ip calls \"account\""); _directIpAccount->registerVoIPLink(); - _accountMap[IP2IP_PROFILE] = _directIpAccount; + _accountMap[IP2IP_PROFILE] = _directIpAccount; } */ _debug ("nbAccount loaded %i", nbAccount); @@ -4243,7 +4258,7 @@ ManagerImpl::getAccount (const AccountID& accountID) // In our definition, // this is the "direct ip calls account" if (accountID == AccountNULL) { - _debug ("Returns the direct IP account"); + _debug ("Returns the direct IP account"); return _directIpAccount; } diff --git a/sflphone-common/src/managerimpl.h b/sflphone-common/src/managerimpl.h index 4f6c85e93894d7484c1150cbb1ccc076e34108f0..f173539d258e36e3c0ea25bd1e11198d83c09f3c 100644 --- a/sflphone-common/src/managerimpl.h +++ b/sflphone-common/src/managerimpl.h @@ -332,9 +332,8 @@ class ManagerImpl { /** * Play the dtmf-associated sound * @param code The pressed key - * @param isTalking In conversation or not. Useful to know whether or not the sound streams are started */ - bool playDtmf(char code, bool isTalking); + bool playDtmf (char code); /** * Play a ringtone @@ -352,9 +351,8 @@ class ManagerImpl { /** * Acts on the audio streams and audio files - * @param stopAudio Tells whether or not to stop the streams */ - void stopTone(bool stopAudio); + void stopTone (void); /** * When receiving a new incoming call, add it to the callaccount map @@ -1044,9 +1042,9 @@ class ManagerImpl { */ void restartPJSIP( ); - void unregisterCurSIPAccounts(); + void unregisterCurSIPAccounts (void); - void registerCurSIPAccounts(VoIPLink *link); + void registerCurSIPAccounts (void); /* * Initialize audiodriver diff --git a/sflphone-common/src/managerimpl_registration.cpp b/sflphone-common/src/managerimpl_registration.cpp index 5e3b9d27cee1868f761d2e546a349b54b55652c6..5e535e4b25b55e746916431e38564a26335f85a1 100644 --- a/sflphone-common/src/managerimpl_registration.cpp +++ b/sflphone-common/src/managerimpl_registration.cpp @@ -40,9 +40,8 @@ #include <errno.h> #include <cstdlib> -//THREAD=Main int -ManagerImpl::initRegisterAccounts() +ManagerImpl::registerAccounts() { int status; bool flag = true; @@ -55,10 +54,11 @@ ManagerImpl::initRegisterAccounts() while (iter != _accountMap.end()) { if (iter->second) { - iter->second->loadConfig(); - /* If the account is set as enabled, try to register */ if (iter->second->isEnabled()) { + + _debug("Register account %s", iter->first.c_str()); + status = iter->second->registerVoIPLink(); if (status != SUCCESS) { @@ -79,26 +79,9 @@ ManagerImpl::initRegisterAccounts() return SUCCESS; } -void ManagerImpl::restartPJSIP (void) -{ - SIPVoIPLink *siplink; - siplink = dynamic_cast<SIPVoIPLink*> (getSIPAccountLink ()); - - this->unregisterCurSIPAccounts(); - /* Terminate and initialize the PJSIP library */ - - if (siplink) { - siplink->terminate (); - siplink = SIPVoIPLink::instance (""); - siplink->init (); - } - - /* Then register all enabled SIP accounts */ - this->registerCurSIPAccounts (siplink); -} - +//THREAD=Main int -ManagerImpl::registerAccounts() +ManagerImpl::initRegisterAccounts() { int status; bool flag = true; @@ -111,11 +94,10 @@ ManagerImpl::registerAccounts() while (iter != _accountMap.end()) { if (iter->second) { + iter->second->loadConfig(); + /* If the account is set as enabled, try to register */ if (iter->second->isEnabled()) { - - _debug("Register account %s", iter->first.c_str()); - status = iter->second->registerVoIPLink(); if (status != SUCCESS) { @@ -136,6 +118,35 @@ ManagerImpl::registerAccounts() return SUCCESS; } +void ManagerImpl::restartPJSIP (void) +{ + _debug ("ManagerImpl::restartPJSIP\n"); + VoIPLink *link = getSIPAccountLink(); + SIPVoIPLink *siplink = NULL; + + if (link) { + siplink = dynamic_cast<SIPVoIPLink*> (getSIPAccountLink ()); + } + + _debug ("ManagerImpl::unregister sip account\n"); + + this->unregisterCurSIPAccounts(); + /* Terminate and initialize the PJSIP library */ + + if (siplink) { + _debug ("ManagerImpl::Terminate sip\n"); + siplink->terminate (); + siplink = SIPVoIPLink::instance (""); + _debug ("ManagerImpl::Init new sip\n"); + siplink->init (); + } + + _debug ("ManagerImpl::register sip account\n"); + + /* Then register all enabled SIP accounts */ + this->registerCurSIPAccounts (); +} + VoIPLink* ManagerImpl::getAccountLink (const AccountID& accountID) { if (accountID!=AccountNULL) { @@ -154,21 +165,23 @@ VoIPLink* ManagerImpl::getSIPAccountLink() { /* We are looking for the first SIP account we met because all the SIP accounts have the same voiplink */ Account *account; - AccountMap::iterator iter; + AccountMap::iterator iter = _accountMap.begin(); + + while (iter != _accountMap.end()) { - for (iter = _accountMap.begin(); iter != _accountMap.end(); ++iter) { account = iter->second; if (account->getType() == "sip") { return account->getVoIPLink(); } + + ++iter; } return NULL; } -pjsip_regc -*getSipRegcFromID (const AccountID& id UNUSED) +pjsip_regc *getSipRegcFromID (const AccountID& id UNUSED) { /*SIPAccount *tmp = dynamic_cast<SIPAccount *>getAccount(id); if(tmp != NULL) @@ -196,7 +209,7 @@ void ManagerImpl::unregisterCurSIPAccounts() } } -void ManagerImpl::registerCurSIPAccounts (VoIPLink *link) +void ManagerImpl::registerCurSIPAccounts (void) { Account *current; @@ -233,12 +246,13 @@ ManagerImpl::sendRegister (const std::string& accountID , const int32_t& enable) if (acc->isEnabled()) { // Verify we aren't already registered, then register - _debug ("Send register for account %s" , accountID.c_str()); + _debug ("Send register for account %s\n" , accountID.c_str()); acc->registerVoIPLink(); } else { // Verify we are already registered, then unregister - _debug ("Send unregister for account %s" , accountID.c_str()); + _debug ("Send unregister for account %s\n" , accountID.c_str()); acc->unregisterVoIPLink(); } } + diff --git a/sflphone-common/src/plug-in/librarymanager.cpp b/sflphone-common/src/plug-in/librarymanager.cpp index 98433b07b2c60b971de930298477e55fc8ad3c00..f4fba8683bfd985075e7ede79cba759e535d23eb 100644 --- a/sflphone-common/src/plug-in/librarymanager.cpp +++ b/sflphone-common/src/plug-in/librarymanager.cpp @@ -92,7 +92,7 @@ int LibraryManager::resolveSymbol (const std::string &symbol, SymbolHandle *symb /************************************************************************************************/ LibraryManagerException::LibraryManagerException (const std::string &libraryName, const std::string &details, Reason reason) : - std::runtime_error (""), _reason (reason), _details ("") + std::runtime_error (""), _reason (reason), _details ("") { if (_reason == loadingFailed) diff --git a/sflphone-common/src/sip/sdp.cpp b/sflphone-common/src/sip/sdp.cpp index 15c4d8e96316b8d883c91086f634cb06b927ec4a..c9cf1b6e97bf2d281f2d207cc7bbb54f567e71e5 100644 --- a/sflphone-common/src/sip/sdp.cpp +++ b/sflphone-common/src/sip/sdp.cpp @@ -375,7 +375,7 @@ void Sdp::sdp_add_zrtp_attribute (pjmedia_sdp_media* media, std::string hash) "%.*s %.*s", 4, ZRTP_VERSION, - (int)hash.size(), + (int) hash.size(), hash.c_str()); attribute->value.slen = len; @@ -440,8 +440,9 @@ void Sdp::set_negotiated_sdp (const pjmedia_sdp_session *sdp) for (j=0 ; j<nb_codecs ; j++) { attribute = pjmedia_sdp_media_find_attr (current, &STR_RTPMAP, NULL); // pj_strtoul(attribute->pt) - if (!attribute) - return; + + if (!attribute) + return; pjmedia_sdp_attr_to_rtpmap (_pool, attribute, &rtpmap); diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp index c5fac3216b9be71093127b2ff6969d0e76b8e617..26ee3ca7816a9c1b25aadf289088054e787e984c 100644 --- a/sflphone-common/src/sip/sipaccount.cpp +++ b/sflphone-common/src/sip/sipaccount.cpp @@ -25,24 +25,24 @@ #include <pwd.h> SIPAccount::SIPAccount (const AccountID& accountID) - : Account (accountID, "sip") - , _regc (NULL) - , _bRegister (false) - , _registrationExpire ("") - , _publishedSameasLocal(true) - , _localIpAddress ("") - , _publishedIpAddress ("") - , _localPort (atoi (DEFAULT_SIP_PORT)) - , _publishedPort (atoi (DEFAULT_SIP_PORT)) - , _transportType (PJSIP_TRANSPORT_UNSPECIFIED) - , _transport(NULL) - , _resolveOnce (false) - , _credentialCount (0) - , _cred (NULL) - , _realm (DEFAULT_REALM) - , _authenticationUsername ("") - , _tlsSetting (NULL) - , _displayName ("") + : Account (accountID, "sip") + , _regc (NULL) + , _bRegister (false) + , _registrationExpire ("") + , _publishedSameasLocal (true) + , _localIpAddress ("") + , _publishedIpAddress ("") + , _localPort (atoi (DEFAULT_SIP_PORT)) + , _publishedPort (atoi (DEFAULT_SIP_PORT)) + , _transportType (PJSIP_TRANSPORT_UNSPECIFIED) + , _transport (NULL) + , _resolveOnce (false) + , _credentialCount (0) + , _cred (NULL) + , _realm (DEFAULT_REALM) + , _authenticationUsername ("") + , _tlsSetting (NULL) + , _displayName ("") { /* SIPVoIPlink is used as a singleton, because we want to have only one link for all the SIP accounts created */ /* So instead of creating a new instance, we just fetch the static instance, or create one if it is not yet */ @@ -330,15 +330,20 @@ void SIPAccount::loadConfig() } // Load network settings - // Local parameters + // Local parameters std::string localPort = Manager::instance().getConfigString (_accountID, LOCAL_PORT); + setLocalPort (atoi (localPort.c_str())); + setLocalAddress (Manager::instance().getConfigString (_accountID, LOCAL_ADDRESS)); - // Published parameters - setPublishedSameasLocal (Manager::instance().getConfigString (_accountID, PUBLISHED_SAMEAS_LOCAL) == TRUE_STR ? true : false); + // Published parameters + setPublishedSameasLocal (Manager::instance().getConfigString (_accountID, PUBLISHED_SAMEAS_LOCAL) == TRUE_STR ? true : false); + std::string publishedPort = Manager::instance().getConfigString (_accountID, PUBLISHED_PORT); + setPublishedPort (atoi (publishedPort.c_str())); + setPublishedAddress (Manager::instance().getConfigString (_accountID, PUBLISHED_ADDRESS)); // Init TLS settings if the user wants to use TLS diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp index 14c6ad596cc00b2282dee7a9d96eb3a7a6b43ee1..ec56dec43fc8d00b342d030fd94e6c6f04957e4f 100644 --- a/sflphone-common/src/sip/sipvoiplink.cpp +++ b/sflphone-common/src/sip/sipvoiplink.cpp @@ -246,7 +246,7 @@ SIPVoIPLink* SIPVoIPLink::instance (const AccountID& id) { if (!_instance) { - _debug ("Create new SIPVoIPLink instance"); + _debug ("Create new SIPVoIPLink instance"); _instance = new SIPVoIPLink (id); } @@ -268,8 +268,8 @@ bool SIPVoIPLink::init() if (initDone()) return false; - // TODO This port should be the one configured for the IP profile - // and not the global one + // TODO This port should be the one configured for the IP profile + // and not the global one _regPort = Manager::instance().getLocalIp2IpPort(); /* Instanciate the C++ thread */ @@ -286,12 +286,12 @@ bool SIPVoIPLink::init() void SIPVoIPLink::terminate() { - _debug("SIPVoIPLink::terminate"); + _debug ("SIPVoIPLink::terminate"); if (_evThread) { - _debug("SIPVoIPLink:: delete eventThread"); + _debug ("SIPVoIPLink:: delete eventThread"); delete _evThread; _evThread = NULL; } @@ -300,7 +300,7 @@ SIPVoIPLink::terminate() /* Clean shutdown of pjsip library */ if (initDone()) { - _debug("pjsip_shutdown\n"); + _debug ("pjsip_shutdown\n"); pjsip_shutdown(); } @@ -681,7 +681,7 @@ SIPVoIPLink::newOutgoingCall (const CallID& id, const std::string& toUrl) call->setPeerNumber (toUri); - // TODO May use the published address as well + // TODO May use the published address as well localAddr = account->getLocalAddress (); setCallAudioLocal (call, localAddr); @@ -1321,7 +1321,9 @@ SIPVoIPLink::SIPStartCall (SIPCall* call, const std::string& subject UNUSED) // Set the appropriate transport pjsip_tpselector *tp; + init_transport_selector (account->getAccountTransport (), &tp); + status = pjsip_dlg_set_transport (dialog, tp); status = pjsip_inv_send_msg (inv, tdata); @@ -1433,7 +1435,7 @@ bool SIPVoIPLink::new_ip_to_ip_call (const CallID& id, const std::string& to) pjsip_dialog *dialog; pjsip_inv_session *inv; pjsip_tx_data *tdata; - std::string localAddress; + std::string localAddress; /* Create the call */ call = new SIPCall (id, Call::Outgoing, _pool); @@ -1451,15 +1453,18 @@ bool SIPVoIPLink::new_ip_to_ip_call (const CallID& id, const std::string& to) _debug ("Account is null. Returning"); return !PJ_SUCCESS; } - - // Set SDP parameters - localAddress = account->getLocalAddress (); - _debug("new_ip_to_ip_call localAddress: %s\n", localAddress.c_str()); - if (localAddress == "0.0.0.0"){ - _debug ("Here is the local address: %s", localAddress.c_str ()); - loadSIPLocalIP (&localAddress); - } - setCallAudioLocal (call, localAddress); + + // Set SDP parameters + localAddress = account->getLocalAddress (); + + _debug ("new_ip_to_ip_call localAddress: %s", localAddress.c_str()); + + if (localAddress == "0.0.0.0") { + _debug ("Here is the local address: %s", localAddress.c_str ()); + loadSIPLocalIP (&localAddress); + } + + setCallAudioLocal (call, localAddress); _debug ("toUri received in new_ip_to_ip call %s", to.c_str()); @@ -1476,14 +1481,15 @@ bool SIPVoIPLink::new_ip_to_ip_call (const CallID& id, const std::string& to) _debug ("! SIP Failure: Unable to create RTP Session in SIPVoIPLink::new_ip_to_ip_call (%s:%d)", __FILE__, __LINE__); } - // If no account already set, use the default one created at pjsip initialization - if(account->getAccountTransport() == NULL) { - _debug("No transport for this account, using the default one\n"); - account->setAccountTransport(_localUDPTransport); - } + // If no account already set, use the default one created at pjsip initialization + if (account->getAccountTransport() == NULL) { + _debug ("No transport for this account, using the default one\n"); + account->setAccountTransport (_localUDPTransport); + } + + _debug ("IptoIP local port %i\n", account->getLocalPort()); - _debug("IptoIP local port %i\n", account->getLocalPort()); - _debug("IptoIP local address %s\n", account->getLocalAddress().c_str()); + _debug ("IptoIP local address %s\n", account->getLocalAddress().c_str()); // Create URI std::string fromUri; @@ -1670,11 +1676,11 @@ bool SIPVoIPLink::pjsip_init() pj_str_t accepted; std::string name_mod; pj_dns_resolver *p_resv; - std::string addr; + std::string addr; name_mod = "sflphone"; - _debug("pjsip_init\n"); + _debug ("pjsip_init\n"); // Init PJLIB: must be called before any call to the pjsip library status = pj_init(); @@ -1717,15 +1723,17 @@ bool SIPVoIPLink::pjsip_init() // This corresponds to the accountID set to // AccountNULL SIPAccount * account = NULL; + bool directIpCallsTlsEnabled = false; + account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (AccountNULL)); if (account == NULL) { _debug ("Account is null in pjsip init"); - port = _regPort; + port = _regPort; } else { directIpCallsTlsEnabled = account->isTlsEnabled(); - port = account->getLocalPort (); + port = account->getLocalPort (); } // Create a UDP listener meant for all accounts @@ -1923,14 +1931,17 @@ int SIPVoIPLink::createUDPServer (AccountID id) int listeningPort = _regPort; /* Use my local address as default value */ + if (!loadSIPLocalIP (&listeningAddress)) return !PJ_SUCCESS; - _debug("SIPVoIPLink::createUDPServer\n"); + _debug ("SIPVoIPLink::createUDPServer\n"); + /* * Retrieve the account information */ SIPAccount * account = NULL; + account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (id)); // Set information to the local address and port @@ -1939,10 +1950,11 @@ int SIPVoIPLink::createUDPServer (AccountID id) _debug ("Account with id \"%s\" is null in createUDPServer.", id.c_str()); } else { // We are trying to initialize a UDP transport available for all local accounts and direct IP calls - if (account->getLocalAddress () != "0.0.0.0"){ - listeningAddress = account->getLocalAddress (); - } - listeningPort = account->getLocalPort (); + if (account->getLocalAddress () != "0.0.0.0") { + listeningAddress = account->getLocalAddress (); + } + + listeningPort = account->getLocalPort (); } // Init bound address to ANY @@ -1957,20 +1969,21 @@ int SIPVoIPLink::createUDPServer (AccountID id) pj_bzero (bound_addr.sin_zero, sizeof (bound_addr.sin_zero)); // Create UDP-Server (default port: 5060) - // Use here either the local information or the published address - if (account != NULL && !account->getPublishedSameasLocal ()) - { - // Set the listening address to the published address - listeningAddress = account->getPublishedAddress (); - // Set the listening port to the published port - listeningPort = account->getPublishedPort (); - _debug (" ******************************** Use the published address %s:%i\n", listeningAddress.c_str (), listeningPort ); - } + // Use here either the local information or the published address + if (account != NULL && !account->getPublishedSameasLocal ()) { + // Set the listening address to the published address + listeningAddress = account->getPublishedAddress (); + // Set the listening port to the published port + listeningPort = account->getPublishedPort (); + _debug (" ******************************** Use the published address %s:%i\n", listeningAddress.c_str (), listeningPort); + } //strcpy (tmpIP, listeningAddress.data()); - /* Init published name */ + /* Init published name */ pj_bzero (&a_name, sizeof (pjsip_host_port)); + pj_cstr (&a_name.host, listeningAddress.c_str()); + a_name.port = listeningPort; @@ -2001,7 +2014,7 @@ int SIPVoIPLink::createUDPServer (AccountID id) if (account == NULL) _localUDPTransport = transport; else - account->setAccountTransport (transport); + account->setAccountTransport (transport); } _debug ("Transport initialized successfully on %s:%i", listeningAddress.c_str (), listeningPort); @@ -2086,7 +2099,8 @@ std::string SIPVoIPLink::findLocalAddressFromUri (const std::string& uri, pjsip_ return machineName; } - _debug ("Local address discovered from attached transport: %s", localAddress.ptr); + _debug ("Local address discovered from attached transport: %s", localAddress.ptr); + return std::string (localAddress.ptr, localAddress.slen); } @@ -2182,7 +2196,7 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport * _debug ("Failed to find local address from transport"); } - _debug ("Local port discovered from attached transport: %i", port); + _debug ("Local port discovered from attached transport: %i", port); return port; } @@ -2235,8 +2249,8 @@ pj_status_t SIPVoIPLink::createAlternateUdpTransport (AccountID id) pj_uint16_t stunPort; pj_sockaddr_in pub_addr; pj_sock_t sock; - std::string listeningAddress = ""; - int listeningPort; + std::string listeningAddress = ""; + int listeningPort; /* * Retrieve the account information @@ -2310,10 +2324,11 @@ pj_status_t SIPVoIPLink::createAlternateUdpTransport (AccountID id) if (status != PJ_SUCCESS) { _debug ("Error creating alternate SIP UDP listener (%d)", status); - return status; + return status; } - _debug ("UDP Transport successfully created on %s:%i", listeningAddress.c_str (), listeningPort); + _debug ("UDP Transport successfully created on %s:%i", listeningAddress.c_str (), listeningPort); + account->setAccountTransport (transport); return PJ_SUCCESS; @@ -2396,10 +2411,10 @@ pj_status_t SIPVoIPLink::createTlsTransport (AccountID id) } -void SIPVoIPLink::updateAccountInfo(const AccountID& accountID) +void SIPVoIPLink::updateAccountInfo (const AccountID& accountID) { - createUDPServer(accountID); + createUDPServer (accountID); } @@ -2408,11 +2423,11 @@ bool SIPVoIPLink::loadSIPLocalIP (std::string *addr) { bool returnValue = true; - std::string localAddress = "127.0.0.1"; + std::string localAddress = "127.0.0.1"; pj_sockaddr ip_addr; if (pj_gethostip (pj_AF_INET(), &ip_addr) != PJ_SUCCESS) { - // Update the registration state if no network capabilities found + // Update the registration state if no network capabilities found _debug ("UserAgent: Get host ip failed!"); returnValue = false; } else { @@ -2420,7 +2435,8 @@ bool SIPVoIPLink::loadSIPLocalIP (std::string *addr) _debug ("UserAgent: Checking network, setting local IP address to: %s", localAddress.data()); } - *addr = localAddress; + *addr = localAddress; + return returnValue; } @@ -2665,7 +2681,7 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e) //pjsip_transaction * tsx pjsip_transaction * tsx = NULL; tsx = e->body.tsx_state.tsx; - int statusCode; + int statusCode = 404; if (tsx != NULL) { statusCode = tsx->status_code; @@ -2732,7 +2748,7 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e) case PJSIP_SC_UNAUTHORIZED: - case PJSIP_SC_FORBIDDEN: + case PJSIP_SC_FORBIDDEN: case PJSIP_SC_REQUEST_PENDING: accId = Manager::instance().getAccountFromCall (call->getCallId()); @@ -2844,8 +2860,8 @@ void regc_cb (struct pjsip_regc_cbparam *param) if (param->code && description) { - //std::string descriptionprint(description->ptr, description->slen); - //_debug("Received client registration callback wiht code: %i, %s\n", param->code, descriptionprint.c_str()); + //std::string descriptionprint(description->ptr, description->slen); + //_debug("Received client registration callback wiht code: %i, %s\n", param->code, descriptionprint.c_str()); DBusManager::instance().getCallManager()->registrationStateChanged (account->getAccountID(), std::string (description->ptr, description->slen), param->code); std::pair<int, std::string> details (param->code, std::string (description->ptr, description->slen)); account->setRegistrationStateDetailed (details); @@ -3077,18 +3093,17 @@ mod_on_rx_request (pjsip_rx_data *rdata) account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (account_id)); if (account != NULL) { - // TODO May use the published address as well - addrToUse = account->getLocalAddress (); + // TODO May use the published address as well + addrToUse = account->getLocalAddress (); } - if (addrToUse == "0.0.0.0") - { - link->loadSIPLocalIP (&addrToUse); - } + if (addrToUse == "0.0.0.0") { + link->loadSIPLocalIP (&addrToUse); + } - // Have to do some stuff with the SDP - // Set the codec map, IP, peer number and so on... for the SIPCall object - setCallAudioLocal (call, addrToUse); + // Have to do some stuff with the SDP + // Set the codec map, IP, peer number and so on... for the SIPCall object + setCallAudioLocal (call, addrToUse); // We retrieve the remote sdp offer in the rdata struct to begin the negociation call->getLocalSDP()->set_ip_address (addrToUse); diff --git a/sflphone-common/src/sip/sipvoiplink.h b/sflphone-common/src/sip/sipvoiplink.h index 7b28b1761b1acb4a1869d8d8c02586faefe2e4b2..69d79d8b7c7e370d94ddcc8979e342c75d20b46c 100644 --- a/sflphone-common/src/sip/sipvoiplink.h +++ b/sflphone-common/src/sip/sipvoiplink.h @@ -43,7 +43,7 @@ class SIPCall; #define RANDOM_SIP_PORT rand() % 64000 + 1024 // To set the verbosity. From 0 (min) to 6 (max) -#define PJ_LOG_LEVEL 1 +#define PJ_LOG_LEVEL 6 /** * @file sipvoiplink.h diff --git a/sflphone-common/test/audiolayerTest.cpp b/sflphone-common/test/audiolayerTest.cpp index eb7ad02999cede6be0b54d253c3012e68a41240d..065b396c47ba801d95da7aa082610f4c861322dd 100644 --- a/sflphone-common/test/audiolayerTest.cpp +++ b/sflphone-common/test/audiolayerTest.cpp @@ -65,14 +65,15 @@ void AudioLayerTest::testAudioLayerConfig() { int sampling_rate = Manager::instance().getConfigInt (AUDIO, ALSA_SAMPLE_RATE); int frame_size = Manager::instance().getConfigInt (AUDIO, ALSA_FRAME_SIZE); - frame_size = 0; // frame size in config not used anymore + frame_size = 0; // frame size in config not used anymore int layer = Manager::instance().getAudioDriver()->getLayerType(); - if(layer != ALSA) + if (layer != ALSA) Manager::instance().switchAudioManager(); CPPUNIT_ASSERT ( (int) Manager::instance().getAudioDriver()->getSampleRate() == sampling_rate); + CPPUNIT_ASSERT ( (int) Manager::instance().getAudioDriver()->getFrameSize() == frame_size); } @@ -111,7 +112,7 @@ void AudioLayerTest::testPulseConnect() manager = &Manager::instance(); // _pulselayer = new PulseLayer (manager); - _pulselayer = (PulseLayer*)Manager::instance().getAudioDriver(); + _pulselayer = (PulseLayer*) Manager::instance().getAudioDriver(); CPPUNIT_ASSERT (_pulselayer->getLayerType() == PULSEAUDIO); @@ -146,21 +147,22 @@ void AudioLayerTest::testPulseConnect() // Must return Access failure "PA_ERR_ACCESS" == 2 // CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->getStreamState() == 2); // CPPUNIT_ASSERT (_pulselayer->getRecordStream()->getStreamState() == 2); - _debug("-------------------------- \n"); + _debug ("-------------------------- \n"); _pulselayer->startStream (); // usleep(1000000); - + CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->pulseStream() != NULL); CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->pulseStream() != NULL); // Must return No error "PA_OK" == 1 CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->getStreamState() == 1); CPPUNIT_ASSERT (_pulselayer->getRecordStream()->getStreamState() == 1); - + CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->disconnectStream() == true); CPPUNIT_ASSERT (_pulselayer->getRecordStream()->disconnectStream() == true); + CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->connectStream() == true); CPPUNIT_ASSERT (_pulselayer->getRecordStream()->connectStream() == true); @@ -175,7 +177,7 @@ void AudioLayerTest::testPulseConnect() // usleep(1000000); CPPUNIT_ASSERT (_pulselayer->disconnectAudioStream() == true); - + } diff --git a/sflphone-common/test/mainbufferTest.cpp b/sflphone-common/test/mainbufferTest.cpp index f9e8e43c39017bfe396f0cad8a19e02bbcc3d1c2..830ff2c76979e67b867861c1433643c766dd609a 100644 --- a/sflphone-common/test/mainbufferTest.cpp +++ b/sflphone-common/test/mainbufferTest.cpp @@ -554,7 +554,7 @@ void MainBufferTest::testBindUnbindBuffer() // unbind test_id1 with default_id _mainbuffer.unBindCallID (test_id1); - _debug ("%i", (int)(_mainbuffer._ringBufferMap.size())); + _debug ("%i", (int) (_mainbuffer._ringBufferMap.size())); CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 0); CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 0); @@ -1383,7 +1383,7 @@ void MainBufferTest::testConference() CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == sizeof (int)); CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int)); CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int)); - //putdata test ring buffers + //putdata test ring buffers CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id2) == sizeof (int)); test_ring_buffer = _mainbuffer.getRingBuffer (default_id); CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int)); @@ -1500,10 +1500,10 @@ void MainBufferTest::testConference() CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id2); CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0); CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0); - // test mainbuffer availforget + // test mainbuffer availforget CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof(int)); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof(int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int)); //putdata test ring buffers CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id1) == sizeof (int)); test_ring_buffer = _mainbuffer.getRingBuffer (default_id); @@ -1522,8 +1522,8 @@ void MainBufferTest::testConference() CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0); CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0); // test mainbuffer availforget - CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == sizeof(int)); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof(int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == sizeof (int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int)); CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int)); //putdata test ring buffers CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id2) == sizeof (int)); @@ -1641,8 +1641,8 @@ void MainBufferTest::testConference() CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0); // test mainbuffer availforget CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof(int)); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof(int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int)); //putdata test ring buffers CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id1) == sizeof (int)); test_ring_buffer = _mainbuffer.getRingBuffer (default_id); @@ -1661,8 +1661,8 @@ void MainBufferTest::testConference() CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0); CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0); // test mainbuffer availforget - CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == sizeof(int)); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof(int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == sizeof (int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int)); CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int)); //putdata test ring buffers CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id2) == sizeof (int)); diff --git a/sflphone-common/test/rtpTest.cpp b/sflphone-common/test/rtpTest.cpp index 7b37b621d0b39badc5c54f89f2c6ee9fc89cf7de..31dfcc81663b2c3842a3b4a0be2a1bb63dc1ab02 100644 --- a/sflphone-common/test/rtpTest.cpp +++ b/sflphone-common/test/rtpTest.cpp @@ -81,7 +81,7 @@ bool RtpTest::pjsipInit() void RtpTest::testRtpInitClose() { - audiortp = new AudioSymmetricRtpSession(Manager::instance(), sipcall); + audiortp = new AudioSymmetricRtpSession (Manager::instance(), sipcall); _debug ("------ void RtpTest::testRtpInit() ------");