From e9e4e8d44a885b98e23c159015772c8d82a4878f Mon Sep 17 00:00:00 2001 From: Lawrence <1934378145@qq.com> Date: 星期四, 25 六月 2020 15:16:13 +0800 Subject: [PATCH] 增加对invite其它响应的应对,如101 Dialog Establishement等 --- src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java | 34 +++++++++++++++++++++++----------- 1 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java index cfea026..64525d7 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java +++ b/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鍝嶅簲锛乻tatus锛�" + status + ",message:" + response.getContent().toString()); + logger.warn("鎺ユ敹鍒板け璐ョ殑response鍝嶅簲锛乻tatus锛�" + status + ",message:" + response.getReasonPhrase()/* .getContent().toString()*/); } // trying涓嶄細鍥炲 - if (status == Response.TRYING) { + // if (status == Response.TRYING) { - } + // } } /** -- Gitblit v1.8.0