使用equalsIgnoreCase代替equals,忽略大小写差异

pull/608/head
648540858 2022-09-02 10:51:55 +08:00
parent b46e5efad2
commit 7db2bf7b51
15 changed files with 70 additions and 92 deletions

View File

@ -128,7 +128,7 @@ public class ProxyServletConfig {
MediaServerItem getMediaInfoByUri(String uri){ MediaServerItem getMediaInfoByUri(String uri){
String[] split = uri.split("/"); String[] split = uri.split("/");
String mediaServerId = split[2]; String mediaServerId = split[2];
if ("default".equals(mediaServerId)) { if ("default".equalsIgnoreCase(mediaServerId)) {
return mediaServerService.getDefaultMediaServer(); return mediaServerService.getDefaultMediaServer();
}else { }else {
return mediaServerService.getOne(mediaServerId); return mediaServerService.getOne(mediaServerId);
@ -246,7 +246,7 @@ public class ProxyServletConfig {
MediaServerItem getMediaInfoByUri(String uri){ MediaServerItem getMediaInfoByUri(String uri){
String[] split = uri.split("/"); String[] split = uri.split("/");
String mediaServerId = split[2]; String mediaServerId = split[2];
if ("default".equals(mediaServerId)) { if ("default".equalsIgnoreCase(mediaServerId)) {
return mediaServerService.getDefaultMediaServer(); return mediaServerService.getDefaultMediaServer();
}else { }else {
return mediaServerService.getOne(mediaServerId); return mediaServerService.getOne(mediaServerId);

View File

@ -47,12 +47,16 @@ public class SipLayer{
/** /**
* gov.nist.javax.sip.SipStackImpl * gov.nist.javax.sip.SipStackImpl
* gov/nist/javax/sip/SipStackImpl.class * gov/nist/javax/sip/SipStackImpl.class
* sip gov.nist.javax.sip.stack.UDPMessageChannelprocessIncomingDataPacket
*/ */
// * gov/nist/javax/sip/SipStackImpl.class
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
properties.setProperty("gov.nist.javax.sip.LOG_MESSAGE_CONTENT", "false"); properties.setProperty("gov.nist.javax.sip.LOG_MESSAGE_CONTENT", "false");
} }
// 接收所有notify请求即使没有订阅 // 接收所有notify请求即使没有订阅
properties.setProperty("gov.nist.javax.sip.DELIVER_UNSOLICITED_NOTIFY", "true"); properties.setProperty("gov.nist.javax.sip.DELIVER_UNSOLICITED_NOTIFY", "true");
properties.setProperty("gov.nist.javax.sip.AUTOMATIC_DIALOG_ERROR_HANDLING", "false");
properties.setProperty("gov.nist.javax.sip.CANCEL_CLIENT_TRANSACTION_CHECKED", "false");
// 为_NULL _对话框传递_终止的_事件 // 为_NULL _对话框传递_终止的_事件
properties.setProperty("gov.nist.javax.sip.DELIVER_TERMINATED_EVENT_FOR_NULL_DIALOG", "true"); properties.setProperty("gov.nist.javax.sip.DELIVER_TERMINATED_EVENT_FOR_NULL_DIALOG", "true");
// 会话清理策略 // 会话清理策略
@ -64,7 +68,7 @@ public class SipLayer{
* sip_server_log.log sip_debug_log.log ERROR, INFO, WARNING, OFF, DEBUG, TRACE * sip_server_log.log sip_debug_log.log ERROR, INFO, WARNING, OFF, DEBUG, TRACE
*/ */
properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "ERROR"); properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "ERROR");
properties.setProperty("gov.nist.javax.sip.SIP_MESSAGE_VALVE", "com.genersoft.iot.vmp.gb28181.session.SipMessagePreprocessing"); // properties.setProperty("gov.nist.javax.sip.SIP_MESSAGE_VALVE", "com.genersoft.iot.vmp.gb28181.session.SipMessagePreprocessing");
// if (logger.isDebugEnabled()) { // if (logger.isDebugEnabled()) {
// properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "DEBUG"); // properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "DEBUG");
// } // }

View File

@ -218,7 +218,7 @@ public class DigestServerAuthenticationHelper {
logger.debug("qop: " + qop); logger.debug("qop: " + qop);
String KD = HA1 + ":" + nonce; String KD = HA1 + ":" + nonce;
if (qop != null && qop.equals("auth") ) { if (qop != null && qop.equalsIgnoreCase("auth") ) {
if (nc != -1) { if (nc != -1) {
KD += ":" + ncStr; KD += ":" + ncStr;
} }

View File

@ -1,30 +0,0 @@
package com.genersoft.iot.vmp.gb28181.session;
import gov.nist.javax.sip.message.SIPRequest;
import gov.nist.javax.sip.stack.MessageChannel;
import gov.nist.javax.sip.stack.SIPMessageValve;
import javax.sip.SipStack;
import javax.sip.message.Response;
public class SipMessagePreprocessing implements SIPMessageValve {
@Override
public boolean processRequest(SIPRequest sipRequest, MessageChannel messageChannel) {
return false;
}
@Override
public boolean processResponse(Response response, MessageChannel messageChannel) {
return false;
}
@Override
public void init(SipStack sipStack) {
}
@Override
public void destroy() {
}
}

View File

@ -72,6 +72,9 @@ public class SIPProcessorObserver implements ISIPProcessorObserver {
@Async @Async
public void processRequest(RequestEvent requestEvent) { public void processRequest(RequestEvent requestEvent) {
String method = requestEvent.getRequest().getMethod(); String method = requestEvent.getRequest().getMethod();
if ("NOTIFY".equalsIgnoreCase(requestEvent.getRequest().getMethod())) {
System.out.println();
}
ISIPRequestProcessor sipRequestProcessor = requestProcessorMap.get(method); ISIPRequestProcessor sipRequestProcessor = requestProcessorMap.get(method);
if (sipRequestProcessor == null) { if (sipRequestProcessor == null) {
logger.warn("不支持方法{}的request", method); logger.warn("不支持方法{}的request", method);
@ -91,7 +94,8 @@ public class SIPProcessorObserver implements ISIPProcessorObserver {
Response response = responseEvent.getResponse(); Response response = responseEvent.getResponse();
int status = response.getStatusCode(); int status = response.getStatusCode();
if (((status >= 200) && (status < 300)) || status == Response.UNAUTHORIZED) { // Success! // Success
if (((status >= Response.OK) && (status < Response.MULTIPLE_CHOICES)) || status == Response.UNAUTHORIZED) {
CSeqHeader cseqHeader = (CSeqHeader) responseEvent.getResponse().getHeader(CSeqHeader.NAME); CSeqHeader cseqHeader = (CSeqHeader) responseEvent.getResponse().getHeader(CSeqHeader.NAME);
String method = cseqHeader.getMethod(); String method = cseqHeader.getMethod();
ISIPResponseProcessor sipRequestProcessor = responseProcessorMap.get(method); ISIPResponseProcessor sipRequestProcessor = responseProcessorMap.get(method);
@ -109,7 +113,7 @@ public class SIPProcessorObserver implements ISIPProcessorObserver {
} }
} }
} }
} else if ((status >= 100) && (status < 200)) { } else if ((status >= Response.TRYING) && (status < Response.OK)) {
// 增加其它无需回复的响应如101、180等 // 增加其它无需回复的响应如101、180等
} else { } else {
logger.warn("接收到失败的response响应status" + status + ",message:" + response.getReasonPhrase()); logger.warn("接收到失败的response响应status" + status + ",message:" + response.getReasonPhrase());

View File

@ -146,12 +146,12 @@ public class SIPRequestHeaderPlarformProvider {
String cNonce = null; String cNonce = null;
String nc = "00000001"; String nc = "00000001";
if (qop != null) { if (qop != null) {
if ("auth".equals(qop)) { if ("auth".equalsIgnoreCase(qop)) {
// 客户端随机数,这是一个不透明的字符串值,由客户端提供,并且客户端和服务器都会使用,以避免用明文文本。 // 客户端随机数,这是一个不透明的字符串值,由客户端提供,并且客户端和服务器都会使用,以避免用明文文本。
// 这使得双方都可以查验对方的身份,并对消息的完整性提供一些保护 // 这使得双方都可以查验对方的身份,并对消息的完整性提供一些保护
cNonce = UUID.randomUUID().toString(); cNonce = UUID.randomUUID().toString();
}else if ("auth-int".equals(qop)){ }else if ("auth-int".equalsIgnoreCase(qop)){
// TODO // TODO
} }
} }

View File

@ -247,7 +247,7 @@ public class SIPCommander implements ISIPCommander {
String tm = Long.toString(System.currentTimeMillis()); String tm = Long.toString(System.currentTimeMillis());
CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() CallIdHeader callIdHeader = device.getTransport().equalsIgnoreCase("TCP") ? tcpSipProvider.getNewCallId()
: udpSipProvider.getNewCallId(); : udpSipProvider.getNewCallId();
Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "z9hG4bK-ViaPtz-" + tm, "FromPtz" + tm, null, callIdHeader); Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "z9hG4bK-ViaPtz-" + tm, "FromPtz" + tm, null, callIdHeader);
@ -290,7 +290,7 @@ public class SIPCommander implements ISIPCommander {
String tm = Long.toString(System.currentTimeMillis()); String tm = Long.toString(System.currentTimeMillis());
CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() CallIdHeader callIdHeader = device.getTransport().equalsIgnoreCase("TCP") ? tcpSipProvider.getNewCallId()
: udpSipProvider.getNewCallId(); : udpSipProvider.getNewCallId();
Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "z9hG4bK-ViaPtz-" + tm, "FromPtz" + tm, null, callIdHeader); Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "z9hG4bK-ViaPtz-" + tm, "FromPtz" + tm, null, callIdHeader);
@ -326,7 +326,7 @@ public class SIPCommander implements ISIPCommander {
String tm = Long.toString(System.currentTimeMillis()); String tm = Long.toString(System.currentTimeMillis());
CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() CallIdHeader callIdHeader = device.getTransport().equalsIgnoreCase("TCP") ? tcpSipProvider.getNewCallId()
: udpSipProvider.getNewCallId(); : udpSipProvider.getNewCallId();
Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "z9hG4bK-ViaPtz-" + tm, "FromPtz" + tm, null, callIdHeader); Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "z9hG4bK-ViaPtz-" + tm, "FromPtz" + tm, null, callIdHeader);
@ -353,7 +353,7 @@ public class SIPCommander implements ISIPCommander {
if (device == null) { if (device == null) {
return; return;
} }
String streamMode = device.getStreamMode().toUpperCase(); // String streamMode = device.getStreamMode().toUpperCase();
logger.info("{} 分配的ZLM为: {} [{}:{}]", stream, mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort()); logger.info("{} 分配的ZLM为: {} [{}:{}]", stream, mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort());
HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", stream, true, "rtmp", mediaServerItem.getId()); HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", stream, true, "rtmp", mediaServerItem.getId());
@ -372,11 +372,11 @@ public class SIPCommander implements ISIPCommander {
content.append("t=0 0\r\n"); content.append("t=0 0\r\n");
if (userSetting.isSeniorSdp()) { if (userSetting.isSeniorSdp()) {
if("TCP-PASSIVE".equals(streamMode)) { if("TCP-PASSIVE".equalsIgnoreCase(device.getStreamMode())) {
content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
}else if ("TCP-ACTIVE".equals(streamMode)) { }else if ("TCP-ACTIVE".equalsIgnoreCase(device.getStreamMode())) {
content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
}else if("UDP".equals(streamMode)) { }else if("UDP".equalsIgnoreCase(device.getStreamMode())) {
content.append("m=video "+ ssrcInfo.getPort() +" RTP/AVP 96 126 125 99 34 98 97\r\n"); content.append("m=video "+ ssrcInfo.getPort() +" RTP/AVP 96 126 125 99 34 98 97\r\n");
} }
content.append("a=recvonly\r\n"); content.append("a=recvonly\r\n");
@ -388,19 +388,19 @@ public class SIPCommander implements ISIPCommander {
content.append("a=rtpmap:99 H265/90000\r\n"); content.append("a=rtpmap:99 H265/90000\r\n");
content.append("a=rtpmap:98 H264/90000\r\n"); content.append("a=rtpmap:98 H264/90000\r\n");
content.append("a=rtpmap:97 MPEG4/90000\r\n"); content.append("a=rtpmap:97 MPEG4/90000\r\n");
if("TCP-PASSIVE".equals(streamMode)){ // tcp被动模式 if("TCP-PASSIVE".equalsIgnoreCase(device.getStreamMode())){ // tcp被动模式
content.append("a=setup:passive\r\n"); content.append("a=setup:passive\r\n");
content.append("a=connection:new\r\n"); content.append("a=connection:new\r\n");
}else if ("TCP-ACTIVE".equals(streamMode)) { // tcp主动模式 }else if ("TCP-ACTIVE".equalsIgnoreCase(device.getStreamMode())) { // tcp主动模式
content.append("a=setup:active\r\n"); content.append("a=setup:active\r\n");
content.append("a=connection:new\r\n"); content.append("a=connection:new\r\n");
} }
}else { }else {
if("TCP-PASSIVE".equals(streamMode)) { if("TCP-PASSIVE".equalsIgnoreCase(device.getStreamMode())) {
content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 97 98 99\r\n"); content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 97 98 99\r\n");
}else if ("TCP-ACTIVE".equals(streamMode)) { }else if ("TCP-ACTIVE".equalsIgnoreCase(device.getStreamMode())) {
content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 97 98 99\r\n"); content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 97 98 99\r\n");
}else if("UDP".equals(streamMode)) { }else if("UDP".equalsIgnoreCase(device.getStreamMode())) {
content.append("m=video "+ ssrcInfo.getPort() +" RTP/AVP 96 97 98 99\r\n"); content.append("m=video "+ ssrcInfo.getPort() +" RTP/AVP 96 97 98 99\r\n");
} }
content.append("a=recvonly\r\n"); content.append("a=recvonly\r\n");
@ -408,10 +408,10 @@ public class SIPCommander implements ISIPCommander {
content.append("a=rtpmap:98 H264/90000\r\n"); content.append("a=rtpmap:98 H264/90000\r\n");
content.append("a=rtpmap:97 MPEG4/90000\r\n"); content.append("a=rtpmap:97 MPEG4/90000\r\n");
content.append("a=rtpmap:99 H265/90000\r\n"); content.append("a=rtpmap:99 H265/90000\r\n");
if ("TCP-PASSIVE".equals(streamMode)) { // tcp被动模式 if ("TCP-PASSIVE".equalsIgnoreCase(device.getStreamMode())) { // tcp被动模式
content.append("a=setup:passive\r\n"); content.append("a=setup:passive\r\n");
content.append("a=connection:new\r\n"); content.append("a=connection:new\r\n");
} else if ("TCP-ACTIVE".equals(streamMode)) { // tcp主动模式 } else if ("TCP-ACTIVE".equalsIgnoreCase(device.getStreamMode())) { // tcp主动模式
content.append("a=setup:active\r\n"); content.append("a=setup:active\r\n");
content.append("a=connection:new\r\n"); content.append("a=connection:new\r\n");
} }
@ -423,7 +423,7 @@ public class SIPCommander implements ISIPCommander {
String tm = Long.toString(System.currentTimeMillis()); String tm = Long.toString(System.currentTimeMillis());
CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() CallIdHeader callIdHeader = device.getTransport().equalsIgnoreCase("TCP") ? tcpSipProvider.getNewCallId()
: udpSipProvider.getNewCallId(); : udpSipProvider.getNewCallId();
Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, "FromInvt" + tm, null, ssrcInfo.getSsrc(), callIdHeader); Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, "FromInvt" + tm, null, ssrcInfo.getSsrc(), callIdHeader);
@ -470,14 +470,14 @@ public class SIPCommander implements ISIPCommander {
content.append("t="+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)+" " content.append("t="+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)+" "
+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) +"\r\n"); +DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) +"\r\n");
String streamMode = device.getStreamMode().toUpperCase(); String streamMode = device.getStreamMode();
if (userSetting.isSeniorSdp()) { if (userSetting.isSeniorSdp()) {
if("TCP-PASSIVE".equals(streamMode)) { if("TCP-PASSIVE".equalsIgnoreCase(streamMode)) {
content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
}else if ("TCP-ACTIVE".equals(streamMode)) { }else if ("TCP-ACTIVE".equalsIgnoreCase(streamMode)) {
content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
}else if("UDP".equals(streamMode)) { }else if("UDP".equalsIgnoreCase(streamMode)) {
content.append("m=video "+ ssrcInfo.getPort() +" RTP/AVP 96 126 125 99 34 98 97\r\n"); content.append("m=video "+ ssrcInfo.getPort() +" RTP/AVP 96 126 125 99 34 98 97\r\n");
} }
content.append("a=recvonly\r\n"); content.append("a=recvonly\r\n");
@ -489,19 +489,19 @@ public class SIPCommander implements ISIPCommander {
content.append("a=rtpmap:99 H265/90000\r\n"); content.append("a=rtpmap:99 H265/90000\r\n");
content.append("a=rtpmap:98 H264/90000\r\n"); content.append("a=rtpmap:98 H264/90000\r\n");
content.append("a=rtpmap:97 MPEG4/90000\r\n"); content.append("a=rtpmap:97 MPEG4/90000\r\n");
if("TCP-PASSIVE".equals(streamMode)){ // tcp被动模式 if("TCP-PASSIVE".equalsIgnoreCase(streamMode)){ // tcp被动模式
content.append("a=setup:passive\r\n"); content.append("a=setup:passive\r\n");
content.append("a=connection:new\r\n"); content.append("a=connection:new\r\n");
}else if ("TCP-ACTIVE".equals(streamMode)) { // tcp主动模式 }else if ("TCP-ACTIVE".equalsIgnoreCase(streamMode)) { // tcp主动模式
content.append("a=setup:active\r\n"); content.append("a=setup:active\r\n");
content.append("a=connection:new\r\n"); content.append("a=connection:new\r\n");
} }
}else { }else {
if("TCP-PASSIVE".equals(streamMode)) { if("TCP-PASSIVE".equalsIgnoreCase(streamMode)) {
content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 97 98 99\r\n"); content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 97 98 99\r\n");
}else if ("TCP-ACTIVE".equals(streamMode)) { }else if ("TCP-ACTIVE".equalsIgnoreCase(streamMode)) {
content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 97 98 99\r\n"); content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 97 98 99\r\n");
}else if("UDP".equals(streamMode)) { }else if("UDP".equalsIgnoreCase(streamMode)) {
content.append("m=video "+ ssrcInfo.getPort() +" RTP/AVP 96 97 98 99\r\n"); content.append("m=video "+ ssrcInfo.getPort() +" RTP/AVP 96 97 98 99\r\n");
} }
content.append("a=recvonly\r\n"); content.append("a=recvonly\r\n");
@ -509,10 +509,10 @@ public class SIPCommander implements ISIPCommander {
content.append("a=rtpmap:97 MPEG4/90000\r\n"); content.append("a=rtpmap:97 MPEG4/90000\r\n");
content.append("a=rtpmap:98 H264/90000\r\n"); content.append("a=rtpmap:98 H264/90000\r\n");
content.append("a=rtpmap:99 H265/90000\r\n"); content.append("a=rtpmap:99 H265/90000\r\n");
if("TCP-PASSIVE".equals(streamMode)){ // tcp被动模式 if("TCP-PASSIVE".equalsIgnoreCase(streamMode)){ // tcp被动模式
content.append("a=setup:passive\r\n"); content.append("a=setup:passive\r\n");
content.append("a=connection:new\r\n"); content.append("a=connection:new\r\n");
}else if ("TCP-ACTIVE".equals(streamMode)) { // tcp主动模式 }else if ("TCP-ACTIVE".equalsIgnoreCase(streamMode)) { // tcp主动模式
content.append("a=setup:active\r\n"); content.append("a=setup:active\r\n");
content.append("a=connection:new\r\n"); content.append("a=connection:new\r\n");
} }

View File

@ -92,10 +92,10 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
String tm = Long.toString(System.currentTimeMillis()); String tm = Long.toString(System.currentTimeMillis());
if (!registerAgain ) { if (!registerAgain ) {
CallIdHeader callIdHeader = null; CallIdHeader callIdHeader = null;
if(parentPlatform.getTransport().equals("TCP")) { if(parentPlatform.getTransport().equalsIgnoreCase("TCP")) {
callIdHeader = tcpSipProvider.getNewCallId(); callIdHeader = tcpSipProvider.getNewCallId();
} }
if(parentPlatform.getTransport().equals("UDP")) { if(parentPlatform.getTransport().equalsIgnoreCase("UDP")) {
callIdHeader = udpSipProvider.getNewCallId(); callIdHeader = udpSipProvider.getNewCallId();
} }
@ -119,7 +119,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
}); });
}else { }else {
CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() CallIdHeader callIdHeader = parentPlatform.getTransport().equalsIgnoreCase("TCP") ? tcpSipProvider.getNewCallId()
: udpSipProvider.getNewCallId(); : udpSipProvider.getNewCallId();
request = headerProviderPlarformProvider.createRegisterRequest(parentPlatform, "FromRegister" + tm, null, callId, www, callIdHeader, isRegister); request = headerProviderPlarformProvider.createRegisterRequest(parentPlatform, "FromRegister" + tm, null, callId, www, callIdHeader, isRegister);
} }
@ -152,7 +152,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
keepaliveXml.append("<Status>OK</Status>\r\n"); keepaliveXml.append("<Status>OK</Status>\r\n");
keepaliveXml.append("</Notify>\r\n"); keepaliveXml.append("</Notify>\r\n");
CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() CallIdHeader callIdHeader = parentPlatform.getTransport().equalsIgnoreCase("TCP") ? tcpSipProvider.getNewCallId()
: udpSipProvider.getNewCallId(); : udpSipProvider.getNewCallId();
Request request = headerProviderPlarformProvider.createKeetpaliveMessageRequest( Request request = headerProviderPlarformProvider.createKeetpaliveMessageRequest(
@ -180,10 +180,10 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
private void transmitRequest(ParentPlatform parentPlatform, Request request, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws SipException { private void transmitRequest(ParentPlatform parentPlatform, Request request, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws SipException {
logger.debug("\n发送消息\n{}", request); logger.debug("\n发送消息\n{}", request);
if("TCP".equals(parentPlatform.getTransport())) { if("TCP".equalsIgnoreCase(parentPlatform.getTransport())) {
tcpSipProvider.sendRequest(request); tcpSipProvider.sendRequest(request);
} else if("UDP".equals(parentPlatform.getTransport())) { } else if("UDP".equalsIgnoreCase(parentPlatform.getTransport())) {
udpSipProvider.sendRequest(request); udpSipProvider.sendRequest(request);
} }
@ -219,7 +219,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
String catalogXml = getCatalogXml(channels, sn, parentPlatform, size); String catalogXml = getCatalogXml(channels, sn, parentPlatform, size);
// callid // callid
CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() CallIdHeader callIdHeader = parentPlatform.getTransport().equalsIgnoreCase("TCP") ? tcpSipProvider.getNewCallId()
: udpSipProvider.getNewCallId(); : udpSipProvider.getNewCallId();
Request request = headerProviderPlarformProvider.createMessageRequest(parentPlatform, catalogXml.toString(), fromTag, callIdHeader); Request request = headerProviderPlarformProvider.createMessageRequest(parentPlatform, catalogXml.toString(), fromTag, callIdHeader);
@ -305,7 +305,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
} }
String catalogXml = getCatalogXml(deviceChannels, sn, parentPlatform, channels.size()); String catalogXml = getCatalogXml(deviceChannels, sn, parentPlatform, channels.size());
// callid // callid
CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() CallIdHeader callIdHeader = parentPlatform.getTransport().equalsIgnoreCase("TCP") ? tcpSipProvider.getNewCallId()
: udpSipProvider.getNewCallId(); : udpSipProvider.getNewCallId();
Request request = headerProviderPlarformProvider.createMessageRequest(parentPlatform, catalogXml, fromTag, callIdHeader); Request request = headerProviderPlarformProvider.createMessageRequest(parentPlatform, catalogXml, fromTag, callIdHeader);
@ -345,7 +345,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
deviceInfoXml.append("<Result>OK</Result>\r\n"); deviceInfoXml.append("<Result>OK</Result>\r\n");
deviceInfoXml.append("</Response>\r\n"); deviceInfoXml.append("</Response>\r\n");
CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() CallIdHeader callIdHeader = parentPlatform.getTransport().equalsIgnoreCase("TCP") ? tcpSipProvider.getNewCallId()
: udpSipProvider.getNewCallId(); : udpSipProvider.getNewCallId();
Request request = headerProviderPlarformProvider.createMessageRequest(parentPlatform, deviceInfoXml.toString(), fromTag, callIdHeader); Request request = headerProviderPlarformProvider.createMessageRequest(parentPlatform, deviceInfoXml.toString(), fromTag, callIdHeader);
@ -383,7 +383,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
deviceStatusXml.append("<Status>OK</Status>\r\n"); deviceStatusXml.append("<Status>OK</Status>\r\n");
deviceStatusXml.append("</Response>\r\n"); deviceStatusXml.append("</Response>\r\n");
CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() CallIdHeader callIdHeader = parentPlatform.getTransport().equalsIgnoreCase("TCP") ? tcpSipProvider.getNewCallId()
: udpSipProvider.getNewCallId(); : udpSipProvider.getNewCallId();
Request request = headerProviderPlarformProvider.createMessageRequest(parentPlatform, deviceStatusXml.toString(), fromTag, callIdHeader); Request request = headerProviderPlarformProvider.createMessageRequest(parentPlatform, deviceStatusXml.toString(), fromTag, callIdHeader);
@ -421,7 +421,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
deviceStatusXml.append("<Altitude>" + gpsMsgInfo.getAltitude() + "</Altitude>\r\n"); deviceStatusXml.append("<Altitude>" + gpsMsgInfo.getAltitude() + "</Altitude>\r\n");
deviceStatusXml.append("</Notify>\r\n"); deviceStatusXml.append("</Notify>\r\n");
CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() CallIdHeader callIdHeader = parentPlatform.getTransport().equalsIgnoreCase("TCP") ? tcpSipProvider.getNewCallId()
: udpSipProvider.getNewCallId(); : udpSipProvider.getNewCallId();
callIdHeader.setCallId(subscribeInfo.getCallId()); callIdHeader.setCallId(subscribeInfo.getCallId());
@ -466,7 +466,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
deviceStatusXml.append("</info>\r\n"); deviceStatusXml.append("</info>\r\n");
deviceStatusXml.append("</Notify>\r\n"); deviceStatusXml.append("</Notify>\r\n");
CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() CallIdHeader callIdHeader = parentPlatform.getTransport().equalsIgnoreCase("TCP") ? tcpSipProvider.getNewCallId()
: udpSipProvider.getNewCallId(); : udpSipProvider.getNewCallId();
String tm = Long.toString(System.currentTimeMillis()); String tm = Long.toString(System.currentTimeMillis());

View File

@ -66,7 +66,7 @@ public abstract class SIPRequestProcessorParent {
boolean isTcp = false; boolean isTcp = false;
ViaHeader reqViaHeader = (ViaHeader) request.getHeader(ViaHeader.NAME); ViaHeader reqViaHeader = (ViaHeader) request.getHeader(ViaHeader.NAME);
String transport = reqViaHeader.getTransport(); String transport = reqViaHeader.getTransport();
if (transport.equals("TCP")) { if (transport.equalsIgnoreCase("TCP")) {
isTcp = true; isTcp = true;
} }
@ -142,7 +142,7 @@ public abstract class SIPRequestProcessorParent {
return; return;
} }
serverTransaction.sendResponse(response); serverTransaction.sendResponse(response);
if (statusCode >= 200 && !"NOTIFY".equals(evt.getRequest().getMethod())) { if (statusCode >= 200 && !"NOTIFY".equalsIgnoreCase(evt.getRequest().getMethod())) {
if (serverTransaction.getDialog() != null) { if (serverTransaction.getDialog() != null) {
serverTransaction.getDialog().delete(); serverTransaction.getDialog().delete();
@ -155,7 +155,7 @@ public abstract class SIPRequestProcessorParent {
response.setReasonPhrase(msg); response.setReasonPhrase(msg);
ServerTransaction serverTransaction = getServerTransaction(evt); ServerTransaction serverTransaction = getServerTransaction(evt);
serverTransaction.sendResponse(response); serverTransaction.sendResponse(response);
if (statusCode >= 200 && !"NOTIFY".equals(evt.getRequest().getMethod())) { if (statusCode >= 200 && !"NOTIFY".equalsIgnoreCase(evt.getRequest().getMethod())) {
if (serverTransaction.getDialog() != null) { if (serverTransaction.getDialog() != null) {
serverTransaction.getDialog().delete(); serverTransaction.getDialog().delete();
} }

View File

@ -248,16 +248,16 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
String protocol = media.getProtocol(); String protocol = media.getProtocol();
// 区分TCP发流还是udp 当前默认udp // 区分TCP发流还是udp 当前默认udp
if ("TCP/RTP/AVP".equals(protocol)) { if ("TCP/RTP/AVP".equalsIgnoreCase(protocol)) {
String setup = mediaDescription.getAttribute("setup"); String setup = mediaDescription.getAttribute("setup");
if (setup != null) { if (setup != null) {
mediaTransmissionTCP = true; mediaTransmissionTCP = true;
if ("active".equals(setup)) { if ("active".equalsIgnoreCase(setup)) {
tcpActive = true; tcpActive = true;
// 不支持tcp主动 // 不支持tcp主动
responseAck(evt, Response.NOT_IMPLEMENTED, "tcp active not support"); // 目录不支持点播 responseAck(evt, Response.NOT_IMPLEMENTED, "tcp active not support"); // 目录不支持点播
return; return;
} else if ("passive".equals(setup)) { } else if ("passive".equalsIgnoreCase(setup)) {
tcpActive = false; tcpActive = false;
} }
} }
@ -302,7 +302,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
return; return;
} }
sendRtpItem.setCallId(callIdHeader.getCallId()); sendRtpItem.setCallId(callIdHeader.getCallId());
sendRtpItem.setPlayType("Play".equals(sessionName) ? InviteStreamType.PLAY : InviteStreamType.PLAYBACK); sendRtpItem.setPlayType("Play".equalsIgnoreCase(sessionName) ? InviteStreamType.PLAY : InviteStreamType.PLAYBACK);
Long finalStartTime = startTime; Long finalStartTime = startTime;
Long finalStopTime = stopTime; Long finalStopTime = stopTime;
@ -321,7 +321,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
content.append("o=" + channelId + " 0 0 IN IP4 " + mediaServerItemInUSe.getSdpIp() + "\r\n"); content.append("o=" + channelId + " 0 0 IN IP4 " + mediaServerItemInUSe.getSdpIp() + "\r\n");
content.append("s=" + sessionName + "\r\n"); content.append("s=" + sessionName + "\r\n");
content.append("c=IN IP4 " + mediaServerItemInUSe.getSdpIp() + "\r\n"); content.append("c=IN IP4 " + mediaServerItemInUSe.getSdpIp() + "\r\n");
if ("Playback".equals(sessionName)) { if ("Playback".equalsIgnoreCase(sessionName)) {
content.append("t=" + finalStartTime + " " + finalStopTime + "\r\n"); content.append("t=" + finalStartTime + " " + finalStopTime + "\r\n");
} else { } else {
content.append("t=0 0\r\n"); content.append("t=0 0\r\n");
@ -365,7 +365,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
} }
}); });
sendRtpItem.setApp("rtp"); sendRtpItem.setApp("rtp");
if ("Playback".equals(sessionName)) { if ("Playback".equalsIgnoreCase(sessionName)) {
sendRtpItem.setPlayType(InviteStreamType.PLAYBACK); sendRtpItem.setPlayType(InviteStreamType.PLAYBACK);
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, null, true, true); SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, null, true, true);
sendRtpItem.setStreamId(ssrcInfo.getStream()); sendRtpItem.setStreamId(ssrcInfo.getStream());

View File

@ -159,7 +159,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
// 判断TCP还是UDP // 判断TCP还是UDP
ViaHeader reqViaHeader = (ViaHeader) request.getHeader(ViaHeader.NAME); ViaHeader reqViaHeader = (ViaHeader) request.getHeader(ViaHeader.NAME);
String transport = reqViaHeader.getTransport(); String transport = reqViaHeader.getTransport();
device.setTransport("TCP".equals(transport) ? "TCP" : "UDP"); device.setTransport("TCP".equalsIgnoreCase(transport) ? "TCP" : "UDP");
} }
sendResponse(evt, response); sendResponse(evt, response);

View File

@ -132,7 +132,7 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme
return; return;
} }
if (evt.getServerTransaction() == null) { if (evt.getServerTransaction() == null) {
ServerTransaction serverTransaction = "TCP".equals(platform.getTransport()) ? tcpSipProvider.getNewServerTransaction(evt.getRequest()) ServerTransaction serverTransaction = "TCP".equalsIgnoreCase(platform.getTransport()) ? tcpSipProvider.getNewServerTransaction(evt.getRequest())
: udpSipProvider.getNewServerTransaction(evt.getRequest()); : udpSipProvider.getNewServerTransaction(evt.getRequest());
subscribeInfo.setTransaction(serverTransaction); subscribeInfo.setTransaction(serverTransaction);
Dialog dialog = serverTransaction.getDialog(); Dialog dialog = serverTransaction.getDialog();
@ -188,7 +188,7 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme
} }
SubscribeInfo subscribeInfo = new SubscribeInfo(evt, platformId); SubscribeInfo subscribeInfo = new SubscribeInfo(evt, platformId);
if (evt.getServerTransaction() == null) { if (evt.getServerTransaction() == null) {
ServerTransaction serverTransaction = "TCP".equals(platform.getTransport()) ? tcpSipProvider.getNewServerTransaction(evt.getRequest()) ServerTransaction serverTransaction = "TCP".equalsIgnoreCase(platform.getTransport()) ? tcpSipProvider.getNewServerTransaction(evt.getRequest())
: udpSipProvider.getNewServerTransaction(evt.getRequest()); : udpSipProvider.getNewServerTransaction(evt.getRequest());
subscribeInfo.setTransaction(serverTransaction); subscribeInfo.setTransaction(serverTransaction);
Dialog dialog = serverTransaction.getDialog(); Dialog dialog = serverTransaction.getDialog();

View File

@ -96,7 +96,7 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I
ContentTypeHeader header = (ContentTypeHeader)evt.getRequest().getHeader(ContentTypeHeader.NAME); ContentTypeHeader header = (ContentTypeHeader)evt.getRequest().getHeader(ContentTypeHeader.NAME);
String contentType = header.getContentType(); String contentType = header.getContentType();
String contentSubType = header.getContentSubType(); String contentSubType = header.getContentSubType();
if ("Application".equals(contentType) && "MANSRTSP".equals(contentSubType)) { if ("Application".equalsIgnoreCase(contentType) && "MANSRTSP".equalsIgnoreCase(contentSubType)) {
SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(null, null, null, callIdHeader.getCallId()); SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(null, null, null, callIdHeader.getCallId());
String streamId = sendRtpItem.getStreamId(); String streamId = sendRtpItem.getStreamId();
StreamInfo streamInfo = redisCatchStorage.queryPlayback(null, null, streamId, null); StreamInfo streamInfo = redisCatchStorage.queryPlayback(null, null, streamId, null);

View File

@ -76,7 +76,7 @@ public class DeviceStatusResponseMessageHandler extends SIPRequestProcessorParen
logger.debug(json.toJSONString()); logger.debug(json.toJSONString());
} }
String text = onlineElement.getText(); String text = onlineElement.getText();
if (Objects.equals(text.trim().toUpperCase(), "ONLINE")) { if ("ONLINE".equalsIgnoreCase(text.trim())) {
deviceService.online(device); deviceService.online(device);
}else { }else {
deviceService.offline(device.getDeviceId()); deviceService.offline(device.getDeviceId());

View File

@ -77,7 +77,7 @@ public class PresetQueryResponseMessageHandler extends SIPRequestProcessorParent
Element itemOne = itemListIterator.next(); Element itemOne = itemListIterator.next();
String name = itemOne.getName(); String name = itemOne.getName();
String textTrim = itemOne.getTextTrim(); String textTrim = itemOne.getTextTrim();
if("PresetID".equals(name)){ if("PresetID".equalsIgnoreCase(name)){
presetQuerySipReq.setPresetId(textTrim); presetQuerySipReq.setPresetId(textTrim);
}else { }else {
presetQuerySipReq.setPresetName(textTrim); presetQuerySipReq.setPresetName(textTrim);