public ProtocolObjects(String stackname, String pathname, String transport,
boolean autoDialog, boolean isBackToBackUserAgent) {
this.autoDialog = autoDialog;
this.transport = transport;
SipFactory sipFactory = SipFactory.getInstance();
sipFactory.resetFactory();
sipFactory.setPathName(pathname);
Properties properties = new Properties();
properties.setProperty("javax.sip.STACK_NAME", stackname);
// The following properties are specific to nist-sip
// and are not necessarily part of any other jain-sip
// implementation.
properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", logFileDirectory
+ ReInviteBusyTest.class.getName() + "-debuglog.txt");
properties.setProperty("gov.nist.javax.sip.SERVER_LOG",
logFileDirectory + "ReInviteBusyTest-" + "log.txt");
properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT",
(autoDialog ? "on" : "off"));
// For the forked subscribe notify test
properties.setProperty("javax.sip.FORKABLE_EVENTS", "foo");
//For the TelUrlRouter test.
//properties.setProperty("javax.sip.ROUTER_PATH", NonSipUriRouter.class.getName());
// Dont use the router for all requests.
properties.setProperty("javax.sip.USE_ROUTER_FOR_ALL_URIS", "false");
properties.setProperty("gov.nist.javax.sip.THREAD_POOL_SIZE", "1");
properties.setProperty("gov.nist.javax.sip.IS_BACK_TO_BACK_USER_AGENT", Boolean.toString(isBackToBackUserAgent));
//For the TelUrlRouter test.
properties.setProperty("javax.sip.ROUTER_PATH", NonSipUriRouter.class.getName());
// Set to 0 in your production code for max speed.
// You need 16 for logging traces. 32 for debug + traces.
// Your code will limp at 32 but it is best for debugging.
properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", new Integer(
logLevel).toString());
try {
// Create SipStack object
sipStack = sipFactory.createSipStack(properties);
NonSipUriRouter router = (NonSipUriRouter) sipStack.getRouter();
router.setMyPort(5080);
System.out.println("createSipStack " + sipStack);
} catch (Exception e) {
// could not find
// gov.nist.jain.protocol.ip.sip.SipStackImpl
// in the classpath
e.printStackTrace();
System.err.println(e.getMessage());
throw new RuntimeException("Stack failed to initialize");
}
try {
headerFactory = sipFactory.createHeaderFactory();
addressFactory = sipFactory.createAddressFactory();
messageFactory = sipFactory.createMessageFactory();
} catch (SipException ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}