Clear stale unanswered calls before new invite

This commit is contained in:
richjohnrambo
2026-09-04 18:16:26 +08:00
parent 4ad6ca00b4
commit b4d3fbe359
4 changed files with 53 additions and 2 deletions
+22
View File
@@ -530,6 +530,28 @@ func TestHandleBroadcastCallRequiresStructuredInvite(t *testing.T) {
}
}
func TestVideoCallStaleUnanswered(t *testing.T) {
now := time.Date(2026, time.September, 4, 10, 5, 0, 0, time.UTC)
call := &videoCall{
parties: map[string]callPartyData{"origin": {isOriginator: true}},
startedAt: now.Add(-31 * time.Second),
}
if !call.isStaleUnanswered(now, 30) {
t.Fatal("unanswered call older than establishment timeout should be stale")
}
call.startedAt = now.Add(-29 * time.Second)
if call.isStaleUnanswered(now, 30) {
t.Fatal("unanswered call within establishment timeout should not be stale")
}
call.parties["callee"] = callPartyData{}
call.startedAt = now.Add(-31 * time.Second)
if call.isStaleUnanswered(now, 30) {
t.Fatal("accepted call must not be treated as stale by establishment timeout")
}
}
func TestHandleBroadcastDataGroup(t *testing.T) {
topicName := "grp-test"
numUsers := 4