Reject sip call when we are already in gsm call
This commit is contained in:
parent
7a2d276162
commit
cb1ccaafec
3 changed files with 29 additions and 9 deletions
|
@ -147,6 +147,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
private boolean mAudioFocused;
|
||||
private boolean echoTesterIsRunning;
|
||||
private boolean dozeModeEnabled;
|
||||
private boolean callGsmON;
|
||||
private int mLastNetworkType=-1;
|
||||
private ConnectivityManager mConnectivityManager;
|
||||
private BroadcastReceiver mKeepAliveReceiver;
|
||||
|
@ -874,6 +875,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
|
||||
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator.setListener(this);
|
||||
callGsmON = false;
|
||||
}
|
||||
|
||||
protected void setHandsetMode(Boolean on){
|
||||
|
@ -1349,7 +1351,8 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
}
|
||||
}
|
||||
|
||||
if (state == State.IncomingReceived && (LinphonePreferences.instance().isAutoAnswerEnabled())) {
|
||||
|
||||
if (state == State.IncomingReceived && (LinphonePreferences.instance().isAutoAnswerEnabled()) && !getCallGsmON()) {
|
||||
TimerTask lTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -1804,6 +1807,14 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
return mDynamicConfigFile;
|
||||
}
|
||||
|
||||
public boolean getCallGsmON() {
|
||||
return callGsmON;
|
||||
}
|
||||
|
||||
public void setCallGsmON(boolean on) {
|
||||
callGsmON = on;
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class LinphoneConfigException extends LinphoneException {
|
||||
|
||||
|
|
|
@ -30,17 +30,26 @@ import android.telephony.TelephonyManager;
|
|||
*
|
||||
*/
|
||||
public class PhoneStateChangedReceiver extends BroadcastReceiver {
|
||||
private static int oldTimeOut;
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
final String extraState = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
|
||||
|
||||
if (TelephonyManager.EXTRA_STATE_OFFHOOK.equals(extraState)) {
|
||||
LinphoneManager.setGsmIdle(false);
|
||||
if (!LinphoneManager.isInstanciated())
|
||||
return;
|
||||
|
||||
if (TelephonyManager.EXTRA_STATE_OFFHOOK.equals(extraState)) {
|
||||
if (LinphonePreferences.instance() != null) {
|
||||
oldTimeOut = LinphoneManager.getLc().getIncomingTimeout();
|
||||
LinphoneManager.getLc().setIncomingTimeout(0);
|
||||
}
|
||||
LinphoneManager.getInstance().setCallGsmON(true);
|
||||
LinphoneManager.getLc().pauseAllCalls();
|
||||
} else if (TelephonyManager.EXTRA_STATE_IDLE.equals(extraState)) {
|
||||
LinphoneManager.setGsmIdle(true);
|
||||
if (LinphonePreferences.instance() != null)
|
||||
LinphoneManager.getLc().setIncomingTimeout(oldTimeOut);
|
||||
LinphoneManager.getInstance().setCallGsmON(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
}
|
||||
|
||||
public void closePreferenceScreen() {
|
||||
if (currentPreferenceScreen != null) {
|
||||
if (currentPreferenceScreen != null && currentPreferenceScreen.getDialog() != null) {
|
||||
currentPreferenceScreen.getDialog().dismiss();
|
||||
currentPreferenceScreen = null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue