public void init() { this.dialogIds = new HashSet(); this.transactionIDs = new HashMap(); SipFactory sipFactory = null; sipStack = null; sipFactory = SipFactory.getInstance(); sipFactory.setPathName("gov.nist"); Properties properties = new Properties(); properties.setProperty("javax.sip.STACK_NAME", "shootme"); // 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", "32"); properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "shootmedebuglog.txt"); properties.setProperty("gov.nist.javax.sip.SERVER_LOG", "shootmelog.txt"); // Guard against starvation. properties.setProperty("gov.nist.javax.sip.READ_TIMEOUT", "1000"); // properties.setProperty("gov.nist.javax.sip.MAX_MESSAGE_SIZE", // "4096"); properties.setProperty("gov.nist.javax.sip.CACHE_SERVER_CONNECTIONS", "false"); try { // Create SipStack object sipStack = sipFactory.createSipStack(properties); System.out.println("sipStack = " + sipStack); } catch (PeerUnavailableException e) { // could not find // gov.nist.jain.protocol.ip.sip.SipStackImpl // in the classpath e.printStackTrace(); System.err.println(e.getMessage()); if (e.getCause() != null) e.getCause().printStackTrace(); System.exit(0); } try { headerFactory = sipFactory.createHeaderFactory(); addressFactory = sipFactory.createAddressFactory(); messageFactory = sipFactory.createMessageFactory(); ListeningPoint lp = sipStack.createListeningPoint(myAddress, 5070, "udp"); ListeningPoint lp1 = sipStack.createListeningPoint(myAddress, 5070, "tcp"); Shootme listener = this; SipProvider sipProvider = sipStack.createSipProvider(lp); System.out.println("udp provider " + sipProvider); sipProvider.addSipListener(listener); sipProvider = sipStack.createSipProvider(lp1); System.out.println("tcp provider " + sipProvider); sipProvider.addSipListener(listener); } catch (Exception ex) { System.out.println(ex.getMessage()); ex.printStackTrace(); usage(); } }
public void init() { ConsoleAppender console = new ConsoleAppender(); // create appender // configure the appender String PATTERN = "%d [%p|%c|%C{1}] %m%n"; console.setLayout(new PatternLayout(PATTERN)); console.setThreshold(Level.DEBUG); console.activateOptions(); // add appender to any Logger (here is root) Logger.getRootLogger().addAppender(console); SipFactory sipFactory = null; sipStack = null; sipFactory = SipFactory.getInstance(); sipFactory.setPathName("gov.nist"); Properties properties = new Properties(); properties.setProperty("javax.sip.STACK_NAME", "shootme"); // 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", "LOG4J"); properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "shootmedebug.txt"); properties.setProperty("gov.nist.javax.sip.SERVER_LOG", "shootmelog.txt"); properties.setProperty( "gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName()); try { // Create SipStack object sipStack = sipFactory.createSipStack(properties); System.out.println("sipStack = " + sipStack); } catch (PeerUnavailableException e) { // could not find // gov.nist.jain.protocol.ip.sip.SipStackImpl // in the classpath e.printStackTrace(); System.err.println(e.getMessage()); if (e.getCause() != null) e.getCause().printStackTrace(); System.exit(0); } try { headerFactory = sipFactory.createHeaderFactory(); addressFactory = sipFactory.createAddressFactory(); messageFactory = sipFactory.createMessageFactory(); this.listeningPoint = sipStack.createListeningPoint("127.0.0.1", myPort, transport); B2BUA listener = this; sipProvider = sipStack.createSipProvider(listeningPoint); System.out.println("ws provider " + sipProvider); sipProvider.addSipListener(listener); } catch (Exception ex) { System.out.println(ex.getMessage()); ex.printStackTrace(); } }
public void init() { SipFactory sipFactory = null; sipStack = null; sipFactory = SipFactory.getInstance(); sipFactory.setPathName("gov.nist"); Properties properties = new Properties(); properties.setProperty("javax.sip.STACK_NAME", "shootme"); // 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", "32"); properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "shootmedebug.txt"); properties.setProperty("gov.nist.javax.sip.SERVER_LOG", "shootmelog.txt"); if (System.getProperty("enableNIO") != null && System.getProperty("enableNIO").equalsIgnoreCase("true")) { properties.setProperty( "gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY", NioMessageProcessorFactory.class.getName()); } try { // Create SipStack object sipStack = sipFactory.createSipStack(properties); System.out.println("sipStack = " + sipStack); } catch (PeerUnavailableException e) { // could not find // gov.nist.jain.protocol.ip.sip.SipStackImpl // in the classpath e.printStackTrace(); System.err.println(e.getMessage()); if (e.getCause() != null) e.getCause().printStackTrace(); System.exit(0); } try { headerFactory = sipFactory.createHeaderFactory(); addressFactory = sipFactory.createAddressFactory(); messageFactory = sipFactory.createMessageFactory(); ListeningPoint lp = sipStack.createListeningPoint("127.0.0.1", myPort, "udp"); Shootme listener = this; SipProvider sipProvider = sipStack.createSipProvider(lp); System.out.println("udp provider " + sipProvider); sipProvider.addSipListener(listener); } catch (Exception ex) { ex.printStackTrace(); fail("Unexpected exception"); } }
public void init(String transport) { if (transport == null) { transport = ListeningPoint.UDP; } SipFactory sipFactory = null; sipStack = null; sipFactory = SipFactory.getInstance(); sipFactory.setPathName("gov.nist"); Properties properties = new Properties(); properties.setProperty("javax.sip.STACK_NAME", "cutme"); // 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", "32"); properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "logs/cutmedebug.txt"); properties.setProperty("gov.nist.javax.sip.SERVER_LOG", "logs/cutmelog.xml"); try { // Create SipStack object sipStack = sipFactory.createSipStack(properties); System.out.println("sipStack = " + sipStack); } catch (PeerUnavailableException e) { // could not find // gov.nist.jain.protocol.ip.sip.SipStackImpl // in the classpath e.printStackTrace(); System.err.println(e.getMessage()); if (e.getCause() != null) e.getCause().printStackTrace(); System.exit(0); } try { messageFactory = sipFactory.createMessageFactory(); ListeningPoint lp = sipStack.createListeningPoint( "" + System.getProperty("org.mobicents.testsuite.testhostaddr") + "", myPort, transport); Cutme listener = this; SipProvider sipProvider = sipStack.createSipProvider(lp); System.out.println("udp provider " + sipProvider); sipProvider.addSipListener(listener); } catch (Exception ex) { System.out.println(ex.getMessage()); ex.printStackTrace(); } }
public void init() { SipFactory sipFactory = null; sipStack = null; sipFactory = SipFactory.getInstance(); sipFactory.setPathName("org.mobicents.ha"); Properties properties = new Properties(); properties.setProperty("javax.sip.STACK_NAME", stackName); // properties.setProperty("javax.sip.OUTBOUND_PROXY", Integer // .toString(BALANCER_PORT)); // 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", "32"); properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "logs/" + stackName + "debug.txt"); properties.setProperty("gov.nist.javax.sip.SERVER_LOG", "logs/" + stackName + "log.xml"); try { // Create SipStack object sipStack = sipFactory.createSipStack(properties); System.out.println("sipStack = " + sipStack); } catch (PeerUnavailableException e) { // could not find // gov.nist.jain.protocol.ip.sip.SipStackImpl // in the classpath e.printStackTrace(); System.err.println(e.getMessage()); if (e.getCause() != null) e.getCause().printStackTrace(); System.exit(0); } try { headerFactory = sipFactory.createHeaderFactory(); addressFactory = sipFactory.createAddressFactory(); messageFactory = sipFactory.createMessageFactory(); ListeningPoint lp = sipStack.createListeningPoint(myAddress, myPort, ListeningPoint.UDP); Shootme listener = this; sipProvider = sipStack.createSipProvider(lp); System.out.println("udp provider " + sipProvider); sipProvider.addSipListener(listener); // if(dialogs != null) { // Collection<Dialog> serializedDialogs = // simulateDialogSerialization(dialogs); // for (Dialog dialog : serializedDialogs) { // ((SIPDialog)dialog).setSipProvider((SipProviderImpl)sipProvider); // ((SipStackImpl)sipStack).putDialog((SIPDialog)dialog); // } // this.dialog = (SIPDialog)serializedDialogs.iterator().next(); // } sipStack.start(); if (!callerSendsBye && this.dialog != null) { try { Request byeRequest = this.dialog.createRequest(Request.BYE); ClientTransaction ct = sipProvider.getNewClientTransaction(byeRequest); System.out.println("sending BYE " + byeRequest); dialog.sendRequest(ct); } catch (Exception ex) { ex.printStackTrace(); fail("Unexpected exception "); } } } catch (Exception ex) { System.out.println(ex.getMessage()); ex.printStackTrace(); fail("Unexpected exception"); } }