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
+9 -2
View File
@@ -1227,8 +1227,15 @@ func (t *Topic) handlePubBroadcast(msg *ClientComMessage) {
return
}
if t.currentCall != nil {
msg.sess.queueOut(ErrCallBusyReply(msg, types.TimeNow()))
return
now := types.TimeNow()
if t.currentCall.isStaleUnanswered(now, imCallTimeoutSeconds()) {
logs.Warn.Printf("topic[%s]: clearing stale unanswered call seq=%d call_id=%s before new invite", t.name, t.currentCall.seq, t.currentCall.callID)
t.terminateCallInProgress(true)
}
if t.currentCall != nil {
msg.sess.queueOut(ErrCallBusyWithCallReply(msg, now, t.currentCall))
return
}
}
head, content, err := normalizeCallInvite(msg.Pub.Head, msg.Pub.Content)
if err != nil {