Skip to content

Commit efc6884

Browse files
fix(sip): send 487 Request Terminated after OK (CANCEL) for pending INVITE (#372)
When a CANCEL is received for an INVITE that hasn't been answered, the SIP gateway now correctly sends a 487 response to the original INVITE. This ensures proper SIP transaction termination and avoids issues where upstream proxies (e.g., Brekeke) keep the call in an INVITE state due to the missing final response.
1 parent 6d79b26 commit efc6884

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pkg/sip/inbound.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,9 +1161,7 @@ func (c *sipInbound) StartRinging() {
11611161
case r := <-cancels:
11621162
close(c.cancelled)
11631163
_ = tx.Respond(sip.NewResponseFromRequest(r, sip.StatusOK, "OK", nil))
1164-
c.mu.Lock()
1165-
c.drop()
1166-
c.mu.Unlock()
1164+
c.RespondAndDrop(sip.StatusRequestTerminated, "Request Terminated")
11671165
return
11681166
case <-ticker.C:
11691167
}

0 commit comments

Comments
 (0)