Пример #1
0
  public void setUp() {

    try {
      super.setUp();
      shootist = new Shootist(6050, 5070);
      SipProvider shootistProvider = shootist.createSipProvider();
      shootistProvider.addSipListener(shootist);
      boolean sendRinging = true;
      for (int i = 0; i < forkCount; i++) {

        Shootme shootme = new Shootme(5080 + i, sendRinging, 400 * forkCount - 200 * i);
        sendRinging = false;
        SipProvider shootmeProvider = shootme.createProvider();
        shootmeProvider.addSipListener(shootme);
        this.shootme.add(shootme);
      }

      this.proxy = new Proxy(5070, forkCount);
      SipProvider provider = proxy.createSipProvider();
      provider.addSipListener(proxy);
      logger.debug("setup completed");

    } catch (Exception ex) {
      fail("unexpected exception ");
    }
  }
Пример #2
0
  public void setUp() {

    try {
      this.transport = "udp";

      super.setUp();

      shootist = new Shootist(getRiProtocolObjects());

      SipProvider shootistProvider = shootist.createSipProvider();
      providerTable.put(shootistProvider, shootist);

      shootme = new Shootme(getTiProtocolObjects());
      SipProvider shootmeProvider = shootme.createSipProvider();
      providerTable.put(shootmeProvider, shootme);
      shootistProvider.addSipListener(this);
      shootmeProvider.addSipListener(this);

      ((SipStackImpl) getTiProtocolObjects().sipStack).setIsBackToBackUserAgent(false);
      ((SipStackImpl) getRiProtocolObjects().sipStack).setIsBackToBackUserAgent(false);

      getRiProtocolObjects().start();
      if (getTiProtocolObjects() != getRiProtocolObjects()) getTiProtocolObjects().start();
    } catch (Exception ex) {
      ex.printStackTrace();
      fail("unexpected exception ");
    }
  }
  /**
   * Non Regression test for http://code.google.com/p/mobicents/issues/detail?id=1837 ACK was
   * received by JAIN-SIP but was not routed to application
   */
  public void testCallForwardingCallerReInviteAckRaceInfo() throws Exception {
    sender = new TestSipListener(5080, 5070, senderProtocolObjects, false);
    SipProvider senderProvider = sender.createProvider();

    receiver = new TestSipListener(5090, 5070, receiverProtocolObjects, false);
    receiver.setDisableSequenceNumberValidation(true);
    SipProvider receiverProvider = receiver.createProvider();

    receiverProvider.addSipListener(receiver);
    senderProvider.addSipListener(sender);

    senderProtocolObjects.start();
    receiverProtocolObjects.start();

    String fromName = "forward-pending-sender";
    String fromSipAddress = "sip-servlets.com";
    SipURI fromAddress =
        senderProtocolObjects.addressFactory.createSipURI(fromName, fromSipAddress);

    String toSipAddress = "sip-servlets.com";
    String toUser = "******";
    SipURI toAddress = senderProtocolObjects.addressFactory.createSipURI(toUser, toSipAddress);

    sender.setTimeToWaitBeforeAck(9000);
    sender.sendSipRequest("INVITE", fromAddress, toAddress, null, null, false);
    Thread.sleep(8000);
    receiver.sendInDialogSipRequest("UPDATE", null, null, null, null, null);
    Thread.sleep(TIMEOUT);
    assertTrue(receiver.isAckReceived());
  }
