diff --git a/sflphone-client-gnome/src/config/accountwindow.c b/sflphone-client-gnome/src/config/accountwindow.c index 41c529f37bd712dd1d98dd1e78f760a1d0067077..89854fe8c69a1a00edad49f427b3484f774af9eb 100644 --- a/sflphone-client-gnome/src/config/accountwindow.c +++ b/sflphone-client-gnome/src/config/accountwindow.c @@ -38,7 +38,13 @@ #include <gtk/gtk.h> -/** Local variables */ +/** + * TODO: tidy this up + * by storing these variables + * in a private structure. + * Local variables + */ + GtkDialog * dialog; GtkWidget * hbox; GtkWidget * label; @@ -59,6 +65,14 @@ GtkWidget * scrolledWindowCredential; GtkWidget * advancedZrtpButton; GtkWidget * keyExchangeCombo; GtkWidget * useSipTlsCheckBox; + +GtkWidget * publishedAddressEntry; +GtkWidget * localAddressCombo; +GtkWidget * sameAsLocalCheckBox; +GtkWidget * publishedPortSpinBox; +GtkWidget * localPortSpinBox; + +GtkWidget * displayNameEntry; // Credentials enum { @@ -107,7 +121,6 @@ static GtkWidget * create_account_tab(account_t **a) // Default settings gchar * curAccountID = ""; gchar * curAccountEnabled = "true"; - gchar * curAccountResolveOnce = "false"; gchar * curAccountType = "SIP"; gchar * curAlias = ""; gchar * curUsername = ""; @@ -129,7 +142,6 @@ static GtkWidget * create_account_tab(account_t **a) curPassword = g_hash_table_lookup(currentAccount->properties, ACCOUNT_PASSWORD); curUsername = g_hash_table_lookup(currentAccount->properties, ACCOUNT_USERNAME); curMailbox = g_hash_table_lookup(currentAccount->properties, ACCOUNT_MAILBOX); - curAccountResolveOnce = g_hash_table_lookup(currentAccount->properties, ACCOUNT_RESOLVE_ONCE); } else { @@ -425,11 +437,10 @@ static void use_sip_tls_cb(GtkWidget *widget, gpointer data) gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE); } else { gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); - } - + } } -GtkWidget * create_advanced_tab(account_t **a) +GtkWidget * create_security_tab(account_t **a) { GtkWidget * frame; GtkWidget * table; @@ -452,21 +463,10 @@ GtkWidget * create_advanced_tab(account_t **a) gchar * curSRTPEnabled = NULL; gchar * curKeyExchange = NULL; - gchar * curAccountResolveOnce = NULL; - gchar * curAccountExpire = NULL; gchar * curTLSEnabled = NULL; // Load from SIP/IAX/Unknown ? - if(currentAccount) { - curAccountResolveOnce = g_hash_table_lookup(currentAccount->properties, ACCOUNT_RESOLVE_ONCE); - if (curAccountResolveOnce == NULL) { - curAccountResolveOnce = "false"; - } - curAccountExpire = g_hash_table_lookup(currentAccount->properties, ACCOUNT_REGISTRATION_EXPIRE); - if (curAccountExpire == NULL) { - curAccountExpire = "600"; - } - + if(currentAccount) { curKeyExchange = g_hash_table_lookup(currentAccount->properties, ACCOUNT_KEY_EXCHANGE); if (curKeyExchange == NULL) { curKeyExchange = "none"; @@ -482,31 +482,9 @@ GtkWidget * create_advanced_tab(account_t **a) curTLSEnabled = "false"; } } - - gnome_main_section_new_with_table (_("Registration Options"), &frame, &table, 2, 3); - gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); - - label = gtk_label_new_with_mnemonic (_("Registration _expire")); - gtk_table_attach_defaults( GTK_TABLE( table ), label, 0, 1, 0, 1); - gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); - entryExpire = gtk_entry_new(); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryExpire); - gtk_entry_set_text(GTK_ENTRY(entryExpire), curAccountExpire); - gtk_table_attach_defaults( GTK_TABLE( table ), entryExpire, 1, 2, 0, 1); - - entryResolveNameOnlyOnce = gtk_check_button_new_with_mnemonic(_("_Comply with RFC 3263")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(entryResolveNameOnlyOnce), - g_strcasecmp(curAccountResolveOnce,"false") == 0 ? TRUE: FALSE); - gtk_table_attach_defaults( GTK_TABLE( table ), entryResolveNameOnlyOnce, 0, 2, 1, 2); - gtk_widget_set_sensitive( GTK_WIDGET( entryResolveNameOnlyOnce ) , TRUE ); - - gtk_widget_show_all( table ); - gtk_container_set_border_width (GTK_CONTAINER(table), 10); - - gtk_widget_size_request(GTK_WIDGET(table), &requisitionTable); - + /* Credentials tree view */ - gnome_main_section_new_with_table (_("Credential informations"), &frame, &table, 1, 1); + gnome_main_section_new_with_table (_("Credential"), &frame, &table, 1, 1); gtk_container_set_border_width (GTK_CONTAINER(table), 10); gtk_table_set_row_spacings(GTK_TABLE(table), 10); gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); @@ -520,7 +498,7 @@ GtkWidget * create_advanced_tab(account_t **a) G_TYPE_STRING, // Realm G_TYPE_STRING, // Username G_TYPE_STRING, // Password - G_TYPE_POINTER // Pointer to the Object + G_TYPE_POINTER // Pointer to the Objectc ); treeViewCredential = gtk_tree_view_new_with_model(GTK_TREE_MODEL(credentialStore)); @@ -564,7 +542,7 @@ GtkWidget * create_advanced_tab(account_t **a) /* Dynamically resize the window to fit the scrolled window */ gtk_widget_size_request(GTK_WIDGET(treeViewCredential), &requisitionTreeView); - gtk_widget_set_size_request(GTK_WIDGET(scrolledWindowCredential), requisitionTable.width, requisitionTreeView.height + 20); + gtk_widget_set_size_request(GTK_WIDGET(scrolledWindowCredential), requisitionTreeView.width, requisitionTreeView.height + 20); /* Credential Buttons */ hbox = gtk_hbox_new(FALSE, 10); @@ -631,6 +609,177 @@ GtkWidget * create_advanced_tab(account_t **a) return ret; } +static same_as_local_cb(GtkWidget * widget, gpointer data UNUSED) +{ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { + DEBUG("Same as local"); + gchar * ip_address = (gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(localAddressCombo)); + gtk_entry_set_text(GTK_ENTRY(publishedAddressEntry), ip_address); + + gchar * local_port = gtk_entry_get_text(GTK_ENTRY(localPortSpinBox)); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(publishedPortSpinBox), g_ascii_strtod(local_port, NULL)); + + gtk_widget_set_sensitive(publishedPortSpinBox, FALSE); + gtk_widget_set_sensitive(publishedAddressEntry, FALSE); + } else { + gtk_widget_set_sensitive(publishedPortSpinBox, TRUE); + gtk_widget_set_sensitive(publishedAddressEntry, TRUE); + } +} + +GtkWidget * create_advanced_tab(account_t **a) +{ + GtkWidget * frame; + GtkWidget * table; + GtkWidget * label; + GtkWidget * ret; + GtkWidget * hbox; + + ret = gtk_vbox_new(FALSE, 10); + gtk_container_set_border_width(GTK_CONTAINER(ret), 10); + + account_t * currentAccount; + currentAccount = *a; + + gchar * resolve_once = NULL; + gchar * account_expire = NULL; + gchar * published_address; + gchar * published_port; + gchar * local_address; + gchar * local_port; + + // Load from SIP/IAX/Unknown ? + if(currentAccount) { + resolve_once = g_hash_table_lookup(currentAccount->properties, ACCOUNT_RESOLVE_ONCE); + account_expire = g_hash_table_lookup(currentAccount->properties, ACCOUNT_REGISTRATION_EXPIRE); + local_port = g_hash_table_lookup(currentAccount->properties, LOCAL_PORT); + local_address = g_hash_table_lookup(currentAccount->properties, LOCAL_ADDRESS); + published_address = g_hash_table_lookup(currentAccount->properties, PUBLISHED_ADDRESS); + published_port = g_hash_table_lookup(currentAccount->properties, PUBLISHED_PORT); + } + + gnome_main_section_new_with_table (_("Registration"), &frame, &table, 2, 3); + gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER(table), 10); + + label = gtk_label_new_with_mnemonic (_("Registration _expire")); + gtk_table_attach_defaults( GTK_TABLE( table ), label, 0, 1, 0, 1); + gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); + entryExpire = gtk_entry_new(); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryExpire); + gtk_entry_set_text(GTK_ENTRY(entryExpire), account_expire); + gtk_table_attach_defaults( GTK_TABLE( table ), entryExpire, 1, 2, 0, 1); + + entryResolveNameOnlyOnce = gtk_check_button_new_with_mnemonic(_("_Comply with RFC 3263")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(entryResolveNameOnlyOnce), + g_strcasecmp(resolve_once,"false") == 0 ? TRUE: FALSE); + gtk_table_attach_defaults( GTK_TABLE( table ), entryResolveNameOnlyOnce, 0, 2, 1, 2); + gtk_widget_set_sensitive( GTK_WIDGET( entryResolveNameOnlyOnce ) , TRUE ); + + gnome_main_section_new_with_table (_("Network"), &frame, &table, 2, 3); + gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER(table), 10); + + /** + * 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 ); + label = gtk_label_new_with_mnemonic (_("Local address")); + gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); + + GtkTreeIter current_local_address_iter = iter; + gchar ** iface_list = NULL; + iface_list = dbus_get_all_ip_interface(); + gchar ** iface = NULL; + + 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 ); + + current_local_address_iter = iter; + if (g_strcmp0(*iface, local_address) == 0) { + DEBUG("Setting active local address combo box"); + current_local_address_iter = iter; + } + } + } + + localAddressCombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ipInterfaceListStore)); + gtk_label_set_mnemonic_widget(GTK_LABEL(label), 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); + + + /*label = gtk_label_new_with_mnemonic (_("Local address")); + gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); + localAddressCombo = gtk_combo_box_new_text(); + gtk_label_set_mnemonic_widget (GTK_LABEL(label), localAddressCombo); + + gchar ** iface_list = NULL; + iface_list = dbus_get_all_ip_interface(); + gchar ** iface = NULL; + if (iface_list != NULL) { + for (iface = iface_list; *iface; iface++) + { + DEBUG("Interface %s", *iface); + gtk_combo_box_append_text(GTK_COMBO_BOX(localAddressCombo), *iface); + } + g_strfreev (iface_list); + } + gtk_table_attach ( GTK_TABLE( table ), localAddressCombo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);*/ + + /** + * Local port + */ + label = gtk_label_new_with_mnemonic (_("Local port")); + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); + gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); + localPortSpinBox = gtk_spin_button_new_with_range(1, 65535, 1); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), 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); + + sameAsLocalCheckBox = gtk_check_button_new_with_mnemonic(_("Published address and port same as local")); + g_signal_connect(sameAsLocalCheckBox, "toggled", G_CALLBACK(same_as_local_cb), sameAsLocalCheckBox); + gtk_table_attach_defaults(GTK_TABLE(table), sameAsLocalCheckBox, 0, 2, 2, 3); + gtk_widget_set_sensitive(GTK_WIDGET(sameAsLocalCheckBox), TRUE ); + + label = gtk_label_new_with_mnemonic (_("Published address")); + gtk_table_attach_defaults( GTK_TABLE( table ), label, 0, 1, 3, 4); + gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); + publishedAddressEntry = gtk_entry_new(); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), publishedAddressEntry); + gtk_entry_set_text(GTK_ENTRY(publishedAddressEntry), published_address); + gtk_table_attach_defaults( GTK_TABLE(table), publishedAddressEntry, 1, 2, 3, 4); + + label = gtk_label_new_with_mnemonic (_("Published port")); + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 4, 5); + gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); + publishedPortSpinBox = gtk_spin_button_new_with_range(1, 65535, 1); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), publishedPortSpinBox); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(publishedPortSpinBox), g_ascii_strtod(published_port, NULL)); + gtk_table_attach_defaults(GTK_TABLE(table), publishedPortSpinBox, 1, 2, 4, 5); + + gtk_widget_show_all(ret); + + return ret; +} + static GPtrArray * getNewCredential(GHashTable * properties) { GtkTreeIter iter; @@ -714,12 +863,17 @@ show_account_window (account_t * a) tab = create_account_tab(¤tAccount); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Basic"))); gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); - + /* Advanced */ tab = create_advanced_tab(¤tAccount); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Advanced"))); gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); - + + /* Security */ + tab = create_security_tab(¤tAccount); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Security"))); + gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); + gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook) , 0); response = gtk_dialog_run (GTK_DIALOG (dialog)); diff --git a/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml b/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml index 43dcceefd7d5c43b816f582c5890272a718aaf5f..446196946dd8191b2ce112f6ae5b574cc3207c88 100644 --- a/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml +++ b/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml @@ -388,5 +388,9 @@ <arg type="a{ss}" name="details" direction="in"/> </method> + <method name="getAllIpInterface"> + <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorString"/> + <arg type="as" name="list" direction="out"/> + </method> </interface> </node> diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index 212d9484ce3ed84387c2904ee504def8d3be4922..b73933e1da17188bf77eb0b7558922ee649c11a3 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -2157,3 +2157,28 @@ void dbus_set_tls_settings (account_t *a) g_error_free (error); } } + +gchar ** dbus_get_all_ip_interface(void) +{ + GError *error = NULL; + char ** array; + + if(!org_sflphone_SFLphone_ConfigurationManager_get_all_ip_interface ( configurationManagerProxy, &array, &error)) + { + if(error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) + { + ERROR ("Caught remote method (get_all_ip_interface) exception %s: %s", dbus_g_error_get_name(error), error->message); + } + else + { + ERROR("Error while calling get_all_ip_interface: %s", error->message); + } + g_error_free (error); + return NULL; + } + else{ + DEBUG ("DBus called get_all_ip_interface() on ConfigurationManager"); + return array; + } +} + diff --git a/sflphone-client-gnome/src/sflphone_const.h b/sflphone-client-gnome/src/sflphone_const.h index b1c1dc78ec560c281e2338a14ac237e11be2fd15..516929916cf0dff4986a8103f3af4fe78086c438 100644 --- a/sflphone-client-gnome/src/sflphone_const.h +++ b/sflphone-client-gnome/src/sflphone_const.h @@ -82,6 +82,11 @@ #define TLS_NEGOTIATION_TIMEOUT_SEC "TLS.negotiationTimeoutSec" #define TLS_NEGOTIATION_TIMEOUT_MSEC "TLS.negotiationTimemoutMsec" +#define LOCAL_PORT "Account.localPort" +#define LOCAL_ADDRESS "Account.localAddress" +#define PUBLISHED_PORT "Account.publishedPort" +#define PUBLISHED_ADDRESS "Account.publishedAddress" + /** * Global logger */ diff --git a/sflphone-common/src/dbus/configurationmanager-introspec.xml b/sflphone-common/src/dbus/configurationmanager-introspec.xml index 20700bd0bdc31734c167d6a3d26eff2a1a5b03ad..103d3568d14f22da5f936561ed89134260de5afe 100644 --- a/sflphone-common/src/dbus/configurationmanager-introspec.xml +++ b/sflphone-common/src/dbus/configurationmanager-introspec.xml @@ -389,5 +389,11 @@ <arg type="s" name="accountID" direction="in"/> <arg type="a{ss}" name="details" direction="in"/> </method> + + <method name="getAllIpInterface"> + <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorString"/> + <arg type="as" name="list" direction="out"/> + </method> + </interface> </node> diff --git a/sflphone-common/src/dbus/configurationmanager.cpp b/sflphone-common/src/dbus/configurationmanager.cpp index 10311054121ef8d28093b8ffbbe0fb9eda3e309e..9fe007627ec4ad6989ed80780858c812770fa58b 100644 --- a/sflphone-common/src/dbus/configurationmanager.cpp +++ b/sflphone-common/src/dbus/configurationmanager.cpp @@ -23,6 +23,7 @@ #include <configurationmanager.h> #include <sstream> #include "../manager.h" +#include "sip/sipvoiplink.h" const char* ConfigurationManager::SERVER_PATH = "/org/sflphone/SFLphone/ConfigurationManager"; @@ -752,3 +753,17 @@ void ConfigurationManager::setHistory (const std::map <std::string, std::string> { Manager::instance().receive_history_from_client (entries); } + +std::vector<std::string> ConfigurationManager::getAllIpInterface(void) +{ + _debug ("ConfigurationManager::getAllIpInterface received\n"); + + std::vector<std::string> vector; + SIPVoIPLink * sipLink = NULL; + sipLink = SIPVoIPLink::instance (""); + if (sipLink != NULL) { + vector = sipLink->getAllIpInterface(); + } + + return vector; +} diff --git a/sflphone-common/src/dbus/configurationmanager.h b/sflphone-common/src/dbus/configurationmanager.h index c680f5d70f25a93c85bd8dabf7e439d116de804d..6bf984f69e09c91924d67046c1867768e7583f28 100644 --- a/sflphone-common/src/dbus/configurationmanager.h +++ b/sflphone-common/src/dbus/configurationmanager.h @@ -137,7 +137,8 @@ public: std::map<std::string, std::string> getTlsSettings(const std::string& accountID); void setTlsSettings(const std::string& accountID, const std::map< std::string, std::string >& details); - + + std::vector<std::string> getAllIpInterface(void); }; diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 215f96ae7b48cfe65d9caf3a57d4c169dc67f54b..1098ae917b5dd17b437bd82ea27278e936aac643 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -46,8 +46,8 @@ #include <fstream> #include <sstream> #include <sys/types.h> // mkdir(2) -#include <sys/stat.h> // mkdir(2) -#include <pwd.h> // getpwuid +#include <sys/stat.h> // mkdir(2) +#include <pwd.h> // getpwuid #define fill_config_str(name, value) \ (_config.addConfigTreeItem(section, Conf::ConfigTreeItem(std::string(name), std::string(value), type_str))) diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp index 9558f25502f2ab30fed28acd7c8a8a2a9e5a4a7c..b9e49ab134578027a7a5665d632c450c3eaaab5c 100644 --- a/sflphone-common/src/sip/sipvoiplink.cpp +++ b/sflphone-common/src/sip/sipvoiplink.cpp @@ -3273,4 +3273,26 @@ std::string fetch_header_value (pjsip_msg *msg, std::string field) return url; } +std::vector<std::string> SIPVoIPLink::getAllIpInterface(void) +{ + pj_sockaddr addrList[16]; + unsigned int addrCnt = PJ_ARRAY_SIZE(addrList); + + pj_status_t success; + success = pj_enum_ip_interface (pj_AF_INET(), &addrCnt, addrList); + + std::vector<std::string> ifaceList; + if (success != PJ_SUCCESS) { + return ifaceList; + } + + _debug("Detecting available interfaces...\n"); + int i; + for (i = 0; i < addrCnt; i++) { + char tmpAddr[PJ_INET_ADDRSTRLEN]; + pj_sockaddr_print(&addrList[i], tmpAddr, sizeof(tmpAddr), 0); + ifaceList.push_back(std::string(tmpAddr)); + _debug("Local interface %s\n", tmpAddr); + } +} diff --git a/sflphone-common/src/sip/sipvoiplink.h b/sflphone-common/src/sip/sipvoiplink.h index 3b35f9edf014bce905d98e18cf827318782de44d..65e91ec3a37b7dfd4618b7ed16196b84544e2a07 100644 --- a/sflphone-common/src/sip/sipvoiplink.h +++ b/sflphone-common/src/sip/sipvoiplink.h @@ -300,6 +300,16 @@ class SIPVoIPLink : public VoIPLink std::string get_useragent_name (void); + /** + * List all the interfaces on the system and return + * a vector list containing their IPV4 address. + * @param void + * @return std::vector<std::string> A std::string vector + * of IPV4 address available on all of the interfaces on + * the system. + */ + std::vector<std::string> getAllIpInterface(void); + private: /** * Constructor