Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions pkg/sip/outbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,10 @@ func (c *outboundCall) close(err error, status CallStatus, description string, r
info.DisconnectReason = reason
})
c.media.Close()
_ = c.lkRoom.CloseOutput()

_ = c.lkRoom.CloseWithReason(status.DisconnectReason())
if r := c.lkRoom; r != nil {
_ = r.CloseOutput()
_ = r.CloseWithReason(status.DisconnectReason())
}
c.lkRoomIn = nil

c.stopSIP(description)
Expand Down Expand Up @@ -390,6 +391,7 @@ func (c *outboundCall) connectToRoom(ctx context.Context, lkNew RoomConfig, getR
lkNew.Participant.Attributes = attrs
r := getRoom(c.log, &c.stats.Room)
if err := r.Connect(c.c.conf, lkNew); err != nil {
_ = r.Close()
return err
}
// We have to create the track early because we might play a dialtone while SIP connects.
Expand Down Expand Up @@ -492,6 +494,9 @@ func (c *outboundCall) setStatus(v CallStatus) {
if attr == "" {
return
}
if c.lkRoom == nil {
return
}
r := c.lkRoom.Room()
if r == nil {
return
Expand Down Expand Up @@ -617,6 +622,9 @@ func (c *outboundCall) sipSignal(ctx context.Context, tid traceid.ID) error {
}

func (c *outboundCall) handleDTMF(ev dtmf.Event) {
if c.lkRoom == nil {
return
}
_ = c.lkRoom.SendData(&livekit.SipDTMF{
Code: uint32(ev.Code),
Digit: string([]byte{ev.Digit}),
Expand Down
Loading