Пример #4
0
  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();
    }
  }
  /**
   * Non Regression test for http://code.google.com/p/mobicents/issues/detail?id=2230 BYE is routed
   * to unexpected IP
   */
  public void testCallForwardingCallerSendBye408onReinviteUPDATENewThread() throws Exception {
    sender = new TestSipListener(5080, 5070, senderProtocolObjects, false);
    SipProvider senderProvider = sender.createProvider();

    receiver = new TestSipListener(5090, 5070, receiverProtocolObjects, false);
    SipProvider receiverProvider = receiver.createProvider();

    receiverProvider.addSipListener(receiver);
    senderProvider.addSipListener(sender);

    senderProtocolObjects.start();
    receiverProtocolObjects.start();

    String fromName = "forward-sender-408-new-thread";
    String fromSipAddress = "sip-servlets.com";
    SipURI fromAddress =
        senderProtocolObjects.addressFactory.createSipURI(fromName, fromSipAddress);

    String toSipAddress = "sip-servlets.com";
    String toUser = "******";
    SipURI toAddress = senderProtocolObjects.addressFactory.createSipURI(toUser, toSipAddress);

    sender.sendSipRequest("INVITE", fromAddress, toAddress, null, null, false);
    Thread.sleep(TIMEOUT);
    assertTrue(receiver.isInviteReceived());
    assertTrue(receiver.isAckReceived());
    MaxForwardsHeader maxForwardsHeader =
        (MaxForwardsHeader) receiver.getInviteRequest().getHeader(MaxForwardsHeader.NAME);
    assertNotNull(maxForwardsHeader);
    receiver.setProvisionalResponsesToSend(new ArrayList<Integer>());
    receiver.setFinalResponseToSend(Response.REQUEST_TIMEOUT);
    Header methodHeader = receiverProtocolObjects.headerFactory.createHeader("Method", "UPDATE");
    List<Header> headers = new ArrayList<Header>();
    headers.add(methodHeader);
    sender.sendInDialogSipRequest("INVITE", null, null, null, headers, null);
    Thread.sleep(TIMEOUT);
    assertTrue(receiver.isInviteReceived());
    assertTrue(receiver.isAckReceived());

    receiver.sendInDialogSipRequest("UPDATE", null, null, null, null, null);
    Thread.sleep(TIMEOUT);
    assertTrue(receiver.isInviteReceived());
    assertTrue(receiver.isAckReceived());

    sender.sendInDialogSipRequest("BYE", null, null, null, null, null);
    Thread.sleep(TIMEOUT);
    assertTrue(sender.getOkToByeReceived());

    Iterator<String> allMessagesIterator = sender.getAllMessagesContent().iterator();
    while (allMessagesIterator.hasNext()) {
      String message = (String) allMessagesIterator.next();
      logger.info(message);
    }
    assertTrue(sender.getAllMessagesContent().contains("IllegalStateException"));
  }
    public void start() throws IllegalStateException {

      SipFactory sipFactory = null;
      sipStack = null;

      Properties properties = new Properties();
      properties.setProperty("javax.sip.RETRANSMISSION_FILTER", "true");
      properties.setProperty("javax.sip.STACK_NAME", "StatelessForwarder");
      properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");
      // 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/statelessforwarderdebug.txt");
      properties.setProperty("gov.nist.javax.sip.SERVER_LOG", "./logs/statelessforwarderlog.xml");

      try {
        // Create SipStack object
        sipFactory = SipFactory.getInstance();
        sipFactory.setPathName("gov.nist");
        sipStack = sipFactory.createSipStack(properties);

        headerFactory = sipFactory.createHeaderFactory();
        addressFactory = sipFactory.createAddressFactory();
        messageFactory = sipFactory.createMessageFactory();

        ListeningPoint lp = sipStack.createListeningPoint(myHost, myPort, ListeningPoint.UDP);
        sipProvider = sipStack.createSipProvider(lp);
        sipProvider.addSipListener(this);

        sipStack.start();
      } catch (Exception ex) {
        throw new IllegalStateException(
            "Cant create sip objects and lps due to[" + ex.getMessage() + "]", ex);
      }
    }
  public void init() throws Exception {
    SipFactory sipFactory = null;
    sipStack = null;
    sipFactory = SipFactory.getInstance();
    sipFactory.setPathName("gov.nist");
    Properties properties = new Properties();
    properties.setProperty("javax.sip.IP_ADDRESS", myIP);
    properties.setProperty("javax.sip.OUTBOUND_PROXY", peerIP + ":" + peerPort + "/udp");
    properties.setProperty("javax.sip.STACK_NAME", "conferencemonitor");
    properties.setProperty("javax.sip.RETRANSMISSION_FILTER", "on");
    //		properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "conferencemonitordebug.txt");
    //		properties.setProperty("gov.nist.javax.sip.SERVER_LOG", "conferencemonitorlog.txt");
    properties.setProperty("gov.nist.javax.sip.CACHE_CLIENT_CONNECTIONS", "false");
    // 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", "32");

    // Create SipStack object
    sipStack = sipFactory.createSipStack(properties);

    headerFactory = sipFactory.createHeaderFactory();
    addressFactory = sipFactory.createAddressFactory();
    messageFactory = sipFactory.createMessageFactory();
    ListeningPoint udpListeningPoint = sipStack.createListeningPoint(myPort, "udp");
    sipProvider = sipStack.createSipProvider(udpListeningPoint);
    sipProvider.addSipListener(this);

    if (logger.isDebugEnabled()) logger.debug("init() " + sipProvider);
  }
  public void testCallForwardingCallerSendBye() throws Exception {
    sender = new TestSipListener(5080, 5070, senderProtocolObjects, false);
    SipProvider senderProvider = sender.createProvider();

    receiver = new TestSipListener(5090, 5070, receiverProtocolObjects, false);
    receiver.setSendReinvite(true);
    SipProvider receiverProvider = receiver.createProvider();

    receiverProvider.addSipListener(receiver);
    senderProvider.addSipListener(sender);

    senderProtocolObjects.start();
    receiverProtocolObjects.start();

    String fromName = "forward-sender";
    String fromSipAddress = "sip-servlets.com";
    SipURI fromAddress =
        senderProtocolObjects.addressFactory.createSipURI(fromName, fromSipAddress);

    String toSipAddress = "sip-servlets.com";
    String toUser = "******";
    SipURI toAddress = senderProtocolObjects.addressFactory.createSipURI(toUser, toSipAddress);

    sender.sendSipRequest("INVITE", fromAddress, toAddress, null, null, false);
    Thread.sleep(TIMEOUT);
    assertTrue(sender.isInviteReceived());
    assertTrue(sender.isAckReceived());
    assertNotNull(sender.getInviteRequest().getHeader("ReInvite"));
    MaxForwardsHeader maxForwardsHeader =
        (MaxForwardsHeader) receiver.getInviteRequest().getHeader(MaxForwardsHeader.NAME);
    assertNotNull(maxForwardsHeader);
    // Non Regression test for http://code.google.com/p/mobicents/issues/detail?id=1490
    // B2buaHelper.createRequest does not decrement Max-forwards
    assertEquals(69, maxForwardsHeader.getMaxForwards());
    sender.sendInDialogSipRequest("BYE", null, null, null, null, null);
    Thread.sleep(TIMEOUT);
    assertTrue(receiver.getByeReceived());
    assertTrue(sender.getOkToByeReceived());
    assertEquals(1, sender.bindings); // http://code.google.com/p/mobicents/issues/detail?id=2100
    maxForwardsHeader =
        (MaxForwardsHeader) receiver.getByeRequestReceived().getHeader(MaxForwardsHeader.NAME);
    assertNotNull(maxForwardsHeader);
    // Non Regression test for http://code.google.com/p/mobicents/issues/detail?id=1490
    // B2buaHelper.createRequest does not decrement Max-forwards
    assertEquals(69, maxForwardsHeader.getMaxForwards());
  }
  /**
   * Non Regression test for http://code.google.com/p/mobicents/issues/detail?id=1445 "Bad Request
   * Method. CANCEL" during sending CANCEL to re-INVITE
   */
  public void testCallForwardingCallerReInviteCancel() throws Exception {
    sender = new TestSipListener(5080, 5070, senderProtocolObjects, false);
    SipProvider senderProvider = sender.createProvider();

    receiver = new TestSipListener(5090, 5070, receiverProtocolObjects, false);
    SipProvider receiverProvider = receiver.createProvider();

    receiverProvider.addSipListener(receiver);
    senderProvider.addSipListener(sender);

    senderProtocolObjects.start();
    receiverProtocolObjects.start();

    String fromName = "forward-sender";
    String fromSipAddress = "sip-servlets.com";
    SipURI fromAddress =
        senderProtocolObjects.addressFactory.createSipURI(fromName, fromSipAddress);

    String toSipAddress = "sip-servlets.com";
    String toUser = "******";
    SipURI toAddress = senderProtocolObjects.addressFactory.createSipURI(toUser, toSipAddress);

    sender.sendSipRequest("INVITE", fromAddress, toAddress, null, null, false);
    Thread.sleep(TIMEOUT);
    assertTrue(sender.isAckSent());
    receiver.setWaitForCancel(true);
    sender.sendInDialogSipRequest("INVITE", null, null, null, null, null);
    Thread.sleep(500);
    sender.sendCancel();
    Thread.sleep(TIMEOUT);
    assertTrue(sender.isCancelOkReceived());
    assertTrue(sender.isRequestTerminatedReceived());
    assertTrue(receiver.isCancelReceived());
    sender.setCancelOkReceived(false);
    sender.setRequestTerminatedReceived(false);
    receiver.setCancelReceived(false);
    sender.sendInDialogSipRequest("INVITE", null, null, null, null, null);
    Thread.sleep(500);
    sender.sendCancel();
    Thread.sleep(TIMEOUT);
    assertTrue(sender.isCancelOkReceived());
    assertTrue(sender.isRequestTerminatedReceived());
    assertTrue(receiver.isCancelReceived());
  }
  public void setupPhones(String transport) throws Exception {
    senderProtocolObjects =
        new ProtocolObjects("proxy-sender", "gov.nist", transport, AUTODIALOG, null, null, null);
    receiverProtocolObjects =
        new ProtocolObjects("proxy-receiver", "gov.nist", transport, AUTODIALOG, null, null, null);
    sender = new TestSipListener(5080, 5070, senderProtocolObjects, false);
    sender.setRecordRoutingProxyTesting(true);
    SipProvider senderProvider = sender.createProvider();

    receiver = new TestSipListener(5057, 5070, receiverProtocolObjects, false);
    receiver.setRecordRoutingProxyTesting(true);
    SipProvider receiverProvider = receiver.createProvider();

    receiverProvider.addSipListener(receiver);
    senderProvider.addSipListener(sender);

    senderProtocolObjects.start();
    receiverProtocolObjects.start();
  }
