From 1d6f6ec50cb99a793f13bc759001133ecb2e0dca Mon Sep 17 00:00:00 2001 From: zhangya Date: Thu, 25 Aug 2016 19:02:01 +0800 Subject: [PATCH 1/2] For some Samsung device, previous imp will always choose LTE network address even with wifi connected --- .../ngn/services/impl/NgnNetworkService.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) 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) { From ed77140a8cfc86569982354791840d816ef00ef2 Mon Sep 17 00:00:00 2001 From: zhangya Date: Thu, 25 Aug 2016 19:02:41 +0800 Subject: [PATCH 2/2] Fix bug when setting port number --- imsdroid/src/org/doubango/imsdroid/Screens/ScreenNatt.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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());