Lawrence
2020-06-25 e9e4e8d44a885b98e23c159015772c8d82a4878f
src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
@@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181;
import java.text.ParseException;
import java.util.Properties;
import javax.annotation.PostConstruct;
@@ -59,10 +60,10 @@
   @PostConstruct
   private void initSipServer() {
      Thread thread=new Thread(this);
        thread.setDaemon(true);
        thread.setName("sip server thread start");
        thread.start();
      Thread thread = new Thread(this);
      thread.setDaemon(true);
      thread.setName("sip server thread start");
      thread.start();
   }
   @Override
@@ -84,7 +85,7 @@
          * 0; public static final int TRACE_MESSAGES = 16; public static final int
          * TRACE_EXCEPTION = 17; public static final int TRACE_DEBUG = 32;
          */
         properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "0");
         properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
         properties.setProperty("gov.nist.javax.sip.SERVER_LOG", "sip_server_log");
         properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "sip_debug_log");
         sipStack = (SipStackImpl) sipFactory.createSipStack(properties);
@@ -99,13 +100,15 @@
   }
   private void startTcpListener() throws Exception {
      ListeningPoint tcpListeningPoint = sipStack.createListeningPoint(sipConfig.getSipIp(), sipConfig.getSipPort(), "TCP");
      ListeningPoint tcpListeningPoint = sipStack.createListeningPoint(sipConfig.getSipIp(), sipConfig.getSipPort(),
            "TCP");
      tcpSipProvider = sipStack.createSipProvider(tcpListeningPoint);
      tcpSipProvider.addSipListener(this);
   }
   private void startUdpListener() throws Exception {
      ListeningPoint udpListeningPoint = sipStack.createListeningPoint(sipConfig.getSipIp(), sipConfig.getSipPort(), "UDP");
      ListeningPoint udpListeningPoint = sipStack.createListeningPoint(sipConfig.getSipIp(), sipConfig.getSipPort(),
            "UDP");
      udpSipProvider = sipStack.createSipProvider(udpListeningPoint);
      udpSipProvider.addSipListener(this);
   }
@@ -126,14 +129,23 @@
      int status = response.getStatusCode();
      if ((status >= 200) && (status < 300)) { // Success!
         ISIPResponseProcessor processor = processorFactory.createResponseProcessor(evt);
         processor.process(evt, this, sipConfig);
         try {
            processor.process(evt, this, sipConfig);
         } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
         }
      // } else if (status == Response.TRYING) {
         // trying不会回复
      } else if ((status >= 100) && (status < 200)) {
         // 增加其它无需回复的响应,如101、180等
      } else {
         logger.warn("接收到失败的response响应!status:" + status + ",message:" + response.getContent().toString());
         logger.warn("接收到失败的response响应!status:" + status + ",message:" + response.getReasonPhrase()/* .getContent().toString()*/);
      }
      // trying不会回复
      if (status == Response.TRYING) {
      // if (status == Response.TRYING) {
      }
      // }
   }
   /**