Пример #11
0
  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 setUp() throws Exception {
    try {
      super.setUp();

      logger.info("ReferTest: setup()");
      referee = new Referee(getTiProtocolObjects());
      SipProvider refereeProvider = referee.createProvider();
      providerTable.put(refereeProvider, referee);

      referrer = new Referrer(getRiProtocolObjects());
      SipProvider referrerProvider = referrer.createProvider();
      providerTable.put(referrerProvider, referrer);

      refereeProvider.addSipListener(this);
      referrerProvider.addSipListener(this);

      if (getTiProtocolObjects() != getRiProtocolObjects()) getTiProtocolObjects().start();
      getRiProtocolObjects().start();
    } catch (Exception ex) {
      logger.error("unexpected excecption ", ex);
      fail("unexpected exception");
    }
  }
Пример #13
0
  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("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");
      }
    }
  @Override
  protected void setUp() {
    try {
      super.sipIpAddress = "0.0.0.0";
      super.setUp();

      senderProtocolObjects =
          new ProtocolObjects("reinvite", "gov.nist", TRANSPORT, AUTODIALOG, null);

      sender = new TestSipListener(5080, 5070, senderProtocolObjects, false);
      SipProvider senderProvider = sender.createProvider();

      senderProvider.addSipListener(sender);

      senderProtocolObjects.start();
    } catch (Exception ex) {
      ex.printStackTrace();
      fail("unexpected exception ");
    }
  }
  public void testNoAppDeployed404() throws Exception {
    tomcat.addSipConnector(serverName, sipIpAddress, 5060, listeningPointTransport);
    super.tomcat.startTomcat();

    sender = new TestSipListener(5080, 5060, senderProtocolObjects, true);
    SipProvider senderProvider = sender.createProvider();

    senderProvider.addSipListener(sender);

    senderProtocolObjects.start();

    String fromName = "sender";
    String fromHost = "sip-servlets.com";
    SipURI fromAddress = senderProtocolObjects.addressFactory.createSipURI(fromName, fromHost);

    String toUser = "******";
    String toHost = "" + System.getProperty("org.mobicents.testsuite.testhostaddr") + "";
    SipURI toAddress = senderProtocolObjects.addressFactory.createSipURI(toUser, toHost);

    sender.sendSipRequest("INVITE", fromAddress, toAddress, null, null, true);
    Thread.sleep(TIMEOUT);
    assertEquals(404, sender.getFinalResponseStatus());
  }
 public synchronized boolean init() {
   if (initialized == true) return true;
   initialized = true;
   logger.info("Starting the reaper stack...");
   try {
     SipStack sipStack;
     Configuration configuration;
     configuration = new Configuration();
     configuration.setStackName(STACK_NAME);
     SipFactory.getInstance().setPathName("gov.nist");
     sipStack = SipFactory.getInstance().createSipStack(configuration);
     RequestMessage.initFactory(SipFactory.getInstance(), configuration);
     ListeningPoint reaperTcp =
         sipStack.createListeningPoint("127.0.0.1", configuration.getReadPort(), "tcp");
     reaperProvider = sipStack.createSipProvider(reaperTcp);
     reaperProvider.addSipListener(new ReaperListener());
     reaperProvider.setAutomaticDialogSupportEnabled(false);
     logger.info("Reaper SIP stack initialized successfully");
   } catch (Exception e) {
     logger.error("Error initializing stack: ", e);
     return false;
   }
   return true;
 }
