本文整理匯總了Java中org.linphone.core.LinphoneAddress.setTransport方法的典型用法代碼示例。如果您正苦於以下問題:Java LinphoneAddress.setTransport方法的具體用法?Java LinphoneAddress.setTransport怎麽用?Java LinphoneAddress.setTransport使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.linphone.core.LinphoneAddress
的用法示例。
在下文中一共展示了LinphoneAddress.setTransport方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setAccountTransport
import org.linphone.core.LinphoneAddress; //導入方法依賴的package包/類
public void setAccountTransport(int n, String transport) {
LinphoneProxyConfig proxyConfig = getProxyConfig(n);
if (proxyConfig != null && transport != null) {
LinphoneAddress proxyAddr;
try {
proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxyConfig.getProxy());
int port = 0;
if (transport.equals(getString(R.string.pref_transport_udp_key))) {
proxyAddr.setTransport(TransportType.LinphoneTransportUdp);
} else if (transport.equals(getString(R.string.pref_transport_tcp_key))) {
proxyAddr.setTransport(TransportType.LinphoneTransportTcp);
} else if (transport.equals(getString(R.string.pref_transport_tls_key))) {
proxyAddr.setTransport(TransportType.LinphoneTransportTls);
port = 5223;
}
/* 3G mobile firewall might block random TLS port, so we force use of 5223.
* However we must NOT use this port when changing to TCP/UDP because otherwise
* REGISTER (and everything actually) will fail...
* */
if ("sip.linphone.org".equals(proxyConfig.getDomain())) {
proxyAddr.setPort(port);
}
LinphoneProxyConfig prxCfg = getProxyConfig(n);
prxCfg.edit();
prxCfg.setProxy(proxyAddr.asStringUriOnly());
prxCfg.done();
if (isAccountOutboundProxySet(n)) {
setAccountOutboundProxyEnabled(n, true);
}
} catch (LinphoneCoreException e) {
Log.e(e);
}
}
}
示例2: setAccountProxy
import org.linphone.core.LinphoneAddress; //導入方法依賴的package包/類
public void setAccountProxy(int n, String proxy) {
if (proxy == null || proxy.length() <= 0) {
proxy = getAccountDomain(n);
}
if (!proxy.contains("sip:")) {
proxy = "sip:" + proxy;
}
try {
LinphoneAddress proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxy);
if (!proxy.contains("transport=")) {
proxyAddr.setTransport(getAccountTransport(n));
}
LinphoneProxyConfig prxCfg = getProxyConfig(n);
prxCfg.edit();
prxCfg.setProxy(proxyAddr.asStringUriOnly());
prxCfg.done();
if (isAccountOutboundProxySet(n)) {
setAccountOutboundProxyEnabled(n, true);
}
} catch (LinphoneCoreException e) {
Log.e(e);
}
}
示例3: saveNewAccount
import org.linphone.core.LinphoneAddress; //導入方法依賴的package包/類
/**
* Creates a new account
* @throws LinphoneCoreException
*/
public void saveNewAccount() throws LinphoneCoreException {
if (tempUsername == null || tempUsername.length() < 1 || tempDomain == null || tempDomain.length() < 1) {
Log.w("Skipping account save: username or domain not provided");
return;
}
String identity = "sip:" + tempUsername + "@" + tempDomain;
String proxy = "sip:";
if (tempProxy == null) {
proxy += tempDomain;
} else {
if (!tempProxy.startsWith("sip:") && !tempProxy.startsWith("<sip:")
&& !tempProxy.startsWith("sips:") && !tempProxy.startsWith("<sips:")) {
proxy += tempProxy;
} else {
proxy = tempProxy;
}
}
LinphoneAddress proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxy);
LinphoneAddress identityAddr = LinphoneCoreFactory.instance().createLinphoneAddress(identity);
if (tempDisplayName != null) {
identityAddr.setDisplayName(tempDisplayName);
}
if (tempTransport != null) {
proxyAddr.setTransport(tempTransport);
}
String route = tempOutboundProxy ? proxyAddr.asStringUriOnly() : null;
LinphoneProxyConfig prxCfg = lc.createProxyConfig(identityAddr.asString(), proxyAddr.asStringUriOnly(), route, tempEnabled);
if (tempContactsParams != null)
prxCfg.setContactUriParameters(tempContactsParams);
if (tempExpire != null) {
try {
prxCfg.setExpires(Integer.parseInt(tempExpire));
} catch (NumberFormatException nfe) { }
}
prxCfg.enableAvpf(tempAvpfEnabled);
prxCfg.setAvpfRRInterval(tempAvpfRRInterval);
prxCfg.enableQualityReporting(tempQualityReportingEnabled);
prxCfg.setQualityReportingCollector(tempQualityReportingCollector);
prxCfg.setQualityReportingInterval(tempQualityReportingInterval);
if(tempPrefix != null){
prxCfg.setDialPrefix(tempPrefix);
}
if(tempRealm != null)
prxCfg.setRealm(tempRealm);
LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(tempUsername, tempUserId, tempPassword, tempHa1, tempRealm, tempDomain);
lc.addProxyConfig(prxCfg);
lc.addAuthInfo(authInfo);
if (!tempNoDefault)
lc.setDefaultProxyConfig(prxCfg);
}