diff --git a/android-ngn-stack/src/org/doubango/ngn/services/impl/NgnNetworkService.java b/android-ngn-stack/src/org/doubango/ngn/services/impl/NgnNetworkService.java index e274560..818749c 100644 --- a/android-ngn-stack/src/org/doubango/ngn/services/impl/NgnNetworkService.java +++ b/android-ngn-stack/src/org/doubango/ngn/services/impl/NgnNetworkService.java @@ -235,14 +235,28 @@ public String getLocalIP(boolean ipv6) { final Iterator> it = addressMap.entrySet().iterator(); Map.Entry kvp; + String host = null; while (it.hasNext()) { kvp = it.next(); final InetAddress address = kvp.getValue(); - if(kvp.getKey().equals(USB_INTERFACE_NAME)){ - continue; - } - return address.getHostAddress(); + final String interfaceName = kvp.getKey(); + + if(kvp.getKey().equals(USB_INTERFACE_NAME)){ + continue; + } + if(interfaceName.startsWith("wlan")) { + return address.getHostAddress(); + } else { + host = address.getHostAddress(); + } + +// if(kvp.getKey().equals(USB_INTERFACE_NAME)){ +// continue; +// } +// return address.getHostAddress(); } + if(host != null) + return host; return addressMap.values().iterator().next().getHostAddress(); } } catch (SocketException ex) { diff --git a/imsdroid/src/org/doubango/imsdroid/Screens/ScreenNatt.java b/imsdroid/src/org/doubango/imsdroid/Screens/ScreenNatt.java index ccae5b3..2a6ed6a 100644 --- a/imsdroid/src/org/doubango/imsdroid/Screens/ScreenNatt.java +++ b/imsdroid/src/org/doubango/imsdroid/Screens/ScreenNatt.java @@ -120,7 +120,11 @@ protected void onPause() { mConfigurationService.putBoolean(NgnConfigurationEntry.NATT_USE_ICE, mCbEnableIce.isChecked()); mConfigurationService.putBoolean(NgnConfigurationEntry.NATT_STUN_DISCO, mRbDiscoStun.isChecked()); mConfigurationService.putString(NgnConfigurationEntry.NATT_STUN_SERVER, mEtStunStunHostname.getText().toString()); - mConfigurationService.putString(NgnConfigurationEntry.NATT_STUN_PORT, mEtStunPort.getText().toString()); + try { + mConfigurationService.putInt(NgnConfigurationEntry.NATT_STUN_PORT, Integer.parseInt(mEtStunPort.getText().toString())); + } catch(NumberFormatException e) { + Log.e(TAG, "stun port must be an integer"); + } mConfigurationService.putString(NgnConfigurationEntry.NATT_STUN_USERNAME, mEtStunUsername.getText().toString()); mConfigurationService.putString(NgnConfigurationEntry.NATT_STUN_PASSWORD, mEtStunPassword.getText().toString());