修复bug以及日志按照,错误/sip/数据库 分割
This commit is contained in:
@@ -2,8 +2,10 @@ package com.genersoft.iot.vmp.gb28181;
|
||||
|
||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.ISIPProcessorObserver;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import gov.nist.javax.sip.SipProviderImpl;
|
||||
import gov.nist.javax.sip.SipStackImpl;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -13,6 +15,7 @@ import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.sip.*;
|
||||
import java.text.DateFormat;
|
||||
import java.util.Properties;
|
||||
import java.util.TooManyListenersException;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
@@ -52,7 +55,9 @@ public class SipLayer{
|
||||
* 完整配置参考 gov.nist.javax.sip.SipStackImpl,需要下载源码
|
||||
* gov/nist/javax/sip/SipStackImpl.class
|
||||
*/
|
||||
properties.setProperty("gov.nist.javax.sip.LOG_MESSAGE_CONTENT", "true");
|
||||
if (logger.isDebugEnabled()) {
|
||||
properties.setProperty("gov.nist.javax.sip.LOG_MESSAGE_CONTENT", "true");
|
||||
}
|
||||
// 接收所有notify请求,即使没有订阅
|
||||
properties.setProperty("gov.nist.javax.sip.DELIVER_UNSOLICITED_NOTIFY", "true");
|
||||
// 为_NULL _对话框传递_终止的_事件
|
||||
@@ -67,9 +72,10 @@ public class SipLayer{
|
||||
* 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.SERVER_LOG", "sip_server_log");
|
||||
properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "sip_debug_log");
|
||||
if (logger.isDebugEnabled()) {
|
||||
properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "DEBUG");
|
||||
}
|
||||
properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "INFO");
|
||||
sipStack = (SipStackImpl) sipFactory.createSipStack(properties);
|
||||
|
||||
return sipStack;
|
||||
|
||||
@@ -71,7 +71,6 @@ public class SIPProcessorObserver implements ISIPProcessorObserver {
|
||||
@Override
|
||||
@Async
|
||||
public void processRequest(RequestEvent requestEvent) {
|
||||
logger.debug("\n收到请求:\n{}", requestEvent.getRequest());
|
||||
String method = requestEvent.getRequest().getMethod();
|
||||
ISIPRequestProcessor sipRequestProcessor = requestProcessorMap.get(method);
|
||||
if (sipRequestProcessor == null) {
|
||||
@@ -90,7 +89,6 @@ public class SIPProcessorObserver implements ISIPProcessorObserver {
|
||||
@Async
|
||||
public void processResponse(ResponseEvent responseEvent) {
|
||||
Response response = responseEvent.getResponse();
|
||||
logger.debug("\n收到响应:\n{}", responseEvent.getResponse());
|
||||
int status = response.getStatusCode();
|
||||
|
||||
if (((status >= 200) && (status < 300)) || status == Response.UNAUTHORIZED) { // Success!
|
||||
|
||||
@@ -640,7 +640,7 @@ public class SIPCommander implements ISIPCommander {
|
||||
hookEvent.call(new InviteStreamInfo(mediaServerItem, json, callIdHeader.getCallId(), "rtp", ssrcInfo.getStream()));
|
||||
subscribe.removeSubscribe(hookSubscribe);
|
||||
hookSubscribe.getContent().put("regist", false);
|
||||
hookSubscribe.getContent().put("schema", "rtmp");
|
||||
hookSubscribe.getContent().put("schema", "rtsp");
|
||||
// 添加流注销的订阅,注销了后向设备发送bye
|
||||
subscribe.addSubscribe(hookSubscribe,
|
||||
(MediaServerItem mediaServerItemForEnd, JSONObject jsonForEnd)->{
|
||||
|
||||
@@ -410,6 +410,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||
streamId = String.format("%s_%s", device.getDeviceId(), channelId);
|
||||
}
|
||||
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, null, device.isSsrcCheck(), false);
|
||||
logger.info(JSONObject.toJSONString(ssrcInfo));
|
||||
sendRtpItem.setStreamId(ssrcInfo.getStream());
|
||||
// 写入redis, 超时时回复
|
||||
redisCatchStorage.updateSendRTPSever(sendRtpItem);
|
||||
|
||||
@@ -180,7 +180,6 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme
|
||||
|
||||
private void processNotifyCatalogList(RequestEvent evt, Element rootElement) throws SipException {
|
||||
|
||||
System.out.println(evt.getRequest().toString());
|
||||
String platformId = SipUtils.getUserIdFromFromHeader(evt.getRequest());
|
||||
String deviceId = XmlUtil.getText(rootElement, "DeviceID");
|
||||
ParentPlatform platform = storager.queryParentPlatByServerGBId(platformId);
|
||||
|
||||
@@ -164,7 +164,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
||||
}
|
||||
}
|
||||
|
||||
if (channelId.equals(sipConfig.getId())) {
|
||||
if ("7".equals(deviceAlarm.getAlarmMethod()) ) {
|
||||
// 发送给平台的报警信息。 发送redis通知
|
||||
AlarmChannelMessage alarmChannelMessage = new AlarmChannelMessage();
|
||||
alarmChannelMessage.setAlarmSn(Integer.parseInt(deviceAlarm.getAlarmMethod()));
|
||||
|
||||
Reference in New Issue
Block a user