Fixed some issues when edition TURN/STUN credentials
This commit is contained in:
parent
0b1f70f200
commit
983956947e
1 changed files with 12 additions and 2 deletions
|
@ -1011,20 +1011,30 @@ public class LinphonePreferences {
|
||||||
public void setTurnUsername(String username) {
|
public void setTurnUsername(String username) {
|
||||||
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
||||||
LinphoneAuthInfo authInfo = getLc().findAuthInfo(nat.getStunServerUsername(), null, null);
|
LinphoneAuthInfo authInfo = getLc().findAuthInfo(nat.getStunServerUsername(), null, null);
|
||||||
|
|
||||||
if (authInfo != null) {
|
if (authInfo != null) {
|
||||||
authInfo.setUsername(username);
|
LinphoneAuthInfo cloneAuthInfo = authInfo.clone();
|
||||||
|
getLc().removeAuthInfo(authInfo);
|
||||||
|
cloneAuthInfo.setUsername(username);
|
||||||
|
cloneAuthInfo.setUserId(username);
|
||||||
|
getLc().addAuthInfo(cloneAuthInfo);
|
||||||
} else {
|
} else {
|
||||||
authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, username, null, null, null, null);
|
authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, username, null, null, null, null);
|
||||||
getLc().addAuthInfo(authInfo);
|
getLc().addAuthInfo(authInfo);
|
||||||
}
|
}
|
||||||
nat.setStunServerUsername(username);
|
nat.setStunServerUsername(username);
|
||||||
|
getLc().setNatPolicy(nat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTurnPassword(String password) {
|
public void setTurnPassword(String password) {
|
||||||
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
LinphoneNatPolicy nat = getOrCreateNatPolicy();
|
||||||
LinphoneAuthInfo authInfo = getLc().findAuthInfo(nat.getStunServerUsername(), null, null);
|
LinphoneAuthInfo authInfo = getLc().findAuthInfo(nat.getStunServerUsername(), null, null);
|
||||||
|
|
||||||
if (authInfo != null) {
|
if (authInfo != null) {
|
||||||
authInfo.setPassword(password);
|
LinphoneAuthInfo cloneAuthInfo = authInfo.clone();
|
||||||
|
getLc().removeAuthInfo(authInfo);
|
||||||
|
cloneAuthInfo.setPassword(password);
|
||||||
|
getLc().addAuthInfo(cloneAuthInfo);
|
||||||
} else {
|
} else {
|
||||||
authInfo = LinphoneCoreFactory.instance().createAuthInfo(nat.getStunServerUsername(), nat.getStunServerUsername(), password, null, null, null);
|
authInfo = LinphoneCoreFactory.instance().createAuthInfo(nat.getStunServerUsername(), nat.getStunServerUsername(), password, null, null, null);
|
||||||
getLc().addAuthInfo(authInfo);
|
getLc().addAuthInfo(authInfo);
|
||||||
|
|
Loading…
Reference in a new issue