Skip to content

Commit 88ade09

Browse files
committed
Sending Request terminated status when Call is cancelled
1 parent ecb5252 commit 88ade09

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
@@ -854,7 +854,7 @@ func (c *inboundCall) closeWithCancelled() {
854854
c.state.DeferUpdate(func(info *livekit.SIPCallInfo) {
855855
info.DisconnectReason = livekit.DisconnectReason_CLIENT_INITIATED
856856
})
857-
c.close(false, CallHangup, "cancelled")
857+
c.close(false, CallCancelled, "cancelled")
858858
}
859859

860860
func (c *inboundCall) closeWithHangup() {
@@ -1207,7 +1207,6 @@ func (c *sipInbound) StartRinging() {
12071207
case r := <-cancels:
12081208
close(c.cancelled)
12091209
_ = tx.Respond(sip.NewResponseFromRequest(r, sip.StatusOK, "OK", nil))
1210-
c.RespondAndDrop(sip.StatusRequestTerminated, "Request Terminated")
12111210
return
12121211
case <-ticker.C:
12131212
}

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)