|
|
@@ -107,6 +107,22 @@ class LateSipRecoveryTest {
|
|
|
assertNull(external.manager().getSsrcTransactionByStream("rtp", owned.getStream()));
|
|
|
}
|
|
|
|
|
|
+ @Test void failureBranchRemovesTheCorrelatedSubscriptionSoItCannotFireTwice() throws Exception {
|
|
|
+ RedisBytes external = new RedisBytes();
|
|
|
+ com.ruoyi.wvp.gb28181.transmit.SIPProcessorObserver observer = new com.ruoyi.wvp.gb28181.transmit.SIPProcessorObserver();
|
|
|
+ ReflectionTestUtils.setField(observer, "sessionManager", external.manager());
|
|
|
+ com.ruoyi.wvp.gb28181.event.SipSubscribe subscribe = new com.ruoyi.wvp.gb28181.event.SipSubscribe();
|
|
|
+ java.util.concurrent.atomic.AtomicInteger errors = new java.util.concurrent.atomic.AtomicInteger();
|
|
|
+ // Subscriptions are keyed by callId + cseq, exactly like the success branch.
|
|
|
+ subscribe.addSubscribe("call-19", com.ruoyi.wvp.gb28181.event.sip.SipEvent.getInstance("call-19", null,
|
|
|
+ result -> errors.incrementAndGet(), 60000));
|
|
|
+ ReflectionTestUtils.setField(observer, "sipSubscribe", subscribe);
|
|
|
+ observer.processResponse(new javax.sip.ResponseEvent(this, null, null,
|
|
|
+ response("INVITE", "call-1", 9, "z9hG4bK-invite", "to-1", 486)));
|
|
|
+ assertEquals(1, errors.get());
|
|
|
+ assertTrue(subscribe.isEmpty(), "the failed response must remove its own correlated subscription");
|
|
|
+ }
|
|
|
+
|
|
|
@Test void deletionCasCannotEraseAReplacementFromAnotherServiceInstance() throws Exception {
|
|
|
RedisBytes external = new RedisBytes(); SipInviteSessionManager sessions = external.manager();
|
|
|
SsrcTransaction owned = dialog("managed_11111111111111111111111111111111", "call-1"); sessions.put(owned);
|