}
public void init() {
SipFactory sipFactory = null;
sipStack = null;
sipFactory = SipFactory.getInstance();
sipFactory.setPathName("gov.nist");
Properties properties = new Properties();
// If you want to try TCP transport change the following to
String transport = "tcp";
String peerHostPort = "127.0.0.1:5070";
properties.setProperty("javax.sip.OUTBOUND_PROXY", peerHostPort + "/"
+ transport);
// If you want to use UDP then uncomment this.
properties.setProperty("javax.sip.STACK_NAME", "shootist");
// The following properties are specific to nist-sip
// and are not necessarily part of any other jain-sip
// implementation.
// You can set a max message size for tcp transport to
// guard against denial of service attack.
properties.setProperty("gov.nist.javax.sip.DEBUG_LOG",
"shootistdebug.txt");
properties.setProperty("gov.nist.javax.sip.SERVER_LOG",
"shootistlog.txt");
// Drop the client connection after we are done with the transaction.
properties.setProperty("gov.nist.javax.sip.CACHE_CLIENT_CONNECTIONS",
"false");
// Set to 0 (or NONE) in your production code for max speed.
// You need 16 (or TRACE) for logging traces. 32 (or DEBUG) for debug + traces.
// Your code will limp at 32 but it is best for debugging.
properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "0");
properties.setProperty("gov.nist.javax.sip.TCP_POST_PARSING_THREAD_POOL_SIZE", "100");
properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");
properties.setProperty("gov.nist.javax.sip.AUTOMATIC_DIALOG_ERROR_HANDLING","false");
properties.setProperty("gov.nist.javax.sip.REENTRANT_LISTENER", "true");
try {
// Create SipStack object
sipStack = sipFactory.createSipStack(properties);
System.out.println("createSipStack " + sipStack);
} catch (PeerUnavailableException e) {
// could not find
// gov.nist.jain.protocol.ip.sip.SipStackImpl
// in the classpath
e.printStackTrace();
System.err.println(e.getMessage());
fail("Problem with setup");
}
try {
headerFactory = sipFactory.createHeaderFactory();
addressFactory = sipFactory.createAddressFactory();
messageFactory = sipFactory.createMessageFactory();
udpListeningPoint = sipStack.createListeningPoint("127.0.0.1", 5060, "tcp");
sipProvider = sipStack.createSipProvider(udpListeningPoint);
Shootist listener = this;
sipProvider.addSipListener(listener);