diff --git a/main.go b/main.go index 6e7ce4b..3c7a87c 100644 --- a/main.go +++ b/main.go @@ -126,7 +126,6 @@ func recoverStreams() ([]*Stream, []*Sink) { if !ok { Sugar.Infof("删除过期的推流会话 stream: %s", stream.ID) closedStreams = append(closedStreams, stream) - stream.Close(true, false) continue } diff --git a/stream.go b/stream.go index 2fefd8c..da38c88 100644 --- a/stream.go +++ b/stream.go @@ -187,3 +187,10 @@ func CreateRequestFromDialog(dialog sip.Request, method sip.RequestMethod) sip.R func (s *Stream) CreateRequestFromDialog(method sip.RequestMethod) sip.Request { return CreateRequestFromDialog(s.Dialog, method) } + +func CloseStream(streamId StreamID, ms bool) { + stream := StreamManager.Remove(streamId) + if stream != nil { + stream.Close(true, ms) + } +}