diff --git a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/control/DeviceControlMessageHandler.java b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/control/DeviceControlMessageHandler.java index 8db6b4ab..805d526a 100644 --- a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/control/DeviceControlMessageHandler.java +++ b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/control/DeviceControlMessageHandler.java @@ -2,6 +2,7 @@ import javax.sip.RequestEvent; +import io.github.lunasaw.gbproxy.client.transmit.request.message.ClientMessageRequestProcessor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -37,7 +38,7 @@ public DeviceControlMessageHandler(MessageProcessorClient messageProcessorClient @Override public String getRootType() { - return CONTROL; + return ClientMessageRequestProcessor.METHOD + CONTROL; } @Override diff --git a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/notify/BroadcastNotifyMessageHandler.java b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/notify/BroadcastNotifyMessageHandler.java index 7465b12a..16a9d566 100644 --- a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/notify/BroadcastNotifyMessageHandler.java +++ b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/notify/BroadcastNotifyMessageHandler.java @@ -2,6 +2,7 @@ import javax.sip.RequestEvent; +import io.github.lunasaw.gbproxy.client.transmit.request.message.ClientMessageRequestProcessor; import io.github.lunasaw.gbproxy.client.user.SipUserGenerateClient; import io.github.lunasaw.sip.common.entity.FromDevice; import io.github.lunasaw.sip.common.entity.DeviceSession; @@ -36,7 +37,7 @@ public BroadcastNotifyMessageHandler(MessageProcessorClient messageProcessorClie @Override public String getRootType() { - return NOTIFY; + return ClientMessageRequestProcessor.METHOD + NOTIFY; } @Override diff --git a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/AlarmQueryMessageClientHandler.java b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/AlarmQueryMessageClientHandler.java index 4a941a96..f0fe91ce 100644 --- a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/AlarmQueryMessageClientHandler.java +++ b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/AlarmQueryMessageClientHandler.java @@ -3,6 +3,7 @@ import javax.sip.RequestEvent; import io.github.lunasaw.gbproxy.client.transmit.cmd.ClientSendCmd; +import io.github.lunasaw.gbproxy.client.transmit.request.message.ClientMessageRequestProcessor; import io.github.lunasaw.gbproxy.client.transmit.request.message.MessageClientHandlerAbstract; import io.github.lunasaw.gbproxy.client.user.SipUserGenerateClient; import io.github.lunasaw.sip.common.entity.FromDevice; @@ -39,7 +40,7 @@ public AlarmQueryMessageClientHandler(MessageProcessorClient messageProcessorCli @Override public String getRootType() { - return QUERY; + return ClientMessageRequestProcessor.METHOD + QUERY; } @Override diff --git a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/CatalogQueryMessageClientHandler.java b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/CatalogQueryMessageClientHandler.java index c58d8fa9..9b8b7862 100644 --- a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/CatalogQueryMessageClientHandler.java +++ b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/CatalogQueryMessageClientHandler.java @@ -3,6 +3,7 @@ import javax.sip.RequestEvent; import io.github.lunasaw.gb28181.common.entity.response.DeviceResponse; +import io.github.lunasaw.gbproxy.client.transmit.request.message.ClientMessageRequestProcessor; import io.github.lunasaw.gbproxy.client.user.SipUserGenerateClient; import lombok.Setter; @@ -41,7 +42,7 @@ public CatalogQueryMessageClientHandler(MessageProcessorClient messageProcessorC @Override public String getRootType() { - return QUERY; + return ClientMessageRequestProcessor.METHOD + QUERY; } diff --git a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/ConfigDownloadMessageHandler.java b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/ConfigDownloadMessageHandler.java index d01bfba8..266703ea 100644 --- a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/ConfigDownloadMessageHandler.java +++ b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/ConfigDownloadMessageHandler.java @@ -3,6 +3,7 @@ import javax.sip.RequestEvent; import io.github.lunasaw.gbproxy.client.transmit.cmd.ClientSendCmd; +import io.github.lunasaw.gbproxy.client.transmit.request.message.ClientMessageRequestProcessor; import io.github.lunasaw.gbproxy.client.user.SipUserGenerateClient; import io.github.lunasaw.sip.common.entity.FromDevice; import io.github.lunasaw.sip.common.entity.ToDevice; @@ -41,7 +42,7 @@ public ConfigDownloadMessageHandler(MessageProcessorClient messageProcessorClien @Override public String getRootType() { - return QUERY; + return ClientMessageRequestProcessor.METHOD + QUERY; } diff --git a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/DeviceInfoQueryMessageClientHandler.java b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/DeviceInfoQueryMessageClientHandler.java index 2b0128d0..1736c8db 100755 --- a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/DeviceInfoQueryMessageClientHandler.java +++ b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/DeviceInfoQueryMessageClientHandler.java @@ -2,6 +2,7 @@ import javax.sip.RequestEvent; +import io.github.lunasaw.gbproxy.client.transmit.request.message.ClientMessageRequestProcessor; import io.github.lunasaw.gbproxy.client.transmit.request.message.MessageClientHandlerAbstract; import io.github.lunasaw.gbproxy.client.user.SipUserGenerateClient; @@ -40,7 +41,7 @@ public DeviceInfoQueryMessageClientHandler(MessageProcessorClient messageProcess @Override public String getRootType() { - return QUERY; + return ClientMessageRequestProcessor.METHOD + QUERY; } diff --git a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/DeviceStatusQueryMessageClientHandler.java b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/DeviceStatusQueryMessageClientHandler.java index 7e69ba72..0b6f0570 100644 --- a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/DeviceStatusQueryMessageClientHandler.java +++ b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/DeviceStatusQueryMessageClientHandler.java @@ -2,6 +2,7 @@ import javax.sip.RequestEvent; +import io.github.lunasaw.gbproxy.client.transmit.request.message.ClientMessageRequestProcessor; import io.github.lunasaw.gbproxy.client.user.SipUserGenerateClient; import org.springframework.stereotype.Component; @@ -42,7 +43,7 @@ public DeviceStatusQueryMessageClientHandler(MessageProcessorClient messageProce @Override public String getRootType() { - return QUERY; + return ClientMessageRequestProcessor.METHOD + QUERY; } diff --git a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/RecordInfoQueryMessageClientHandler.java b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/RecordInfoQueryMessageClientHandler.java index aedd5dc1..5d513d6b 100644 --- a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/RecordInfoQueryMessageClientHandler.java +++ b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/message/handler/query/RecordInfoQueryMessageClientHandler.java @@ -2,18 +2,18 @@ import javax.sip.RequestEvent; -import io.github.lunasaw.gbproxy.client.user.SipUserGenerateClient; import org.springframework.stereotype.Component; -import io.github.lunasaw.sip.common.entity.DeviceSession; import io.github.lunasaw.gb28181.common.entity.query.DeviceRecordQuery; import io.github.lunasaw.gb28181.common.entity.response.DeviceRecord; import io.github.lunasaw.gbproxy.client.transmit.cmd.ClientSendCmd; +import io.github.lunasaw.gbproxy.client.transmit.request.message.ClientMessageRequestProcessor; import io.github.lunasaw.gbproxy.client.transmit.request.message.MessageClientHandlerAbstract; import io.github.lunasaw.gbproxy.client.transmit.request.message.MessageProcessorClient; +import io.github.lunasaw.gbproxy.client.user.SipUserGenerateClient; +import io.github.lunasaw.sip.common.entity.DeviceSession; import io.github.lunasaw.sip.common.entity.FromDevice; import io.github.lunasaw.sip.common.entity.ToDevice; - import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; @@ -36,10 +36,9 @@ public RecordInfoQueryMessageClientHandler(MessageProcessorClient messageProcess super(messageProcessorClient, sipUserGenerateClient); } - @Override public String getRootType() { - return QUERY; + return ClientMessageRequestProcessor.METHOD + QUERY; } @Override diff --git a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/subscribe/SubscribeClientHandlerAbstract.java b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/subscribe/SubscribeClientHandlerAbstract.java index cca70499..6cdd750f 100755 --- a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/subscribe/SubscribeClientHandlerAbstract.java +++ b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/subscribe/SubscribeClientHandlerAbstract.java @@ -6,8 +6,8 @@ import org.springframework.stereotype.Component; import gov.nist.javax.sip.message.SIPRequest; -import io.github.lunasaw.sip.common.entity.DeviceSession; import io.github.lunasaw.gbproxy.client.user.SipUserGenerateClient; +import io.github.lunasaw.sip.common.entity.DeviceSession; import io.github.lunasaw.sip.common.transmit.event.message.MessageHandlerAbstract; import io.github.lunasaw.sip.common.utils.SipUtils; import lombok.Data; @@ -32,7 +32,7 @@ public SubscribeClientHandlerAbstract(SubscribeProcessorClient subscribeProcesso @Override public String getRootType() { - return "Root"; + return ClientSubscribeRequestProcessor.METHOD + "Root"; } public DeviceSession getDeviceSession(RequestEvent event) { diff --git a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/subscribe/catalog/CatalogQueryMessageHandler.java b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/subscribe/catalog/SubscribeCatalogQueryMessageHandler.java similarity index 86% rename from gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/subscribe/catalog/CatalogQueryMessageHandler.java rename to gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/subscribe/catalog/SubscribeCatalogQueryMessageHandler.java index 46d36722..f0d7734f 100644 --- a/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/subscribe/catalog/CatalogQueryMessageHandler.java +++ b/gb28181-client/src/main/java/io/github/lunasaw/gbproxy/client/transmit/request/subscribe/catalog/SubscribeCatalogQueryMessageHandler.java @@ -2,6 +2,7 @@ import javax.sip.RequestEvent; import javax.sip.header.ContentTypeHeader; +import javax.sip.header.EventHeader; import javax.sip.header.ExpiresHeader; import javax.sip.message.Response; @@ -9,7 +10,6 @@ import io.github.lunasaw.sip.common.entity.Device; import io.github.lunasaw.gb28181.common.entity.response.DeviceSubscribe; import io.github.lunasaw.sip.common.enums.ContentTypeEnum; -import io.github.lunasaw.sip.common.service.SipUserGenerate; import io.github.lunasaw.sip.common.transmit.ResponseCmd; import io.github.lunasaw.sip.common.utils.SipRequestUtils; import org.springframework.stereotype.Component; @@ -36,11 +36,11 @@ @Slf4j @Getter @Setter -public class CatalogQueryMessageHandler extends SubscribeClientHandlerAbstract { +public class SubscribeCatalogQueryMessageHandler extends SubscribeClientHandlerAbstract { public static final String CMD_TYPE = CmdTypeEnum.CATALOG.getType(); - public CatalogQueryMessageHandler(SubscribeProcessorClient subscribeProcessorClient, SipUserGenerateClient sipUserGenerate) { + public SubscribeCatalogQueryMessageHandler(SubscribeProcessorClient subscribeProcessorClient, SipUserGenerateClient sipUserGenerate) { super(subscribeProcessorClient, sipUserGenerate); } @@ -53,6 +53,13 @@ public String getRootType() { @Override public void handForEvt(RequestEvent event) { DeviceSession deviceSession = getDeviceSession(event); + + EventHeader header = (EventHeader) event.getRequest().getHeader(EventHeader.NAME); + if (header == null){ + log.info("handForEvt::event = {}", event); + return; + } + // 订阅消息过来 String sipId = deviceSession.getSipId(); String userId = deviceSession.getUserId(); diff --git a/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/BaseMessageServerHandler.java b/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/BaseMessageServerHandler.java index 2ee023f5..ceb3e7d2 100644 --- a/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/BaseMessageServerHandler.java +++ b/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/BaseMessageServerHandler.java @@ -40,8 +40,5 @@ public String getCmdType() { return cmdType; } - @Override - public String getRootType() { - return super.getRootType(); - } + } diff --git a/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/notify/AlarmNotifyMessageHandler.java b/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/notify/AlarmNotifyMessageHandler.java index 557400c9..510cb1e3 100644 --- a/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/notify/AlarmNotifyMessageHandler.java +++ b/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/notify/AlarmNotifyMessageHandler.java @@ -3,6 +3,7 @@ import javax.sip.RequestEvent; import io.github.lunasaw.gb28181.common.entity.notify.DeviceAlarmNotify; +import io.github.lunasaw.gbproxy.server.transimit.request.message.ServerMessageRequestProcessor; import io.github.lunasaw.gbproxy.server.user.SipUserGenerateServer; import org.springframework.stereotype.Component; @@ -36,7 +37,7 @@ public AlarmNotifyMessageHandler(MessageProcessorServer messageProcessorServer, @Override public String getRootType() { - return NOTIFY; + return ServerMessageRequestProcessor.METHOD + NOTIFY; } @Override diff --git a/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/notify/KeepaliveNotifyMessageHandler.java b/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/notify/KeepaliveNotifyMessageHandler.java index fd9ace6b..5b78a7fc 100644 --- a/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/notify/KeepaliveNotifyMessageHandler.java +++ b/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/notify/KeepaliveNotifyMessageHandler.java @@ -4,6 +4,7 @@ import javax.sip.message.Response; import gov.nist.javax.sip.message.SIPRequest; +import io.github.lunasaw.gbproxy.server.transimit.request.message.ServerMessageRequestProcessor; import io.github.lunasaw.gbproxy.server.user.SipUserGenerateServer; import io.github.lunasaw.sip.common.entity.RemoteAddressInfo; import io.github.lunasaw.sip.common.entity.ToDevice; @@ -39,7 +40,7 @@ public KeepaliveNotifyMessageHandler(MessageProcessorServer messageProcessorServ @Override public String getRootType() { - return NOTIFY; + return ServerMessageRequestProcessor.METHOD + NOTIFY; } diff --git a/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/notify/MediaStatusNotifyMessageHandler.java b/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/notify/MediaStatusNotifyMessageHandler.java index b6c8b4ef..e07c831c 100644 --- a/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/notify/MediaStatusNotifyMessageHandler.java +++ b/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/notify/MediaStatusNotifyMessageHandler.java @@ -2,6 +2,7 @@ import javax.sip.RequestEvent; +import io.github.lunasaw.gbproxy.server.transimit.request.message.ServerMessageRequestProcessor; import io.github.lunasaw.gbproxy.server.user.SipUserGenerateServer; import org.springframework.stereotype.Component; @@ -36,7 +37,7 @@ public MediaStatusNotifyMessageHandler(MessageProcessorServer messageProcessorSe @Override public String getRootType() { - return NOTIFY; + return ServerMessageRequestProcessor.METHOD + NOTIFY; } diff --git a/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/notify/MobilePositionNotifyMessageHandler.java b/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/notify/MobilePositionNotifyMessageHandler.java index 35180efa..80e455a3 100644 --- a/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/notify/MobilePositionNotifyMessageHandler.java +++ b/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/notify/MobilePositionNotifyMessageHandler.java @@ -2,6 +2,7 @@ import javax.sip.RequestEvent; +import io.github.lunasaw.gbproxy.server.transimit.request.message.ServerMessageRequestProcessor; import io.github.lunasaw.gbproxy.server.user.SipUserGenerateServer; import io.github.lunasaw.sip.common.entity.ToDevice; import io.github.lunasaw.sip.common.entity.DeviceSession; @@ -36,7 +37,7 @@ public MobilePositionNotifyMessageHandler(MessageProcessorServer messageProcesso @Override public String getRootType() { - return NOTIFY; + return ServerMessageRequestProcessor.METHOD + NOTIFY; } diff --git a/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/response/RecordInfoMessageHandler.java b/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/response/RecordInfoMessageHandler.java index 89de40f1..a4fd5caf 100644 --- a/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/response/RecordInfoMessageHandler.java +++ b/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/response/RecordInfoMessageHandler.java @@ -2,6 +2,7 @@ import javax.sip.RequestEvent; +import io.github.lunasaw.gbproxy.server.transimit.request.message.ServerMessageRequestProcessor; import io.github.lunasaw.sip.common.entity.DeviceSession; import org.springframework.stereotype.Component; @@ -34,7 +35,7 @@ public RecordInfoMessageHandler(MessageProcessorServer messageProcessorServer, S @Override public String getRootType() { - return RESPONSE; + return ServerMessageRequestProcessor.METHOD + RESPONSE; } @Override diff --git a/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/response/ResponseCatalogMessageHandler.java b/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/response/ResponseCatalogMessageHandler.java index a84ca8fe..1e952d3a 100644 --- a/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/response/ResponseCatalogMessageHandler.java +++ b/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/message/response/ResponseCatalogMessageHandler.java @@ -2,6 +2,7 @@ import javax.sip.RequestEvent; +import io.github.lunasaw.gbproxy.server.transimit.request.message.ServerMessageRequestProcessor; import io.github.lunasaw.gbproxy.server.user.SipUserGenerateServer; import io.github.lunasaw.sip.common.entity.ToDevice; import io.github.lunasaw.sip.common.entity.DeviceSession; @@ -55,6 +56,6 @@ public String getCmdType() { @Override public String getRootType() { - return RESPONSE; + return ServerMessageRequestProcessor.METHOD + RESPONSE; } } diff --git a/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/notify/catalog/CatalogNotifyHandler.java b/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/notify/catalog/CatalogNotifyHandler.java index 510f5ae2..7922401b 100644 --- a/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/notify/catalog/CatalogNotifyHandler.java +++ b/gb28181-server/src/main/java/io/github/lunasaw/gbproxy/server/transimit/request/notify/catalog/CatalogNotifyHandler.java @@ -2,15 +2,12 @@ import javax.sip.RequestEvent; -import io.github.lunasaw.gbproxy.server.transimit.request.notify.NotifyProcessorServer; -import io.github.lunasaw.gbproxy.server.user.SipUserGenerateServer; - import org.springframework.stereotype.Component; -import io.github.lunasaw.sip.common.entity.DeviceSession; import io.github.lunasaw.gb28181.common.entity.notify.DeviceOtherUpdateNotify; -import io.github.lunasaw.gbproxy.server.transimit.request.message.MessageProcessorServer; import io.github.lunasaw.gbproxy.server.transimit.request.notify.NotifyServerHandlerAbstract; +import io.github.lunasaw.gbproxy.server.transimit.request.notify.ServerNotifyRequestProcessor; +import io.github.lunasaw.sip.common.entity.DeviceSession; import io.github.lunasaw.sip.common.entity.ToDevice; import lombok.Getter; import lombok.Setter; @@ -28,7 +25,6 @@ public class CatalogNotifyHandler extends NotifyServerHandlerAbstract { public static final String CMD_TYPE = "Catalog"; - @Override public void handForEvt(RequestEvent event) { DeviceSession deviceSession = getDeviceSession(event); @@ -52,6 +48,6 @@ public String getCmdType() { @Override public String getRootType() { - return RESPONSE; + return ServerNotifyRequestProcessor.METHOD + RESPONSE; } } diff --git a/sip-common/src/main/java/io/github/lunasaw/sip/common/entity/FromDevice.java b/sip-common/src/main/java/io/github/lunasaw/sip/common/entity/FromDevice.java index 39bdbea3..803aec2f 100644 --- a/sip-common/src/main/java/io/github/lunasaw/sip/common/entity/FromDevice.java +++ b/sip-common/src/main/java/io/github/lunasaw/sip/common/entity/FromDevice.java @@ -1,8 +1,7 @@ package io.github.lunasaw.sip.common.entity; import io.github.lunasaw.sip.common.constant.Constant; -import io.github.lunasaw.sip.common.enums.StreamModeEnum; -import io.github.lunasaw.sip.common.enums.TransModeEnum; + import io.github.lunasaw.sip.common.utils.SipRequestUtils; import lombok.Data; @@ -31,8 +30,8 @@ public static FromDevice getInstance(String userId, String ip, int port) { fromDevice.setUserId(userId); fromDevice.setIp(ip); fromDevice.setPort(port); - fromDevice.setTransport(TransModeEnum.UDP.getType()); - fromDevice.setStreamMode(StreamModeEnum.TCP_PASSIVE.getType()); + fromDevice.setTransport("UDP"); + fromDevice.setStreamMode("TCP_PASSIVE"); fromDevice.setFromTag(SipRequestUtils.getNewFromTag()); fromDevice.setAgent(Constant.AGENT); return fromDevice; diff --git a/sip-common/src/main/java/io/github/lunasaw/sip/common/entity/ToDevice.java b/sip-common/src/main/java/io/github/lunasaw/sip/common/entity/ToDevice.java index c5ed2a50..c39264f3 100644 --- a/sip-common/src/main/java/io/github/lunasaw/sip/common/entity/ToDevice.java +++ b/sip-common/src/main/java/io/github/lunasaw/sip/common/entity/ToDevice.java @@ -1,7 +1,5 @@ package io.github.lunasaw.sip.common.entity; -import io.github.lunasaw.sip.common.enums.StreamModeEnum; -import io.github.lunasaw.sip.common.enums.TransModeEnum; import lombok.Data; /** @@ -33,8 +31,8 @@ public static ToDevice getInstance(String userId, String ip, int port) { toDevice.setUserId(userId); toDevice.setIp(ip); toDevice.setPort(port); - toDevice.setTransport(TransModeEnum.UDP.getType()); - toDevice.setStreamMode(StreamModeEnum.TCP_PASSIVE.getType()); + toDevice.setTransport("UDP"); + toDevice.setStreamMode("TCP_PASSIVE"); toDevice.setToTag(null); return toDevice; } diff --git a/sip-common/src/main/java/io/github/lunasaw/sip/common/transmit/event/message/SipMessageRequestProcessorAbstract.java b/sip-common/src/main/java/io/github/lunasaw/sip/common/transmit/event/message/SipMessageRequestProcessorAbstract.java index 77eb8275..a83e574b 100644 --- a/sip-common/src/main/java/io/github/lunasaw/sip/common/transmit/event/message/SipMessageRequestProcessorAbstract.java +++ b/sip-common/src/main/java/io/github/lunasaw/sip/common/transmit/event/message/SipMessageRequestProcessorAbstract.java @@ -44,7 +44,7 @@ public static void addHandler(MessageHandler messageHandler) { } public void doMessageHandForEvt(RequestEvent evt, FromDevice fromDevice) { - SIPRequest request = (SIPRequest) evt.getRequest(); + SIPRequest request = (SIPRequest)evt.getRequest(); String charset = Optional.of(fromDevice).map(Device::getCharset).orElse(Constant.UTF_8); @@ -52,10 +52,10 @@ public void doMessageHandForEvt(RequestEvent evt, FromDevice fromDevice) { byte[] rawContent = request.getRawContent(); String xmlStr = StringTools.toEncodedString(rawContent, Charset.forName(charset)); - String cmdType = XmlUtils.getCmdType(xmlStr); String rootType = XmlUtils.getRootType(xmlStr); - Map messageHandlerMap = MESSAGE_HANDLER_CMD_MAP.get(rootType); + String method = request.getMethod(); + Map messageHandlerMap = MESSAGE_HANDLER_CMD_MAP.get(method + rootType); if (MapUtils.isEmpty(messageHandlerMap)) { return; @@ -77,5 +77,4 @@ public void doMessageHandForEvt(RequestEvent evt, FromDevice fromDevice) { } } - }