Merge branch 'master' into dev_phonenumber
Conflicts: submodules/linphone
This commit is contained in:
commit
3d845d8ee2
13 changed files with 153 additions and 96 deletions
|
@ -206,4 +206,6 @@
|
||||||
<string name="pref_device_ringtone_key">pref_device_ringtone_key</string>
|
<string name="pref_device_ringtone_key">pref_device_ringtone_key</string>
|
||||||
<string name="pref_auto_answer_key">pref_auto_answer_key</string>
|
<string name="pref_auto_answer_key">pref_auto_answer_key</string>
|
||||||
<string name="pref_android_app_settings_key">pref_android_app_settings_key</string>
|
<string name="pref_android_app_settings_key">pref_android_app_settings_key</string>
|
||||||
|
<string name="pref_turn_username_key">pref_turn_username_key</string>
|
||||||
|
<string name="pref_turn_passwd_key">pref_turn_passwd_key</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -331,9 +331,11 @@
|
||||||
<!-- Network settings -->
|
<!-- Network settings -->
|
||||||
<string name="pref_network_title">Network</string>
|
<string name="pref_network_title">Network</string>
|
||||||
<string name="pref_wifi_only">Use WiFi only</string>
|
<string name="pref_wifi_only">Use WiFi only</string>
|
||||||
<string name="pref_stun_server">Stun server</string>
|
<string name="pref_stun_server">STUN server</string>
|
||||||
<string name="pref_ice_enable">Enable ICE</string>
|
<string name="pref_ice_enable">Enable ICE</string>
|
||||||
<string name="pref_turn_enable">Enable TURN</string>
|
<string name="pref_turn_enable">Enable TURN</string>
|
||||||
|
<string name="pref_turn_username_title">STUN / TURN username (optional)</string>
|
||||||
|
<string name="pref_turn_passwd_title">STUN / TURN password (optional)</string>
|
||||||
<string name="pref_upnp_enable">Enable UPNP</string>
|
<string name="pref_upnp_enable">Enable UPNP</string>
|
||||||
<string name="pref_transport_use_random_ports">Use random ports</string>
|
<string name="pref_transport_use_random_ports">Use random ports</string>
|
||||||
<string name="pref_sip_port_title">SIP port to use</string>
|
<string name="pref_sip_port_title">SIP port to use</string>
|
||||||
|
|
|
@ -263,6 +263,18 @@
|
||||||
android:title="@string/pref_turn_enable"
|
android:title="@string/pref_turn_enable"
|
||||||
android:key="@string/pref_turn_enable_key"
|
android:key="@string/pref_turn_enable_key"
|
||||||
android:persistent="false"/>
|
android:persistent="false"/>
|
||||||
|
|
||||||
|
<EditTextPreference
|
||||||
|
android:key="@string/pref_turn_username_key"
|
||||||
|
android:title="@string/pref_turn_username_title"
|
||||||
|
android:inputType="text|textNoSuggestions"
|
||||||
|
android:persistent="false"/>
|
||||||
|
|
||||||
|
<EditTextPreference
|
||||||
|
android:key="@string/pref_turn_passwd_key"
|
||||||
|
android:title="@string/pref_turn_passwd_title"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:persistent="false"/>
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:title="@string/pref_upnp_enable"
|
android:title="@string/pref_upnp_enable"
|
||||||
|
|
|
@ -300,7 +300,6 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve
|
||||||
|
|
||||||
callFragment.setArguments(getIntent().getExtras());
|
callFragment.setArguments(getIntent().getExtras());
|
||||||
getFragmentManager().beginTransaction().add(R.id.fragmentContainer, callFragment).commitAllowingStateLoss();
|
getFragmentManager().beginTransaction().add(R.id.fragmentContainer, callFragment).commitAllowingStateLoss();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,12 +305,8 @@ public class CallIncomingActivity extends Activity implements LinphoneSliderTrig
|
||||||
if (!LinphoneActivity.isInstanciated()) {
|
if (!LinphoneActivity.isInstanciated()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final LinphoneCallParams remoteParams = mCall.getRemoteParams();
|
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||||
if (remoteParams != null && remoteParams.getVideoEnabled() && LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests()) {
|
LinphoneActivity.instance().startIncallActivity(mCall);
|
||||||
LinphoneActivity.instance().startVideoActivity(mCall);
|
|
||||||
} else {
|
|
||||||
LinphoneActivity.instance().startIncallActivity(mCall);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,12 +101,7 @@ public class CallOutgoingActivity extends Activity implements OnClickListener{
|
||||||
if (!LinphoneActivity.isInstanciated()) {
|
if (!LinphoneActivity.isInstanciated()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final LinphoneCallParams remoteParams = mCall.getRemoteParams();
|
LinphoneActivity.instance().startIncallActivity(mCall);
|
||||||
if (remoteParams != null && remoteParams.getVideoEnabled() && LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests()) {
|
|
||||||
LinphoneActivity.instance().startVideoActivity(mCall);
|
|
||||||
} else {
|
|
||||||
LinphoneActivity.instance().startIncallActivity(mCall);
|
|
||||||
}
|
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
} else if (state == State.Error) {
|
} else if (state == State.Error) {
|
||||||
|
|
|
@ -960,16 +960,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
LinphoneManager.getInstance().newOutgoingCall(address);
|
LinphoneManager.getInstance().newOutgoingCall(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startVideoActivity(LinphoneCall currentCall) {
|
|
||||||
Intent intent = new Intent(this, CallActivity.class);
|
|
||||||
intent.putExtra("VideoEnabled", true);
|
|
||||||
startOrientationSensor();
|
|
||||||
startActivityForResult(intent, CALL_ACTIVITY);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void startIncallActivity(LinphoneCall currentCall) {
|
public void startIncallActivity(LinphoneCall currentCall) {
|
||||||
Intent intent = new Intent(this, CallActivity.class);
|
Intent intent = new Intent(this, CallActivity.class);
|
||||||
intent.putExtra("VideoEnabled", false);
|
|
||||||
startOrientationSensor();
|
startOrientationSensor();
|
||||||
startActivityForResult(intent, CALL_ACTIVITY);
|
startActivityForResult(intent, CALL_ACTIVITY);
|
||||||
}
|
}
|
||||||
|
@ -1041,8 +1033,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
|
LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
|
||||||
if (call.getState() == LinphoneCall.State.IncomingReceived) {
|
if (call.getState() == LinphoneCall.State.IncomingReceived) {
|
||||||
startActivity(new Intent(LinphoneActivity.this, CallIncomingActivity.class));
|
startActivity(new Intent(LinphoneActivity.this, CallIncomingActivity.class));
|
||||||
} else if (call.getCurrentParamsCopy().getVideoEnabled()) {
|
|
||||||
startVideoActivity(call);
|
|
||||||
} else {
|
} else {
|
||||||
startIncallActivity(call);
|
startIncallActivity(call);
|
||||||
}
|
}
|
||||||
|
@ -1365,11 +1355,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
} else if (callState == State.OutgoingInit || callState == State.OutgoingProgress || callState == State.OutgoingRinging) {
|
} else if (callState == State.OutgoingInit || callState == State.OutgoingProgress || callState == State.OutgoingRinging) {
|
||||||
startActivity(new Intent(this, CallOutgoingActivity.class));
|
startActivity(new Intent(this, CallOutgoingActivity.class));
|
||||||
} else {
|
} else {
|
||||||
if (call.getCurrentParamsCopy().getVideoEnabled()) {
|
startIncallActivity(call);
|
||||||
startVideoActivity(call);
|
|
||||||
} else {
|
|
||||||
startIncallActivity(call);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1419,11 +1405,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
} else if (extras != null && extras.getBoolean("Notification", false)) {
|
} else if (extras != null && extras.getBoolean("Notification", false)) {
|
||||||
if (LinphoneManager.getLc().getCallsNb() > 0) {
|
if (LinphoneManager.getLc().getCallsNb() > 0) {
|
||||||
LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
|
LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
|
||||||
if (call.getCurrentParamsCopy().getVideoEnabled()) {
|
startIncallActivity(call);
|
||||||
startVideoActivity(call);
|
|
||||||
} else {
|
|
||||||
startIncallActivity(call);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DialerFragment dialerFragment = DialerFragment.instance();
|
DialerFragment dialerFragment = DialerFragment.instance();
|
||||||
|
|
|
@ -66,6 +66,7 @@ import org.linphone.core.PublishState;
|
||||||
import org.linphone.core.SubscriptionState;
|
import org.linphone.core.SubscriptionState;
|
||||||
import org.linphone.core.TunnelConfig;
|
import org.linphone.core.TunnelConfig;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
|
import org.linphone.mediastream.MediastreamerAndroidContext;
|
||||||
import org.linphone.mediastream.Version;
|
import org.linphone.mediastream.Version;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration.AndroidCamera;
|
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration.AndroidCamera;
|
||||||
|
@ -139,6 +140,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
private static List<LinphoneChatMessage> mPendingChatFileMessage;
|
private static List<LinphoneChatMessage> mPendingChatFileMessage;
|
||||||
private static LinphoneChatMessage mUploadPendingFileMessage;
|
private static LinphoneChatMessage mUploadPendingFileMessage;
|
||||||
|
|
||||||
|
|
||||||
public String wizardLoginViewDomain = null;
|
public String wizardLoginViewDomain = null;
|
||||||
|
|
||||||
private static List<LinphoneChatMessage.LinphoneChatMessageListener> simpleListeners = new ArrayList<LinphoneChatMessage.LinphoneChatMessageListener>();
|
private static List<LinphoneChatMessage.LinphoneChatMessageListener> simpleListeners = new ArrayList<LinphoneChatMessage.LinphoneChatMessageListener>();
|
||||||
|
@ -1069,6 +1071,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
else if (state == State.IncomingReceived || (state == State.CallIncomingEarlyMedia && mR.getBoolean(R.bool.allow_ringing_while_early_media))) {
|
else if (state == State.IncomingReceived || (state == State.CallIncomingEarlyMedia && mR.getBoolean(R.bool.allow_ringing_while_early_media))) {
|
||||||
// Brighten screen for at least 10 seconds
|
// Brighten screen for at least 10 seconds
|
||||||
if (mLc.getCallsNb() == 1) {
|
if (mLc.getCallsNb() == 1) {
|
||||||
|
requestAudioFocus(STREAM_RING);
|
||||||
BluetoothManager.getInstance().disableBluetoothSCO(); // Just in case
|
BluetoothManager.getInstance().disableBluetoothSCO(); // Just in case
|
||||||
|
|
||||||
ringingCall = call;
|
ringingCall = call;
|
||||||
|
@ -1082,8 +1085,8 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
|
|
||||||
if (state == State.Connected) {
|
if (state == State.Connected) {
|
||||||
if (mLc.getCallsNb() == 1) {
|
if (mLc.getCallsNb() == 1) {
|
||||||
requestAudioFocus();
|
mAudioManager.abandonAudioFocus(null);
|
||||||
setAudioManagerInCallMode();
|
requestAudioFocus(STREAM_VOICE_CALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Hacks.needSoftvolume()) {
|
if (Hacks.needSoftvolume()) {
|
||||||
|
@ -1096,15 +1099,14 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
setAudioManagerInCallMode();
|
setAudioManagerInCallMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == State.CallReleased || state == State.Error) {
|
if (state == State.CallEnd || state == State.Error) {
|
||||||
if (mLc.getCallsNb() == 0) {
|
if (mLc.getCallsNb() == 0) {
|
||||||
|
Context activity = getContext();
|
||||||
if (mAudioFocused){
|
if (mAudioFocused){
|
||||||
int res = mAudioManager.abandonAudioFocus(null);
|
int res = mAudioManager.abandonAudioFocus(null);
|
||||||
Log.d("Audio focus released a bit later: " + (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED ? "Granted" : "Denied"));
|
Log.d("Audio focus released a bit later: " + (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED ? "Granted" : "Denied"));
|
||||||
mAudioFocused = false;
|
mAudioFocused = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Context activity = getContext();
|
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
|
TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
if (tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) {
|
if (tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) {
|
||||||
|
@ -1116,17 +1118,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == State.CallEnd) {
|
|
||||||
if (mLc.getCallsNb() == 0) {
|
|
||||||
if (mIncallWakeLock != null && mIncallWakeLock.isHeld()) {
|
|
||||||
mIncallWakeLock.release();
|
|
||||||
Log.i("Last call ended: releasing incall (CPU only) wake lock");
|
|
||||||
} else {
|
|
||||||
Log.i("Last call ended: no incall (CPU only) wake lock were held");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (state == State.CallUpdatedByRemote) {
|
if (state == State.CallUpdatedByRemote) {
|
||||||
// If the correspondent proposes video while audio call
|
// If the correspondent proposes video while audio call
|
||||||
boolean remoteVideo = call.getRemoteParams().getVideoEnabled();
|
boolean remoteVideo = call.getRemoteParams().getVideoEnabled();
|
||||||
|
@ -1140,6 +1131,10 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (state == State.OutgoingInit) {
|
||||||
|
setAudioManagerInCallMode();
|
||||||
|
requestAudioFocus(STREAM_VOICE_CALL);
|
||||||
|
}
|
||||||
|
|
||||||
if (state == State.StreamsRunning) {
|
if (state == State.StreamsRunning) {
|
||||||
if (BluetoothManager.getInstance().isBluetoothHeadsetAvailable()) {
|
if (BluetoothManager.getInstance().isBluetoothHeadsetAvailable()) {
|
||||||
|
@ -1175,6 +1170,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
routeAudioToSpeaker();
|
routeAudioToSpeaker();
|
||||||
setAudioManagerInCallMode();
|
setAudioManagerInCallMode();
|
||||||
Log.i("Set audio mode on 'Voice Communication'");
|
Log.i("Set audio mode on 'Voice Communication'");
|
||||||
|
requestAudioFocus(STREAM_VOICE_CALL);
|
||||||
int oldVolume = mAudioManager.getStreamVolume(STREAM_VOICE_CALL);
|
int oldVolume = mAudioManager.getStreamVolume(STREAM_VOICE_CALL);
|
||||||
int maxVolume = mAudioManager.getStreamMaxVolume(STREAM_VOICE_CALL);
|
int maxVolume = mAudioManager.getStreamMaxVolume(STREAM_VOICE_CALL);
|
||||||
mAudioManager.setStreamVolume(STREAM_VOICE_CALL, maxVolume, 0);
|
mAudioManager.setStreamVolume(STREAM_VOICE_CALL, maxVolume, 0);
|
||||||
|
@ -1186,6 +1182,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
routeAudioToSpeaker();
|
routeAudioToSpeaker();
|
||||||
setAudioManagerInCallMode();
|
setAudioManagerInCallMode();
|
||||||
Log.i("Set audio mode on 'Voice Communication'");
|
Log.i("Set audio mode on 'Voice Communication'");
|
||||||
|
requestAudioFocus(STREAM_VOICE_CALL);
|
||||||
int oldVolume = mAudioManager.getStreamVolume(STREAM_VOICE_CALL);
|
int oldVolume = mAudioManager.getStreamVolume(STREAM_VOICE_CALL);
|
||||||
int maxVolume = mAudioManager.getStreamMaxVolume(STREAM_VOICE_CALL);
|
int maxVolume = mAudioManager.getStreamMaxVolume(STREAM_VOICE_CALL);
|
||||||
int sampleRate = 44100;
|
int sampleRate = 44100;
|
||||||
|
@ -1222,9 +1219,9 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
|
|
||||||
private boolean isRinging;
|
private boolean isRinging;
|
||||||
|
|
||||||
private void requestAudioFocus(){
|
private void requestAudioFocus(int stream){
|
||||||
if (!mAudioFocused){
|
if (!mAudioFocused){
|
||||||
int res = mAudioManager.requestAudioFocus(null, AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT );
|
int res = mAudioManager.requestAudioFocus(null, stream, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT );
|
||||||
Log.d("Audio focus requested: " + (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED ? "Granted" : "Denied"));
|
Log.d("Audio focus requested: " + (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED ? "Granted" : "Denied"));
|
||||||
if (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) mAudioFocused=true;
|
if (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) mAudioFocused=true;
|
||||||
}
|
}
|
||||||
|
@ -1259,7 +1256,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
mVibrator.vibrate(patern, 1);
|
mVibrator.vibrate(patern, 1);
|
||||||
}
|
}
|
||||||
if (mRingerPlayer == null) {
|
if (mRingerPlayer == null) {
|
||||||
requestAudioFocus();
|
requestAudioFocus(STREAM_RING);
|
||||||
mRingerPlayer = new MediaPlayer();
|
mRingerPlayer = new MediaPlayer();
|
||||||
mRingerPlayer.setAudioStreamType(STREAM_RING);
|
mRingerPlayer.setAudioStreamType(STREAM_RING);
|
||||||
|
|
||||||
|
@ -1528,6 +1525,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,
|
public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,
|
||||||
int delay_ms, Object data) {
|
int delay_ms, Object data) {
|
||||||
((AudioManager)getContext().getSystemService(Context.AUDIO_SERVICE)).setMode(AudioManager.MODE_NORMAL);
|
((AudioManager)getContext().getSystemService(Context.AUDIO_SERVICE)).setMode(AudioManager.MODE_NORMAL);
|
||||||
|
mAudioManager.abandonAudioFocus(null);
|
||||||
Log.i("Set audio mode on 'Normal'");
|
Log.i("Set audio mode on 'Normal'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -935,46 +935,6 @@ public class LinphonePreferences {
|
||||||
public boolean isWifiOnlyEnabled() {
|
public boolean isWifiOnlyEnabled() {
|
||||||
return getConfig().getBool("app", "wifi_only", false);
|
return getConfig().getBool("app", "wifi_only", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LinphoneNatPolicy getOrCreateNatPolicy() {
|
|
||||||
LinphoneNatPolicy nat = getLc().getNatPolicy();
|
|
||||||
if (nat == null) {
|
|
||||||
nat = getLc().createNatPolicy();
|
|
||||||
}
|
|
||||||
return nat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStunServer() {
|
|
||||||
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
|
||||||
return nat.getStunServer();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStunServer(String stun) {
|
|
||||||
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
|
||||||
nat.setStunServer(stun);
|
|
||||||
if (stun != null && !stun.isEmpty()) {
|
|
||||||
nat.enableStun(true);
|
|
||||||
}
|
|
||||||
getLc().setNatPolicy(nat);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIceEnabled(boolean enabled) {
|
|
||||||
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
|
||||||
nat.enableIce(enabled);
|
|
||||||
getLc().setNatPolicy(nat);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTurnEnabled(boolean enabled) {
|
|
||||||
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
|
||||||
nat.enableTurn(enabled);
|
|
||||||
getLc().setNatPolicy(nat);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpnpEnabled(boolean enabled) {
|
|
||||||
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
|
||||||
nat.enableUpnp(enabled);
|
|
||||||
getLc().setNatPolicy(nat);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void useRandomPort(boolean enabled) {
|
public void useRandomPort(boolean enabled) {
|
||||||
useRandomPort(enabled, true);
|
useRandomPort(enabled, true);
|
||||||
|
@ -1012,6 +972,47 @@ public class LinphonePreferences {
|
||||||
transports.tls = LINPHONE_CORE_RANDOM_PORT;
|
transports.tls = LINPHONE_CORE_RANDOM_PORT;
|
||||||
getLc().setSignalingTransportPorts(transports);
|
getLc().setSignalingTransportPorts(transports);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private LinphoneNatPolicy getOrCreateNatPolicy() {
|
||||||
|
LinphoneNatPolicy nat = getLc().getNatPolicy();
|
||||||
|
if (nat == null) {
|
||||||
|
nat = getLc().createNatPolicy();
|
||||||
|
}
|
||||||
|
return nat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStunServer() {
|
||||||
|
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
||||||
|
return nat.getStunServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStunServer(String stun) {
|
||||||
|
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
||||||
|
nat.setStunServer(stun);
|
||||||
|
|
||||||
|
if (stun != null && !stun.isEmpty()) {
|
||||||
|
nat.enableStun(true);
|
||||||
|
}
|
||||||
|
getLc().setNatPolicy(nat);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIceEnabled(boolean enabled) {
|
||||||
|
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
||||||
|
nat.enableIce(enabled);
|
||||||
|
getLc().setNatPolicy(nat);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTurnEnabled(boolean enabled) {
|
||||||
|
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
||||||
|
nat.enableTurn(enabled);
|
||||||
|
getLc().setNatPolicy(nat);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpnpEnabled(boolean enabled) {
|
||||||
|
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
||||||
|
nat.enableUpnp(enabled);
|
||||||
|
getLc().setNatPolicy(nat);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isUpnpEnabled() {
|
public boolean isUpnpEnabled() {
|
||||||
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
||||||
|
@ -1027,6 +1028,44 @@ public class LinphonePreferences {
|
||||||
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
||||||
return nat.turnEnabled();
|
return nat.turnEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTurnUsername() {
|
||||||
|
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
||||||
|
return nat.getStunServerUsername();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTurnUsername(String username) {
|
||||||
|
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
||||||
|
LinphoneAuthInfo authInfo = getLc().findAuthInfo(nat.getStunServerUsername(), null, null);
|
||||||
|
|
||||||
|
if (authInfo != null) {
|
||||||
|
LinphoneAuthInfo cloneAuthInfo = authInfo.clone();
|
||||||
|
getLc().removeAuthInfo(authInfo);
|
||||||
|
cloneAuthInfo.setUsername(username);
|
||||||
|
cloneAuthInfo.setUserId(username);
|
||||||
|
getLc().addAuthInfo(cloneAuthInfo);
|
||||||
|
} else {
|
||||||
|
authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, username, null, null, null, null);
|
||||||
|
getLc().addAuthInfo(authInfo);
|
||||||
|
}
|
||||||
|
nat.setStunServerUsername(username);
|
||||||
|
getLc().setNatPolicy(nat);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTurnPassword(String password) {
|
||||||
|
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
||||||
|
LinphoneAuthInfo authInfo = getLc().findAuthInfo(nat.getStunServerUsername(), null, null);
|
||||||
|
|
||||||
|
if (authInfo != null) {
|
||||||
|
LinphoneAuthInfo cloneAuthInfo = authInfo.clone();
|
||||||
|
getLc().removeAuthInfo(authInfo);
|
||||||
|
cloneAuthInfo.setPassword(password);
|
||||||
|
getLc().addAuthInfo(cloneAuthInfo);
|
||||||
|
} else {
|
||||||
|
authInfo = LinphoneCoreFactory.instance().createAuthInfo(nat.getStunServerUsername(), nat.getStunServerUsername(), password, null, null, null);
|
||||||
|
getLc().addAuthInfo(authInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public MediaEncryption getMediaEncryption() {
|
public MediaEncryption getMediaEncryption() {
|
||||||
return getLc().getMediaEncryption();
|
return getLc().getMediaEncryption();
|
||||||
|
|
|
@ -1014,7 +1014,15 @@ public class SettingsFragment extends PreferencesListFragment {
|
||||||
CheckBoxPreference ice = (CheckBoxPreference) findPreference(getString(R.string.pref_ice_enable_key));
|
CheckBoxPreference ice = (CheckBoxPreference) findPreference(getString(R.string.pref_ice_enable_key));
|
||||||
CheckBoxPreference turn = (CheckBoxPreference) findPreference(getString(R.string.pref_turn_enable_key));
|
CheckBoxPreference turn = (CheckBoxPreference) findPreference(getString(R.string.pref_turn_enable_key));
|
||||||
ice.setChecked(mPrefs.isIceEnabled());
|
ice.setChecked(mPrefs.isIceEnabled());
|
||||||
|
turn.setEnabled(mPrefs.getStunServer() != null);
|
||||||
turn.setChecked(mPrefs.isTurnEnabled());
|
turn.setChecked(mPrefs.isTurnEnabled());
|
||||||
|
|
||||||
|
EditTextPreference turnUsername = (EditTextPreference) findPreference(getString(R.string.pref_turn_username_key));
|
||||||
|
EditTextPreference turnPassword = (EditTextPreference) findPreference(getString(R.string.pref_turn_passwd_key));
|
||||||
|
turnUsername.setEnabled(mPrefs.isTurnEnabled());
|
||||||
|
turnUsername.setSummary(mPrefs.getTurnUsername());
|
||||||
|
turnUsername.setText(mPrefs.getTurnUsername());
|
||||||
|
turnPassword.setEnabled(mPrefs.isTurnEnabled());
|
||||||
|
|
||||||
CheckBoxPreference randomPort = (CheckBoxPreference) findPreference(getString(R.string.pref_transport_use_random_ports_key));
|
CheckBoxPreference randomPort = (CheckBoxPreference) findPreference(getString(R.string.pref_transport_use_random_ports_key));
|
||||||
randomPort.setChecked(mPrefs.isUsingRandomPort());
|
randomPort.setChecked(mPrefs.isUsingRandomPort());
|
||||||
|
@ -1047,6 +1055,9 @@ public class SettingsFragment extends PreferencesListFragment {
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
mPrefs.setStunServer(newValue.toString());
|
mPrefs.setStunServer(newValue.toString());
|
||||||
preference.setSummary(newValue.toString());
|
preference.setSummary(newValue.toString());
|
||||||
|
|
||||||
|
CheckBoxPreference turn = (CheckBoxPreference) findPreference(getString(R.string.pref_turn_enable_key));
|
||||||
|
turn.setEnabled(mPrefs.getStunServer() != null);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1063,6 +1074,27 @@ public class SettingsFragment extends PreferencesListFragment {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
mPrefs.setTurnEnabled((Boolean) newValue);
|
mPrefs.setTurnEnabled((Boolean) newValue);
|
||||||
|
EditTextPreference turnUsername = (EditTextPreference) findPreference(getString(R.string.pref_turn_username_key));
|
||||||
|
EditTextPreference turnPassword = (EditTextPreference) findPreference(getString(R.string.pref_turn_passwd_key));
|
||||||
|
turnUsername.setEnabled(mPrefs.isTurnEnabled());
|
||||||
|
turnPassword.setEnabled(mPrefs.isTurnEnabled());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
findPreference(getString(R.string.pref_turn_username_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
|
mPrefs.setTurnUsername((String) newValue);
|
||||||
|
preference.setSummary(mPrefs.getTurnUsername());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
findPreference(getString(R.string.pref_turn_passwd_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
|
mPrefs.setTurnPassword((String) newValue);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit f4eac4803eee43de3efa96ecca9450ba4f2bc7dc
|
Subproject commit a6d9ea7b211c53b1d4800497644a56f4674e5924
|
|
@ -1 +1 @@
|
||||||
Subproject commit a44713b458d1d9ccaa84d5acb464d76ad77ca403
|
Subproject commit 56b08128b41a64ae95b708ce61f1a9328016d3a4
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7744dc572470de6caf11b7e4ce7e79ba0c5efd55
|
Subproject commit 3fe5d85ee4dbed91920f3a43f129d28b3dece138
|
Loading…
Reference in a new issue