Skip to content

Commit

Permalink
Merge pull request #26 from lunasaw/dev_1.1.6
Browse files Browse the repository at this point in the history
Dev 1.1.6
  • Loading branch information
lunasaw authored Jan 1, 2024
2 parents f8d8bb0 + bd7bc0f commit 6068baf
Show file tree
Hide file tree
Showing 63 changed files with 336 additions and 240 deletions.
2 changes: 1 addition & 1 deletion gb28181-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.github.lunasaw</groupId>
<artifactId>sip-proxy</artifactId>
<version>1.1.5</version>
<version>1.1.6</version>
</parent>

<version>${gb28181-proxy.version}</version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.springframework.stereotype.Component;

import gov.nist.javax.sip.message.SIPRequest;
import io.github.lunasaw.gb28181.common.entity.base.DeviceSession;
import io.github.lunasaw.sip.common.entity.DeviceSession;
import io.github.lunasaw.gbproxy.client.user.SipUserGenerateClient;
import io.github.lunasaw.sip.common.transmit.event.message.MessageHandlerAbstract;
import io.github.lunasaw.sip.common.utils.SipUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -37,7 +38,7 @@ public DeviceControlMessageHandler(MessageProcessorClient messageProcessorClient

@Override
public String getRootType() {
return CONTROL;
return ClientMessageRequestProcessor.METHOD + CONTROL;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

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.gb28181.common.entity.base.DeviceSession;
import io.github.lunasaw.sip.common.entity.DeviceSession;
import io.github.lunasaw.gb28181.common.entity.notify.DeviceBroadcastNotify;

import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -36,7 +37,7 @@ public BroadcastNotifyMessageHandler(MessageProcessorClient messageProcessorClie

@Override
public String getRootType() {
return NOTIFY;
return ClientMessageRequestProcessor.METHOD + NOTIFY;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
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;
import io.github.lunasaw.sip.common.entity.ToDevice;
import io.github.lunasaw.gb28181.common.entity.base.DeviceSession;
import io.github.lunasaw.sip.common.entity.DeviceSession;
import io.github.lunasaw.gb28181.common.entity.notify.DeviceAlarmNotify;
import io.github.lunasaw.gb28181.common.entity.query.DeviceAlarmQuery;

Expand Down Expand Up @@ -39,7 +40,7 @@ public AlarmQueryMessageClientHandler(MessageProcessorClient messageProcessorCli

@Override
public String getRootType() {
return QUERY;
return ClientMessageRequestProcessor.METHOD + QUERY;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -13,7 +14,7 @@
import io.github.lunasaw.gbproxy.client.transmit.request.message.MessageProcessorClient;
import io.github.lunasaw.sip.common.entity.FromDevice;
import io.github.lunasaw.sip.common.entity.ToDevice;
import io.github.lunasaw.gb28181.common.entity.base.DeviceSession;
import io.github.lunasaw.sip.common.entity.DeviceSession;
import io.github.lunasaw.gb28181.common.entity.query.DeviceQuery;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -41,7 +42,7 @@ public CatalogQueryMessageClientHandler(MessageProcessorClient messageProcessorC

@Override
public String getRootType() {
return QUERY;
return ClientMessageRequestProcessor.METHOD + QUERY;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
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;
import io.github.lunasaw.gb28181.common.entity.base.DeviceSession;
import io.github.lunasaw.sip.common.entity.DeviceSession;
import io.github.lunasaw.gb28181.common.entity.query.DeviceConfigDownload;
import io.github.lunasaw.gb28181.common.entity.response.DeviceConfigResponse;

Expand Down Expand Up @@ -41,7 +42,7 @@ public ConfigDownloadMessageHandler(MessageProcessorClient messageProcessorClien

@Override
public String getRootType() {
return QUERY;
return ClientMessageRequestProcessor.METHOD + QUERY;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -13,7 +14,7 @@
import io.github.lunasaw.gbproxy.client.transmit.request.message.MessageProcessorClient;
import io.github.lunasaw.sip.common.entity.FromDevice;
import io.github.lunasaw.sip.common.entity.ToDevice;
import io.github.lunasaw.gb28181.common.entity.base.DeviceSession;
import io.github.lunasaw.sip.common.entity.DeviceSession;
import io.github.lunasaw.gb28181.common.entity.query.DeviceQuery;
import io.github.lunasaw.gb28181.common.entity.response.DeviceInfo;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -40,7 +41,7 @@ public DeviceInfoQueryMessageClientHandler(MessageProcessorClient messageProcess

@Override
public String getRootType() {
return QUERY;
return ClientMessageRequestProcessor.METHOD + QUERY;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -11,7 +12,7 @@
import io.github.lunasaw.gbproxy.client.transmit.request.message.MessageProcessorClient;
import io.github.lunasaw.sip.common.entity.FromDevice;
import io.github.lunasaw.sip.common.entity.ToDevice;
import io.github.lunasaw.gb28181.common.entity.base.DeviceSession;
import io.github.lunasaw.sip.common.entity.DeviceSession;
import io.github.lunasaw.gb28181.common.entity.query.DeviceQuery;
import io.github.lunasaw.gb28181.common.entity.response.DeviceStatus;
import lombok.Getter;
Expand Down Expand Up @@ -42,7 +43,7 @@ public DeviceStatusQueryMessageClientHandler(MessageProcessorClient messageProce

@Override
public String getRootType() {
return QUERY;
return ClientMessageRequestProcessor.METHOD + QUERY;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.gb28181.common.entity.base.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;
Expand All @@ -36,10 +36,9 @@ public RecordInfoQueryMessageClientHandler(MessageProcessorClient messageProcess
super(messageProcessorClient, sipUserGenerateClient);
}


@Override
public String getRootType() {
return QUERY;
return ClientMessageRequestProcessor.METHOD + QUERY;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import org.springframework.stereotype.Component;

import gov.nist.javax.sip.message.SIPRequest;
import io.github.lunasaw.gb28181.common.entity.base.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;
Expand All @@ -32,7 +32,7 @@ public SubscribeClientHandlerAbstract(SubscribeProcessorClient subscribeProcesso

@Override
public String getRootType() {
return "Root";
return ClientSubscribeRequestProcessor.METHOD + "Root";
}

public DeviceSession getDeviceSession(RequestEvent event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

import javax.sip.RequestEvent;
import javax.sip.header.ContentTypeHeader;
import javax.sip.header.EventHeader;
import javax.sip.header.ExpiresHeader;
import javax.sip.message.Response;

import io.github.lunasaw.gbproxy.client.user.SipUserGenerateClient;
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;

import gov.nist.javax.sip.message.SIPRequest;
import io.github.lunasaw.gbproxy.client.transmit.request.subscribe.SubscribeClientHandlerAbstract;
import io.github.lunasaw.gbproxy.client.transmit.request.subscribe.SubscribeProcessorClient;
import io.github.lunasaw.gb28181.common.entity.base.DeviceSession;
import io.github.lunasaw.sip.common.entity.DeviceSession;
import io.github.lunasaw.gb28181.common.entity.query.DeviceQuery;
import io.github.lunasaw.gb28181.common.entity.enums.CmdTypeEnum;
import io.github.lunasaw.sip.common.subscribe.SubscribeInfo;
Expand All @@ -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);
}

Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import io.github.lunasaw.gbproxy.client.Gb28181Client;
Expand All @@ -31,10 +32,12 @@ public class ApplicationTest {
static String localIp = "172.19.128.100";
FromDevice fromDevice;
ToDevice toDevice;
@Autowired
SipLayer sipLayer;

@BeforeEach
public void before() {
SipLayer.addListeningPoint(localIp, 8117);
sipLayer.addListeningPoint(localIp, 8117);
fromDevice = FromDevice.getInstance("33010602011187000001", localIp, 8117);
toDevice = ToDevice.getInstance("41010500002000000001", localIp, 8118);
toDevice.setPassword("luna");
Expand Down
2 changes: 1 addition & 1 deletion gb28181-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.github.lunasaw</groupId>
<artifactId>sip-proxy</artifactId>
<version>1.1.5</version>
<version>1.1.6</version>
</parent>

<version>${gb28181-proxy.version}</version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.lunasaw.sip.common.enums;
package io.github.lunasaw.gb28181.common.entity.enums;

/**
* @author luna
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.lunasaw.sip.common.enums;
package io.github.lunasaw.gb28181.common.entity.enums;

/**
* @author luna
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package io.github.lunasaw.sip.common.enums;

import io.github.lunasaw.sip.common.constant.Constant;
package io.github.lunasaw.gb28181.common.entity.enums;

/**
* @author luna
Expand All @@ -11,8 +9,8 @@ public enum TransModeEnum {
/**
* 传输模式
*/
UDP(Constant.UDP, "UDP"),
TCP(Constant.TCP, "TCP"),
UDP("UDP", "UDP"),
TCP("TCP", "TCP"),

;

Expand Down
2 changes: 1 addition & 1 deletion gb28181-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.github.lunasaw</groupId>
<artifactId>sip-proxy</artifactId>
<version>1.1.5</version>
<version>1.1.6</version>
</parent>

<version>${gb28181-proxy.version}</version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.lunasaw.gbproxy.server.entity;

import io.github.lunasaw.gb28181.common.entity.enums.InviteSessionNameEnum;
import io.github.lunasaw.sip.common.enums.ManufacturerEnum;
import io.github.lunasaw.sip.common.enums.StreamModeEnum;
import io.github.lunasaw.gb28181.common.entity.enums.ManufacturerEnum;
import io.github.lunasaw.gb28181.common.entity.enums.StreamModeEnum;
import org.apache.commons.lang3.StringUtils;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.lunasaw.gbproxy.server.entity;

import io.github.lunasaw.sip.common.enums.ManufacturerEnum;
import io.github.lunasaw.sip.common.enums.StreamModeEnum;
import io.github.lunasaw.gb28181.common.entity.enums.ManufacturerEnum;
import io.github.lunasaw.gb28181.common.entity.enums.StreamModeEnum;
import io.github.lunasaw.sip.common.utils.SipUtils;
import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import io.github.lunasaw.gbproxy.server.enums.PlayActionEnums;
import io.github.lunasaw.sip.common.entity.FromDevice;
import io.github.lunasaw.sip.common.entity.ToDevice;
import io.github.lunasaw.sip.common.enums.StreamModeEnum;
import io.github.lunasaw.gb28181.common.entity.enums.StreamModeEnum;
import io.github.lunasaw.sip.common.subscribe.SubscribeInfo;
import io.github.lunasaw.sip.common.transmit.SipSender;

Expand Down
Loading

0 comments on commit 6068baf

Please sign in to comment.