Fix proxy/outbound proxy issue
This commit is contained in:
parent
7a82aeda3d
commit
4b2dceb40b
1 changed files with 14 additions and 3 deletions
|
@ -241,16 +241,23 @@ public class LinphonePreferences {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccountProxy(int n, String proxy) {
|
public void setAccountProxy(int n, String proxy) {
|
||||||
|
if (!proxy.startsWith("sip:")) {
|
||||||
|
proxy = "sip:" + proxy;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
LinphoneProxyConfig prxCfg = getProxyConfig(n);
|
||||||
prxCfg.setProxy("sip:" + proxy);
|
prxCfg.setProxy(proxy);
|
||||||
} catch (LinphoneCoreException e) {
|
} catch (LinphoneCoreException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAccountProxy(int n) {
|
public String getAccountProxy(int n) {
|
||||||
return getProxyConfig(n).getProxy();
|
String proxy = getProxyConfig(n).getProxy();
|
||||||
|
if (proxy != null && proxy.startsWith("sip:")) {
|
||||||
|
proxy = proxy.substring(4);
|
||||||
|
}
|
||||||
|
return proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNewAccountOutboundProxyEnabled(boolean enabled) {
|
public void setNewAccountOutboundProxyEnabled(boolean enabled) {
|
||||||
|
@ -260,7 +267,11 @@ public class LinphonePreferences {
|
||||||
public void setAccountOutboundProxyEnabled(int n, boolean enabled) {
|
public void setAccountOutboundProxyEnabled(int n, boolean enabled) {
|
||||||
try {
|
try {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
getProxyConfig(n).setRoute(getAccountProxy(n));
|
String route = getAccountProxy(n);
|
||||||
|
if (!route.startsWith("sip:")) {
|
||||||
|
route = "sip:" + route;
|
||||||
|
}
|
||||||
|
getProxyConfig(n).setRoute(route);
|
||||||
} else {
|
} else {
|
||||||
getProxyConfig(n).setRoute(null);
|
getProxyConfig(n).setRoute(null);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue