use of android.net.sip.SipProfile in project XobotOS by xamarin.
the class SipSessionGroup method reset.
synchronized void reset(String localIp) throws SipException, IOException {
mLocalIp = localIp;
if (localIp == null)
return;
SipProfile myself = mLocalProfile;
SipFactory sipFactory = SipFactory.getInstance();
Properties properties = new Properties();
properties.setProperty("javax.sip.STACK_NAME", getStackName());
properties.setProperty("gov.nist.javax.sip.THREAD_POOL_SIZE", THREAD_POOL_SIZE);
String outboundProxy = myself.getProxyAddress();
if (!TextUtils.isEmpty(outboundProxy)) {
Log.v(TAG, "outboundProxy is " + outboundProxy);
properties.setProperty("javax.sip.OUTBOUND_PROXY", outboundProxy + ":" + myself.getPort() + "/" + myself.getProtocol());
}
SipStack stack = mSipStack = sipFactory.createSipStack(properties);
try {
SipProvider provider = stack.createSipProvider(stack.createListeningPoint(localIp, allocateLocalPort(), myself.getProtocol()));
provider.addSipListener(this);
mSipHelper = new SipHelper(stack, provider);
} catch (InvalidArgumentException e) {
throw new IOException(e.getMessage());
} catch (TooManyListenersException e) {
// must never happen
throw new SipException("SipSessionGroup constructor", e);
}
Log.d(TAG, " start stack for " + myself.getUriString());
stack.start();
mCallReceiverSession = null;
mSessionMap.clear();
resetExternalAddress();
}
use of android.net.sip.SipProfile in project XobotOS by xamarin.
the class SipSessionGroup method createPeerProfile.
private static SipProfile createPeerProfile(HeaderAddress header) throws SipException {
try {
Address address = header.getAddress();
SipURI uri = (SipURI) address.getURI();
String username = uri.getUser();
if (username == null)
username = ANONYMOUS;
int port = uri.getPort();
SipProfile.Builder builder = new SipProfile.Builder(username, uri.getHost()).setDisplayName(address.getDisplayName());
if (port > 0)
builder.setPort(port);
return builder.build();
} catch (IllegalArgumentException e) {
throw new SipException("createPeerProfile()", e);
} catch (ParseException e) {
throw new SipException("createPeerProfile()", e);
}
}
Aggregations