-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from lunasaw/dev_1.1.3
Dev 1.1.3
- Loading branch information
Showing
16 changed files
with
213 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
72 changes: 72 additions & 0 deletions
72
gb28181-test/src/test/java/io/github/lunasaw/gbproxy/test/invite/ClientInviteTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package io.github.lunasaw.gbproxy.test.invite; | ||
|
||
import javax.sip.message.Request; | ||
|
||
import org.junit.jupiter.api.AfterAll; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
import io.github.lunasaw.gbproxy.client.transmit.cmd.ClientSendCmd; | ||
import io.github.lunasaw.gbproxy.test.Gb28181ApplicationTest; | ||
import io.github.lunasaw.gbproxy.test.config.DeviceConfig; | ||
import io.github.lunasaw.gbproxy.test.user.client.DefaultRegisterProcessorClient; | ||
import io.github.lunasaw.sip.common.entity.Device; | ||
import io.github.lunasaw.sip.common.entity.FromDevice; | ||
import io.github.lunasaw.sip.common.entity.ToDevice; | ||
import io.github.lunasaw.sip.common.layer.SipLayer; | ||
import io.github.lunasaw.sip.common.transmit.SipSender; | ||
import io.github.lunasaw.sip.common.transmit.request.SipRequestProvider; | ||
import io.github.lunasaw.sip.common.utils.SipRequestUtils; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
/** | ||
* @author luna | ||
* @date 2023/10/12 | ||
*/ | ||
@Slf4j | ||
@SpringBootTest(classes = Gb28181ApplicationTest.class) | ||
public class ClientInviteTest { | ||
|
||
@Autowired | ||
@Qualifier("clientFrom") | ||
private Device fromDevice; | ||
|
||
@Autowired | ||
@Qualifier("clientTo") | ||
private Device toDevice; | ||
|
||
@AfterAll | ||
public static void after() { | ||
while (true) { | ||
|
||
} | ||
} | ||
|
||
@BeforeEach | ||
public void before() { | ||
// 本地端口监听 | ||
log.info("before::客户端初始化 fromDevice.ip : {} , fromDevice.port : {}", fromDevice.getIp(), fromDevice.getPort()); | ||
SipLayer.addListeningPoint(DeviceConfig.LOOP_IP, fromDevice.getPort()); | ||
// 模拟平台添加 | ||
DeviceConfig.DEVICE_CLIENT_VIEW_MAP.put(toDevice.getUserId(), toDevice); | ||
} | ||
|
||
@Test | ||
public void test_register_client() { | ||
String callId = SipRequestUtils.getNewCallId(); | ||
Request registerRequest = SipRequestProvider.createRegisterRequest((FromDevice)fromDevice, (ToDevice)toDevice, 300, callId); | ||
|
||
SipSender.transmitRequest(fromDevice.getIp(), registerRequest); | ||
} | ||
|
||
@Test | ||
public void b_test_un_register_client_custom() { | ||
Device instance = DeviceConfig.DEVICE_CLIENT_VIEW_MAP.get("41010500002000000001"); | ||
DefaultRegisterProcessorClient.isRegister = false; | ||
ClientSendCmd.deviceUnRegister((FromDevice)fromDevice, (ToDevice)instance); | ||
} | ||
|
||
} |
77 changes: 77 additions & 0 deletions
77
gb28181-test/src/test/java/io/github/lunasaw/gbproxy/test/invite/ServerInviteTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package io.github.lunasaw.gbproxy.test.invite; | ||
|
||
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.beans.factory.annotation.Qualifier; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
import io.github.lunasaw.gbproxy.server.transimit.cmd.ServerSendCmd; | ||
import io.github.lunasaw.gbproxy.test.Gb28181ApplicationTest; | ||
import io.github.lunasaw.gbproxy.test.config.DeviceConfig; | ||
import io.github.lunasaw.sip.common.entity.Device; | ||
import io.github.lunasaw.sip.common.entity.FromDevice; | ||
import io.github.lunasaw.sip.common.entity.ToDevice; | ||
import io.github.lunasaw.sip.common.layer.SipLayer; | ||
import io.github.lunasaw.sip.common.utils.DynamicTask; | ||
import lombok.SneakyThrows; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
/** | ||
* @author luna | ||
* @date 2023/10/12 | ||
*/ | ||
@Slf4j | ||
@SpringBootTest(classes = Gb28181ApplicationTest.class) | ||
public class ServerInviteTest { | ||
|
||
@Autowired | ||
@Qualifier("serverFrom") | ||
private Device fromDevice; | ||
|
||
@Autowired | ||
private DynamicTask dynamicTask; | ||
|
||
@BeforeEach | ||
public void before() { | ||
// 本地端口监听 | ||
SipLayer.addListeningPoint(DeviceConfig.LOOP_IP, 8117, true); | ||
} | ||
|
||
@Test | ||
@SneakyThrows | ||
public void test_invite_server() { | ||
dynamicTask.startDelay("play_test", () -> { | ||
Device device = DeviceConfig.DEVICE_SERVER_VIEW_MAP.get("33010602011187000001"); | ||
if (device == null) { | ||
test_invite_server(); | ||
return; | ||
} | ||
String invitePlay = ServerSendCmd.deviceInvitePlay((FromDevice)fromDevice, (ToDevice)device, "127.0.0.1", 1554); | ||
}, 10 * 1000); | ||
} | ||
|
||
@Test | ||
@SneakyThrows | ||
public void test_invite_play_back_server() { | ||
dynamicTask.startDelay("play_back_test", () -> { | ||
Device device = DeviceConfig.DEVICE_SERVER_VIEW_MAP.get("34020000001320000001"); | ||
if (device == null) { | ||
test_invite_play_back_server(); | ||
return; | ||
} | ||
String invitePlay = | ||
ServerSendCmd.deviceInvitePlayBack((FromDevice)fromDevice, (ToDevice)device, "127.0.0.1", 10000, "2023-11-29 00:00:00"); | ||
System.out.println(invitePlay); | ||
}, 30 * 1000); | ||
} | ||
|
||
@SneakyThrows | ||
@AfterEach | ||
public void after() { | ||
while (true) { | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.