コード例 #1
0
 /** {@inheritDoc} */
 public synchronized void addConnector(Connector connector) {
   if (connector.getProtocolHandler() instanceof SipProtocolHandler) {
     final SipStandardService sipService = this.sipService;
     sipService.addConnector(connector);
   }
 }
コード例 #2
0
  /** {@inheritDoc} */
  public synchronized void start(StartContext context) throws StartException {
    if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
      // Set the MBeanServer
      final MBeanServer mbeanServer = this.mbeanServer.getOptionalValue();
      if (mbeanServer != null) {
        Registry.getRegistry(null, null).setMBeanServer(mbeanServer);
      }
    }

    System.setProperty(
        "catalina.home", pathManagerInjector.getValue().getPathEntry(TEMP_DIR).resolvePath());
    server = new StandardServer();

    //        final StandardService service = new StandardService();
    //        service.setName(JBOSS_SIP);
    //        service.setServer(server);
    //        server.addService(service);

    //        final Engine engine = new StandardEngine();
    //        engine.setName(JBOSS_SIP);
    //        engine.setService(service);
    //        engine.setDefaultHost(defaultHost);
    //        if (instanceId != null) {
    //            engine.setJvmRoute(instanceId);
    //        }
    //
    //        service.setContainer(engine);

    //        if (useNative) {
    //            final AprLifecycleListener apr = new AprLifecycleListener();
    //            apr.setSSLEngine("on");
    //            server.addLifecycleListener(apr);
    //        }
    //        server.addLifecycleListener(new JasperListener());

    sipService = new SipStandardService();
    // https://code.google.com/p/sipservlets/issues/detail?id=277
    // Add the Service and sip app dispatched right away so apps can get the needed objects
    // when they deploy fast
    server.addService(sipService);

    if (sipAppDispatcherClass != null) {
      sipService.setSipApplicationDispatcherClassName(sipAppDispatcherClass);
    } else {
      sipService.setSipApplicationDispatcherClassName(SipApplicationDispatcherImpl.class.getName());
    }
    //
    final String baseDir = System.getProperty("jboss.server.base.dir");
    if (sipAppRouterFile != null) {
      if (!sipAppRouterFile.startsWith(FILE_PREFIX_PATH)) {
        sipAppRouterFile = FILE_PREFIX_PATH.concat(baseDir).concat("/").concat(sipAppRouterFile);
      }
      System.setProperty("javax.servlet.sip.dar", sipAppRouterFile);
    }
    //
    sipService.setSipPathName(sipPathName);
    //
    if (sipStackPropertiesFile != null) {
      if (!sipStackPropertiesFile.startsWith(FILE_PREFIX_PATH)) {
        sipStackPropertiesFile =
            FILE_PREFIX_PATH.concat(baseDir).concat("/").concat(sipStackPropertiesFile);
      }
    }
    sipService.setSipStackPropertiesFile(sipStackPropertiesFile);
    //
    if (sipConcurrencyControlMode != null) {
      sipService.setConcurrencyControlMode(sipConcurrencyControlMode);
    } else {
      sipService.setConcurrencyControlMode("None");
    }
    //
    sipService.setCongestionControlCheckingInterval(sipCongestionControlInterval);
    //
    sipService.setUsePrettyEncoding(usePrettyEncoding);
    //
    sipService.setBaseTimerInterval(baseTimerInterval);
    sipService.setT2Interval(t2Interval);
    sipService.setT4Interval(t4Interval);
    sipService.setTimerDInterval(timerDInterval);
    if (additionalParameterableHeaders != null) {
      sipService.setAdditionalParameterableHeaders(additionalParameterableHeaders);
    }
    sipService.setDialogPendingRequestChecking(dialogPendingRequestChecking);
    sipService.setDnsServerLocatorClass(dnsServerLocatorClass);
    sipService.setDnsTimeout(dnsTimeout);
    sipService.setDnsResolverClass(dnsResolverClass);
    sipService.setCanceledTimerTasksPurgePeriod(canceledTimerTasksPurgePeriod);
    sipService.setMemoryThreshold(memoryThreshold);
    sipService.setBackToNormalMemoryThreshold(backToNormalMemoryThreshold);
    sipService.setCongestionControlPolicy(congestionControlPolicy);
    sipService.setOutboundProxy(outboundProxy);
    sipService.setName(JBOSS_SIP);
    sipService.setServer(server);

    sipEngine = new SipStandardEngine();
    sipEngine.setName(JBOSS_SIP);
    sipEngine.setService(sipService);
    //        sipEngine.setDefaultHost(defaultHost);
    if (instanceId != null) {
      sipEngine.setJvmRoute(instanceId);
    }
    sipService.setContainer(sipEngine);

    try {
      server.init();
      server.start();
    } catch (Exception e) {
      throw new StartException(MESSAGES.errorStartingSip(), e);
    }
  }