Skip to content

Commit 5c747cf

Browse files
committed
Sending Request terminated status when Call is cancelled
1 parent 25a9855 commit 5c747cf

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pkg/sip/inbound.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ func (c *inboundCall) closeWithCancelled() {
960960
c.state.DeferUpdate(func(info *livekit.SIPCallInfo) {
961961
info.DisconnectReason = livekit.DisconnectReason_CLIENT_INITIATED
962962
})
963-
c.close(false, CallHangup, "cancelled")
963+
c.close(false, CallCancelled, "cancelled")
964964
}
965965

966966
func (c *inboundCall) closeWithHangup() {
@@ -1317,7 +1317,6 @@ func (c *sipInbound) StartRinging() {
13171317
case r := <-cancels:
13181318
close(c.cancelled)
13191319
_ = tx.Respond(sip.NewResponseFromRequest(r, sip.StatusOK, "OK", nil))
1320-
c.RespondAndDrop(sip.StatusRequestTerminated, "Request Terminated")
13211320
return
13221321
case <-ticker.C:
13231322
}

pkg/sip/participant.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ func (v CallStatus) Attribute() string {
6868
return "active"
6969
case CallHangup:
7070
return "hangup"
71+
case CallCancelled:
72+
return "cancelled"
7173
}
7274
}
7375

@@ -89,6 +91,8 @@ func (v CallStatus) SIPStatus() (sip.StatusCode, string) {
8991
switch v {
9092
default:
9193
return sip.StatusBusyHere, "Rejected"
94+
case CallCancelled:
95+
return sip.StatusRequestTerminated, "RequestTerminated"
9296
case callMediaFailed:
9397
return sip.StatusNotAcceptableHere, "MediaFailed"
9498
}
@@ -101,6 +105,7 @@ const (
101105
CallRinging
102106
CallAutomation
103107
CallActive
108+
CallCancelled
104109
CallHangup
105110
callUnavailable
106111
callRejected

0 commit comments

Comments
 (0)