use of javax.sip.SipStack 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();
}
Aggregations