64850858
2021-07-07 a603f9978632fd0a5806ac87389fe8dd254e23b9
src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
@@ -72,7 +72,7 @@
   private SipStack createSipStack() throws PeerUnavailableException {
      Properties properties = new Properties();
      properties.setProperty("javax.sip.STACK_NAME", "GB28181_SIP");
      properties.setProperty("javax.sip.IP_ADDRESS", sipConfig.getSipIp());
      properties.setProperty("javax.sip.IP_ADDRESS", sipConfig.getMonitorIp());
      properties.setProperty("gov.nist.javax.sip.LOG_MESSAGE_CONTENT", "false");
      /**
       * sip_server_log.log 和 sip_debug_log.log public static final int TRACE_NONE =
@@ -92,7 +92,7 @@
      ListeningPoint tcpListeningPoint = null;
      SipProvider tcpSipProvider  = null;
      try {
         tcpListeningPoint = sipStack.createListeningPoint(sipConfig.getSipIp(), sipConfig.getSipPort(), "TCP");
         tcpListeningPoint = sipStack.createListeningPoint(sipConfig.getMonitorIp(), sipConfig.getSipPort(), "TCP");
         tcpSipProvider = sipStack.createSipProvider(tcpListeningPoint);
         tcpSipProvider.addSipListener(this);
         logger.info("Sip Server TCP 启动成功 port {" + sipConfig.getSipPort() + "}");
@@ -105,7 +105,7 @@
   @Bean("udpSipProvider")
   @DependsOn("sipStack")
   private SipProvider startUdpListener() throws Exception {
      ListeningPoint udpListeningPoint = sipStack.createListeningPoint(sipConfig.getSipIp(), sipConfig.getSipPort(), "UDP");
      ListeningPoint udpListeningPoint = sipStack.createListeningPoint(sipConfig.getMonitorIp(), sipConfig.getSipPort(), "UDP");
      SipProvider udpSipProvider = sipStack.createSipProvider(udpListeningPoint);
      udpSipProvider.addSipListener(this);
      logger.info("Sip Server UDP 启动成功 port {" + sipConfig.getSipPort() + "}");
@@ -118,19 +118,21 @@
    */
   @Override
   public void processRequest(RequestEvent evt) {
      logger.debug(evt.getRequest().toString());
//      logger.debug(evt.getRequest().toString());
      // 由于jainsip是单线程程序,为提高性能并发处理
      processThreadPool.execute(() -> {
         processorFactory.createRequestProcessor(evt).process();
         if (processorFactory != null) {
            processorFactory.createRequestProcessor(evt).process();
         }
      });
   }
   @Override
   public void processResponse(ResponseEvent evt) {
      Response response = evt.getResponse();
      logger.debug(evt.getResponse().toString());
//      logger.debug(evt.getResponse().toString());
      int status = response.getStatusCode();
      if ((status >= 200) && (status < 300)) { // Success!
      if (((status >= 200) && (status < 300)) || status == 401) { // Success!
         ISIPResponseProcessor processor = processorFactory.createResponseProcessor(evt);
         try {
            processor.process(evt, this, sipConfig);
@@ -147,8 +149,6 @@
               }
            }
         }
      // } else if (status == Response.TRYING) {
         // trying不会回复
      } else if ((status >= 100) && (status < 200)) {
         // 增加其它无需回复的响应,如101、180等
      } else {