Пример #18
0
  /**
   * Start the proxy, this method has to be called after the init method throws Exception that which
   * can be caught by the upper application
   */
  public void start() throws Exception {
    if (configuration != null && configuration.isValidConfiguration()) {
      Properties properties = new Properties();
      // LOGGING property:

      if (configuration.enableDebug) {
        ProxyDebug.debug = true;
        ProxyDebug.setProxyOutputFile(configuration.outputProxy);
        ProxyDebug.println("DEBUG properties set!");
        if (configuration.badMessageLogFile != null)
          properties.setProperty(
              "gov.nist.javax.sip.BAD_MESSAGE_LOG", configuration.badMessageLogFile);
        if (configuration.debugLogFile != null) {
          properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", configuration.debugLogFile);
        }
        if (configuration.serverLogFile != null)
          properties.setProperty("gov.nist.javax.sip.SERVER_LOG", configuration.serverLogFile);
        if (configuration.debugLogFile != null)
          properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
        else if (configuration.serverLogFile != null)
          properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "16");
        else properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "0");

      } else {
        System.out.println("DEBUG properties not set!");
      }
      registrar.setExpiresTime(configuration.expiresTime);

      // STOP TIME
      if (configuration.stopTime != null) {
        try {
          long stopTime = Long.parseLong(configuration.stopTime);
          StopProxy stopProxy = new StopProxy(this);
          Timer timer = new Timer();
          timer.schedule(stopProxy, stopTime);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }

      sipStack = null;

      SipFactory sipFactory = SipFactory.getInstance();
      sipFactory.setPathName("gov.nist");

      headerFactory = sipFactory.createHeaderFactory();
      addressFactory = sipFactory.createAddressFactory();
      messageFactory = sipFactory.createMessageFactory();

      // Create SipStack object

      properties.setProperty("javax.sip.IP_ADDRESS", configuration.stackIPAddress);

      // We have to add the IP address of the proxy for the domain:
      configuration.domainList.addElement(configuration.stackIPAddress);
      ProxyDebug.println("The proxy is responsible for the domain:" + configuration.stackIPAddress);

      properties.setProperty("javax.sip.STACK_NAME", configuration.stackName);
      if (configuration.check(configuration.outboundProxy))
        properties.setProperty("javax.sip.OUTBOUND_PROXY", configuration.outboundProxy);
      if (configuration.check(configuration.routerPath))
        properties.setProperty("javax.sip.ROUTER_PATH", configuration.routerPath);
      if (configuration.check(configuration.extensionMethods))
        properties.setProperty("javax.sip.EXTENSION_METHODS", configuration.extensionMethods);
      // This has to be hardcoded to true. for the proxy.
      properties.setProperty("javax.sip.RETRANSMISSION_FILTER", "on");

      if (configuration.check(configuration.maxConnections))
        properties.setProperty("gov.nist.javax.sip.MAX_CONNECTIONS", configuration.maxConnections);
      if (configuration.check(configuration.maxServerTransactions))
        properties.setProperty(
            "gov.nist.javax.sip.MAX_SERVER_TRANSACTIONS", configuration.maxServerTransactions);
      if (configuration.check(configuration.threadPoolSize))
        properties.setProperty("gov.nist.javax.sip.THREAD_POOL_SIZE", configuration.threadPoolSize);

      if (configuration.domainList != null)
        for (int j = 0; j < configuration.domainList.size(); j++) {
          String domain = (String) configuration.domainList.elementAt(j);
          ProxyDebug.println("Here is one domain to take care of:" + domain);
        }
      else ProxyDebug.println("No domain to take care of...");

      if (configuration.accessLogViaRMI) {
        properties.setProperty("gov.nist.javax.sip.ACCESS_LOG_VIA_RMI", "true");

        properties.setProperty("gov.nist.javax.sip.RMI_PORT", configuration.logRMIPort);

        if (configuration.check(configuration.logLifetime))
          properties.setProperty("gov.nist.javax.sip.LOG_LIFETIME", configuration.logLifetime);
      }

      sipStack = sipFactory.createSipStack(properties);

      // Authentication part:
      if (configuration.enableAuthentication) {
        authentication = new Authentication(this);
        try {

          Class authMethodClass = Class.forName(configuration.classFile);
          AuthenticationMethod authMethod = (AuthenticationMethod) authMethodClass.newInstance();
          authMethod.initialize(configuration.passwordsFile);

          authentication.setAuthenticationMethod(authMethod);

        } catch (Exception e) {
          ProxyDebug.println("ERROR, authentication process stopped, exception raised:");
          e.printStackTrace();
        }
      }

      // We create the Listening points:
      Vector lps = configuration.getListeningPoints();

      for (int i = 0; lps != null && i < lps.size(); i++) {
        Association a = (Association) lps.elementAt(i);
        try {
          System.out.println("transport  " + a.transport);
          System.out.println("port  " + Integer.valueOf(a.port).intValue());
          ListeningPoint lp =
              sipStack.createListeningPoint(Integer.valueOf(a.port).intValue(), a.transport);
          this.listeningPoints.add(lp);
          SipProvider sipProvider = sipStack.createSipProvider(lp);
          if (this.defaultProvider == null) this.defaultProvider = sipProvider;
          sipProvider.addSipListener(this);
        } catch (Exception e) {
          e.printStackTrace();
          ProxyDebug.println("ERROR: listening point not created ");
        }
      }
      // Export the registry for polling by the responder.

      if (configuration.exportRegistry)
        // initialize the registrar for RMI.
        this.registrar.initRMIBindings();

      // Parse static configuration for registrar.
      if (configuration.enableRegistrations) {
        String value = configuration.registrationsFile;
        ProxyDebug.println("Parsing the XML registrations file: " + value);
        if (value == null || value.trim().equals(""))
          ProxyDebug.println("You have to set the registrations file...");
        else registrar.parseXMLregistrations(value);
      } else ProxyDebug.println("No registrations to parse...");

      // Register to proxies if any:
      registrar.registerToProxies();

    } else {
      System.out.println(
          "ERROR: the configuration file is not correct!" + " Correct the errors first.");
    }
  }
    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");
      }
    }
  // Issue 2500 http://code.google.com/p/mobicents/issues/detail?id=2500
  // B2buaHelper.createRequest() throws a NullPointerException if the request contains an empty
  // header
  public void testCallForwardingCallerSendReInviteSendBye() throws Exception {
    sender = new TestSipListener(5080, 5070, senderProtocolObjects, false);
    SipProvider senderProvider = sender.createProvider();

    receiver = new TestSipListener(5090, 5070, receiverProtocolObjects, false);
    SipProvider receiverProvider = receiver.createProvider();

    receiverProvider.addSipListener(receiver);
    senderProvider.addSipListener(sender);

    senderProtocolObjects.start();
    receiverProtocolObjects.start();

    String fromName = "forward-sender";
    String fromSipAddress = "sip-servlets.com";
    SipURI fromAddress =
        senderProtocolObjects.addressFactory.createSipURI(fromName, fromSipAddress);

    String toSipAddress = "sip-servlets.com";
    String toUser = "******";
    SipURI toAddress = senderProtocolObjects.addressFactory.createSipURI(toUser, toSipAddress);

    sender.sendSipRequest(
        "INVITE",
        fromAddress,
        toAddress,
        null,
        null,
        false,
        new String[] {AllowHeader.NAME},
        new String[] {"INVITE, CANCEL, BYE, ACK, OPTIONS"},
        true);
    Thread.sleep(TIMEOUT);
    assertTrue(receiver.isInviteReceived());
    assertTrue(receiver.isAckReceived());
    MaxForwardsHeader maxForwardsHeader =
        (MaxForwardsHeader) receiver.getInviteRequest().getHeader(MaxForwardsHeader.NAME);
    assertNotNull(maxForwardsHeader);
    // Non Regression test for http://code.google.com/p/mobicents/issues/detail?id=1490
    // B2buaHelper.createRequest does not decrement Max-forwards
    assertEquals(69, maxForwardsHeader.getMaxForwards());

    ListIterator<AllowHeader> allowHeaderIt =
        receiver.getInviteRequest().getHeaders(AllowHeader.NAME);
    int i = 0;
    while (allowHeaderIt.hasNext()) {
      allowHeaderIt.next();
      i++;
    }
    assertEquals(5, i);

    Header methodHeader = receiverProtocolObjects.headerFactory.createHeader("Supported", "");
    // Non Regression for Issue 184 http://code.google.com/p/sipservlets/issues/detail?id=184
    Header allowHeader =
        receiverProtocolObjects.headerFactory.createAllowHeader(
            "INVITE, CANCEL, BYE, ACK, OPTIONS");
    List<Header> headers = new ArrayList<Header>();
    headers.add(methodHeader);
    headers.add(allowHeader);

    sender.sendInDialogSipRequest("INVITE", null, null, null, headers, null);
    receiver.setInviteReceived(false);
    receiver.setAckReceived(false);
    Thread.sleep(TIMEOUT);
    assertTrue(receiver.isInviteReceived());
    assertTrue(receiver.isAckReceived());
    allowHeaderIt = receiver.getInviteRequest().getHeaders(AllowHeader.NAME);
    i = 0;
    while (allowHeaderIt.hasNext()) {
      allowHeaderIt.next();
      i++;
    }
    assertEquals(5, i);
    sender.sendInDialogSipRequest("BYE", null, null, null, null, null);
    Thread.sleep(TIMEOUT);
    assertTrue(receiver.getByeReceived());
    assertTrue(sender.getOkToByeReceived());
  }
    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 = "udp";
      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", "DEBUG");
      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("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, "udp");
        sipProvider = sipStack.createSipProvider(udpListeningPoint);
        Shootist listener = this;
        sipProvider.addSipListener(listener);

        String fromName = "BigGuy";
        String fromSipAddress = "here.com";
        String fromDisplayName = "The Master Blaster";

        String toSipAddress = "there.com";
        String toUser = "******";
        String toDisplayName = "The Little Blister";

        // create >From Header
        SipURI fromAddress = addressFactory.createSipURI(fromName, fromSipAddress);

        Address fromNameAddress = addressFactory.createAddress(fromAddress);
        fromNameAddress.setDisplayName(fromDisplayName);
        FromHeader fromHeader = headerFactory.createFromHeader(fromNameAddress, "12345");

        // create To Header
        SipURI toAddress = addressFactory.createSipURI(toUser, toSipAddress);
        Address toNameAddress = addressFactory.createAddress(toAddress);
        toNameAddress.setDisplayName(toDisplayName);
        ToHeader toHeader = headerFactory.createToHeader(toNameAddress, null);

        // create Request URI
        SipURI requestURI = addressFactory.createSipURI(toUser, peerHostPort);

        // Create ViaHeaders

        ArrayList viaHeaders = new ArrayList();
        String ipAddress = udpListeningPoint.getIPAddress();
        ViaHeader viaHeader =
            headerFactory.createViaHeader(
                ipAddress, sipProvider.getListeningPoint(transport).getPort(), transport, null);

        // add via headers
        viaHeaders.add(viaHeader);

        // Create ContentTypeHeader
        ContentTypeHeader contentTypeHeader =
            headerFactory.createContentTypeHeader("application", "sdp");

        // Create a new CallId header
        CallIdHeader callIdHeader = sipProvider.getNewCallId();

        // Create a new Cseq header
        CSeqHeader cSeqHeader = headerFactory.createCSeqHeader(1L, Request.INVITE);

        // Create a new MaxForwardsHeader
        MaxForwardsHeader maxForwards = headerFactory.createMaxForwardsHeader(70);

        // Create the request.
        Request request =
            messageFactory.createRequest(
                requestURI,
                Request.INVITE,
                callIdHeader,
                cSeqHeader,
                fromHeader,
                toHeader,
                viaHeaders,
                maxForwards);
        // Create contact headers
        String host = "127.0.0.1";

        SipURI contactUrl = addressFactory.createSipURI(fromName, host);
        contactUrl.setPort(udpListeningPoint.getPort());
        contactUrl.setLrParam();

        // Create the contact name address.
        SipURI contactURI = addressFactory.createSipURI(fromName, host);
        contactURI.setPort(sipProvider.getListeningPoint(transport).getPort());

        Address contactAddress = addressFactory.createAddress(contactURI);

        // Add the contact address.
        contactAddress.setDisplayName(fromName);

        contactHeader = headerFactory.createContactHeader(contactAddress);
        request.addHeader(contactHeader);

        // You can add extension headers of your own making
        // to the outgoing SIP request.
        // Add the extension header.
        Header extensionHeader = headerFactory.createHeader("My-Header", "my header value");
        request.addHeader(extensionHeader);

        String sdpData =
            "v=0\r\n"
                + "o=4855 13760799956958020 13760799956958020"
                + " IN IP4  129.6.55.78\r\n"
                + "s=mysession session\r\n"
                + "p=+46 8 52018010\r\n"
                + "c=IN IP4  129.6.55.78\r\n"
                + "t=0 0\r\n"
                + "m=audio 6022 RTP/AVP 0 4 18\r\n"
                + "a=rtpmap:0 PCMU/8000\r\n"
                + "a=rtpmap:4 G723/8000\r\n"
                + "a=rtpmap:18 G729A/8000\r\n"
                + "a=ptime:20\r\n";
        byte[] contents = sdpData.getBytes();

        request.setContent(contents, contentTypeHeader);
        // You can add as many extension headers as you
        // want.

        extensionHeader = headerFactory.createHeader("My-Other-Header", "my new header value ");
        request.addHeader(extensionHeader);

        Header callInfoHeader =
            headerFactory.createHeader("Call-Info", "<http://www.antd.nist.gov>");
        request.addHeader(callInfoHeader);

        // Create the client transaction.
        ClientTransaction inviteTid = sipProvider.getNewClientTransaction(request);

        // send the request out.
        inviteTid.sendRequest();

        dialog = inviteTid.getDialog();

      } catch (Exception ex) {
        fail("cannot create or send initial invite");
      }
    }
  public void setup() {
    /// System.out.println("=> BUNDLE: br.ufes.inf.ngn.televoto.client.logic | CLASS: LogicListener
    // | METOD: setup ");//By Ju
    try {
      // String log4jConfPath = "//etc//osgi//log4j.properties"; //comentei
      // PropertyConfigurator.configure(log4jConfPath);
      if (!Unregistring) { // Se é um registro
        Object parametros[] = new Object[9];
        parametros = getArguments();
        myDataSource = Activator.ds;
        myServer = (String) parametros[3];
        destination = (String) parametros[6];
        dialTimes = (Integer) parametros[7];
        useQueue = (String) parametros[8];

        try {
          myIP = InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException e) {
          e.printStackTrace();
        }

        mySipAlias = (String) parametros[0];
        myName = (String) this.getLocalName();
        myUserID = (String) parametros[1];
        ;
        myPassword = (String) parametros[5];
        myPort = (Integer) parametros[2];
        myAudioPort = (Integer) parametros[4];
        myProxyIP = (String) parametros[9];
        myProxyPort = (Integer) parametros[10];
        afmt = Activator.afmt;
        mySipFactory = SipFactory.getInstance();
        mySipFactory.setPathName("gov.nist");
      }
      mySdpManager = new SdpManager();
      answerInfo = new SdpInfo();
      offerInfo = new SdpInfo();

      myProperties = new Properties();
      myProperties.setProperty("javax.sip.STACK_NAME", myName);
      myProperties.setProperty(
          "javax.sip.OUTBOUND_PROXY", myProxyIP + ":" + myProxyPort + "/UDP"); // Proxy
      mySipStack = mySipFactory.createSipStack(myProperties);
      myMessageFactory = mySipFactory.createMessageFactory();
      myHeaderFactory = mySipFactory.createHeaderFactory();
      myAddressFactory = mySipFactory.createAddressFactory();
      if (!Unregistring) {
        myListeningPoint = mySipStack.createListeningPoint(myIP, myPort, "udp");
        mySipProvider = mySipStack.createSipProvider(myListeningPoint);
        mySipProvider.addSipListener(this);
      }

      myViaHeader = myHeaderFactory.createViaHeader(myIP, myPort, "udp", null);

      Address routeAddress = myAddressFactory.createAddress("sip:" + myServer + ";lr");
      myRouteHeader = myHeaderFactory.createRouteHeader(routeAddress);

      fromAddress = myAddressFactory.createAddress(myName + " <sip:" + myUserID + ">");

      Address registrarAddress = myAddressFactory.createAddress("sip:" + myServer);
      Address registerToAddress = fromAddress;
      Address registerFromAddress = fromAddress;

      ToHeader myToHeader = myHeaderFactory.createToHeader(registerToAddress, null);
      FromHeader myFromHeader = myHeaderFactory.createFromHeader(registerFromAddress, "647554");

      ArrayList myViaHeaders = new ArrayList();
      myViaHeaders.add(myViaHeader);

      MaxForwardsHeader myMaxForwardsHeader = myHeaderFactory.createMaxForwardsHeader(70);
      Random random = new Random();
      CSeqHeader myCSeqHeader =
          myHeaderFactory.createCSeqHeader(random.nextInt(1000) * 1L, "REGISTER");

      CallIdHeader myCallIDHeader = mySipProvider.getNewCallId();
      SipURI myRequestURI = (SipURI) registrarAddress.getURI();
      Request myRegisterRequest =
          myMessageFactory.createRequest(
              myRequestURI,
              "REGISTER",
              myCallIDHeader,
              myCSeqHeader,
              myFromHeader,
              myToHeader,
              myViaHeaders,
              myMaxForwardsHeader);

      // Expires
      ExpiresHeader myExpiresHeader;
      if (Unregistring) {
        myContactHeader.setExpires(0);
        myExpiresHeader = myHeaderFactory.createExpiresHeader(0);
      } else {
        myExpiresHeader = myHeaderFactory.createExpiresHeader(60000);
      }
      myRegisterRequest.addHeader(myExpiresHeader);

      // Allow
      Allow myAllow = new Allow();
      myAllow.setMethod("INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER");
      myRegisterRequest.addHeader(myAllow);

      // Contact
      Address contactAddress =
          myAddressFactory.createAddress(
              "sip:" + myName + '@' + myIP + ":" + myPort + ";transport=udp");
      myContactHeader = myHeaderFactory.createContactHeader(contactAddress);
      myRegisterRequest.addHeader(myContactHeader);

      // Authorization
      Authorization myAuthorization = new Authorization();
      myAuthorization.setScheme("Digest");
      myAuthorization.setUsername(myUserID);
      myAuthorization.setRealm(myServer);
      myAuthorization.setNonce("");
      myAuthorization.setURI(myRegisterRequest.getRequestURI());
      myAuthorization.setResponse("");
      myRegisterRequest.addHeader(myAuthorization);

      // PPreferredIdentity
      HeaderFactoryImpl myHeaderFactoryImpl = new HeaderFactoryImpl();
      PPreferredIdentityHeader myPPreferredIdentityHeader =
          myHeaderFactoryImpl.createPPreferredIdentityHeader(
              myAddressFactory.createAddress("sip:" + myName + '@' + myServer));
      myRegisterRequest.addHeader(myPPreferredIdentityHeader);

      // Privacy
      Privacy myPrivacy = new Privacy("none");
      myRegisterRequest.addHeader(myPrivacy);

      // Supported
      Supported mySupported = new Supported("path");
      myRegisterRequest.addHeader(mySupported);

      // Envia requisição SIP
      myClientTransaction = mySipProvider.getNewClientTransaction(myRegisterRequest);
      myClientTransaction.sendRequest();

      // logger.info(myRegisterRequest.toString());
      // System.out.println(">>> " + myRegisterRequest.toString());
      status = REGISTERING;
    } catch (Exception e) {
      e.printStackTrace();
    }
  }