From 38508fa787bfef81fc927b2248981fae3efbd822 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 11 May 2012 12:08:10 +0200 Subject: [PATCH 1/6] Add option to disable secondary accounts. Useful for testing only one account without loosing the others. --- res/values/non_localizable_strings.xml | 2 ++ res/values/strings.xml | 2 ++ src/org/linphone/LinphoneManager.java | 5 ++++- .../LinphonePreferencesSIPAccountActivity.java | 10 +++++++++- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/res/values/non_localizable_strings.xml b/res/values/non_localizable_strings.xml index 24b210f40..697366fce 100644 --- a/res/values/non_localizable_strings.xml +++ b/res/values/non_localizable_strings.xml @@ -2,6 +2,8 @@ + pref_disable_account_key + pref_tunnel_key pref_tunnel_mode_key disabled diff --git a/res/values/strings.xml b/res/values/strings.xml index 6405a08a8..b91b0bdaf 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,6 +1,8 @@ + Disable + Tunnel Hostname Port diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index 3b6430508..e30111e5c 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -673,9 +673,12 @@ public final class LinphoneManager implements LinphoneCoreListener { lDefaultProxyConfig.enableRegister(true); lDefaultProxyConfig.done(); } - + // Extra accounts for (int i = 1; i < getPrefExtraAccountsNumber(); i++) { + if (getPrefBoolean(getString(R.string.pref_disable_account_key) + i, false)) { + continue; + } lUserName = getPrefString(getString(R.string.pref_username_key) + i, null); lPasswd = getPrefString(getString(R.string.pref_passwd_key) + i, null); if (lUserName != null && lUserName.length() > 0) { diff --git a/src/org/linphone/LinphonePreferencesSIPAccountActivity.java b/src/org/linphone/LinphonePreferencesSIPAccountActivity.java index 551e2ba4c..96f37b9ac 100644 --- a/src/org/linphone/LinphonePreferencesSIPAccountActivity.java +++ b/src/org/linphone/LinphonePreferencesSIPAccountActivity.java @@ -77,7 +77,12 @@ public class LinphonePreferencesSIPAccountActivity extends PreferenceActivity { outboundProxy.setTitle(getString(R.string.pref_enable_outbound_proxy)); outboundProxy.setPersistent(true); outboundProxy.setKey(getString(R.string.pref_enable_outbound_proxy_key) + getAccountNumber(n)); - + + CheckBoxPreference disable = new CheckBoxPreference(this); + disable.setTitle(getString(R.string.pref_disable_account)); + disable.setPersistent(true); + disable.setKey(getString(R.string.pref_disable_account_key) + getAccountNumber(n)); + final Preference delete = new Preference(this); delete.setTitle("Delete this account"); delete.setOnPreferenceClickListener(new OnPreferenceClickListener() { @@ -91,6 +96,7 @@ public class LinphonePreferencesSIPAccountActivity extends PreferenceActivity { editor.putString(getString(R.string.pref_domain_key) + i, prefs.getString(getString(R.string.pref_domain_key) + (i+1), null)); editor.putString(getString(R.string.pref_proxy_key) + i, prefs.getString(getString(R.string.pref_proxy_key) + (i+1), null)); editor.putBoolean(getString(R.string.pref_enable_outbound_proxy_key) + i, prefs.getBoolean(getString(R.string.pref_enable_outbound_proxy_key) + (i+1), false)); + editor.putBoolean(getString(R.string.pref_disable_account_key) + i, prefs.getBoolean(getString(R.string.pref_disable_account_key) + (i+1), false)); } int lastAccount = nbAccounts - 1; @@ -99,6 +105,7 @@ public class LinphonePreferencesSIPAccountActivity extends PreferenceActivity { editor.putString(getString(R.string.pref_domain_key) + lastAccount, null); editor.putString(getString(R.string.pref_proxy_key) + lastAccount, null); editor.putBoolean(getString(R.string.pref_enable_outbound_proxy_key) + lastAccount, false); + editor.putBoolean(getString(R.string.pref_disable_account_key) + lastAccount, false); int defaultAccount = prefs.getInt(getString(R.string.pref_default_account), 0); if (defaultAccount > n) { @@ -138,6 +145,7 @@ public class LinphonePreferencesSIPAccountActivity extends PreferenceActivity { category.addPreference(domain); category.addPreference(proxy); category.addPreference(outboundProxy); + category.addPreference(disable); category.addPreference(mainAccount); category.addPreference(delete); } From f2680e14c507aa8d3ebb41de9de261b53123699b Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 11 May 2012 12:09:07 +0200 Subject: [PATCH 2/6] Fix socket creation for multi-ip hosts (TCP/TLS). --- submodules/externals/build/exosip/Android.mk | 2 ++ submodules/externals/exosip | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/submodules/externals/build/exosip/Android.mk b/submodules/externals/build/exosip/Android.mk index 979de4b82..70639065f 100755 --- a/submodules/externals/build/exosip/Android.mk +++ b/submodules/externals/build/exosip/Android.mk @@ -57,6 +57,8 @@ LOCAL_CFLAGS += \ -include $(LOCAL_PATH)/../build/exosip/libeXosip2_AndroidConfig.h \ -DOSIP_MT \ -DENABLE_TRACE \ + -DSOCKET_TIMEOUT=50 \ + -DSOCKET_PROGRESS_TIMEOUT=300 \ -include $(LOCAL_PATH)/include/eXosip2/eXosip_transport_hook.h diff --git a/submodules/externals/exosip b/submodules/externals/exosip index b3e55a3c9..41a93903b 160000 --- a/submodules/externals/exosip +++ b/submodules/externals/exosip @@ -1 +1 @@ -Subproject commit b3e55a3c93b39af43666acec45191b41f2016fa0 +Subproject commit 41a93903b96ec4466f5efa9e9f887a1cce92648a From bed062116839c813bbb6c928a37b26522c1d93e9 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 11 May 2012 14:23:25 +0200 Subject: [PATCH 3/6] Better back button handle + no more dtmf send using add call dialer --- src/org/linphone/DialerActivity.java | 8 ++++++++ src/org/linphone/VideoCallActivity.java | 3 ++- src/org/linphone/ui/Digit.java | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/org/linphone/DialerActivity.java b/src/org/linphone/DialerActivity.java index 9fa7d418d..f72396dbe 100644 --- a/src/org/linphone/DialerActivity.java +++ b/src/org/linphone/DialerActivity.java @@ -84,6 +84,7 @@ public class DialerActivity extends Activity implements LinphoneGuiListener { private LinearLayout mInCallControls; private static DialerActivity instance; + public boolean mVisible; private boolean mPreventDoubleCallOnRotation; private AlertDialog wizardDialog; @@ -359,6 +360,7 @@ public class DialerActivity extends Activity implements LinphoneGuiListener { @Override protected void onPause() { super.onPause(); + mVisible = false; if (mCamera != null) { mCamera.release(); @@ -502,6 +504,7 @@ public class DialerActivity extends Activity implements LinphoneGuiListener { // and set to the to be destroyed Dialer. // Note1: We wait as long as possible before setting the last message. // Note2: Linphone service is in charge of instantiating LinphoneManager + mVisible = true; mStatus.setText(LinphoneManager.getInstance().getLastLcStatusMessage()); super.onResume(); @@ -534,6 +537,11 @@ public class DialerActivity extends Activity implements LinphoneGuiListener { @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (LinphoneUtils.onKeyVolumeSoftAdjust(keyCode)) return true; + if (keyCode == KeyEvent.KEYCODE_BACK && LinphoneManager.getLc().isIncall()) { + // If we are in call on dialer, we go back to the incall view + LinphoneActivity.instance().startIncallActivity(); + return true; + } return super.onKeyDown(keyCode, event); } } diff --git a/src/org/linphone/VideoCallActivity.java b/src/org/linphone/VideoCallActivity.java index 42bd32e4d..780ec212b 100755 --- a/src/org/linphone/VideoCallActivity.java +++ b/src/org/linphone/VideoCallActivity.java @@ -480,7 +480,8 @@ public class VideoCallActivity extends Activity implements params.setMargins(0, 0, 15, 15); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); - mVideoCaptureViewReady.setLayoutParams(params); + if (mVideoViewReady != null) + mVideoCaptureViewReady.setLayoutParams(params); } public void onConfigurationChanged(Configuration newConfig) { diff --git a/src/org/linphone/ui/Digit.java b/src/org/linphone/ui/Digit.java index 050a67d53..83e74661a 100644 --- a/src/org/linphone/ui/Digit.java +++ b/src/org/linphone/ui/Digit.java @@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.linphone.ui; +import org.linphone.DialerActivity; import org.linphone.LinphoneManager; import org.linphone.LinphoneService; import org.linphone.R; @@ -103,9 +104,8 @@ public class Digit extends Button implements AddressAware { LinphoneCore lc = LinphoneManager.getLc(); lc.stopDtmf(); mIsDtmfStarted =false; - if (lc.isIncall()) { + if (lc.isIncall() && !DialerActivity.instance().mVisible) { lc.sendDtmf(mKeyCode.charAt(0)); -// return; } } From b3798a436cd4bd7ae384b050aca3c4b24f0e8314 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 11 May 2012 14:30:16 +0200 Subject: [PATCH 4/6] Allow call to self. --- res/values/non_localizable_custom.xml | 1 + src/org/linphone/LinphoneManager.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/res/values/non_localizable_custom.xml b/res/values/non_localizable_custom.xml index ccdb0d649..6348fca37 100644 --- a/res/values/non_localizable_custom.xml +++ b/res/values/non_localizable_custom.xml @@ -17,6 +17,7 @@ true #191970 + false linphone-android@belledonne-communications.com diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index e30111e5c..62a70f2a0 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -314,7 +314,7 @@ public final class LinphoneManager implements LinphoneCoreListener { LinphoneAddress lAddress; try { lAddress = mLc.interpretUrl(to); - if (mLc.isMyself(lAddress.asStringUriOnly())) { + if (mR.getBoolean(R.bool.forbid_self_call) && mLc.isMyself(lAddress.asStringUriOnly())) { mListenerDispatcher.tryingNewOutgoingCallButWrongDestinationAddress(); return; } From 3da20210bae5af545f5ca382da75dc76ad154839 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 11 May 2012 15:20:04 +0200 Subject: [PATCH 5/6] Fix back and incall controls if call is paused --- src/org/linphone/DialerActivity.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/org/linphone/DialerActivity.java b/src/org/linphone/DialerActivity.java index f72396dbe..afec78cbe 100644 --- a/src/org/linphone/DialerActivity.java +++ b/src/org/linphone/DialerActivity.java @@ -516,13 +516,14 @@ public class DialerActivity extends Activity implements LinphoneGuiListener { if (AndroidCameraConfiguration.hasSeveralCameras() && mSwitchCamera != null) mSwitchCamera.setVisibility(View.VISIBLE); - if (mVideoCaptureView != null && mCamera == null && !LinphoneManager.getLc().isIncall()) - { + boolean isInCall = LinphoneManager.getLc().isIncall(); + isInCall = isInCall || LinphoneManager.getLc().getCallsNb() > 0; + + if (mVideoCaptureView != null && mCamera == null && !LinphoneManager.getLc().isIncall()) { mCamera = Camera.open(mCurrentCameraId); mVideoCaptureView.switchCamera(mCamera, mCurrentCameraId); mCamera.startPreview(); - } else if (LinphoneManager.getLc().isIncall()) - { + } else if (isInCall) { if (mInCallControls != null) { mInCallControls.setVisibility(View.VISIBLE); mCall.setVisibility(View.GONE); @@ -537,7 +538,9 @@ public class DialerActivity extends Activity implements LinphoneGuiListener { @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (LinphoneUtils.onKeyVolumeSoftAdjust(keyCode)) return true; - if (keyCode == KeyEvent.KEYCODE_BACK && LinphoneManager.getLc().isIncall()) { + boolean isInCall = LinphoneManager.getLc().isIncall(); + isInCall = isInCall || LinphoneManager.getLc().getCallsNb() > 0; + if (keyCode == KeyEvent.KEYCODE_BACK && isInCall) { // If we are in call on dialer, we go back to the incall view LinphoneActivity.instance().startIncallActivity(); return true; From 3fc1447ce686750addcbb2ba93e76fd75effa529 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 11 May 2012 15:23:29 +0200 Subject: [PATCH 6/6] Fix nullpointerexception if cancel addcall while another call is in pause --- src/org/linphone/DialerActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/linphone/DialerActivity.java b/src/org/linphone/DialerActivity.java index afec78cbe..7b3f145a6 100644 --- a/src/org/linphone/DialerActivity.java +++ b/src/org/linphone/DialerActivity.java @@ -227,7 +227,7 @@ public class DialerActivity extends Activity implements LinphoneGuiListener { mBack.setOnClickListener(new OnClickListener() { public void onClick(View v) { LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); - if (call.getCurrentParamsCopy().getVideoEnabled()) + if (call != null && call.getCurrentParamsCopy().getVideoEnabled()) LinphoneActivity.instance().startVideoActivity(call, 0); else LinphoneActivity.instance().startIncallActivity();