mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-27 05:15:47 +00:00
add Stop function to module
This commit is contained in:
@@ -29,6 +29,7 @@ type SIPCallServer struct {
|
||||
UserAgent string
|
||||
dg *diago.Diago
|
||||
logger *slog.Logger
|
||||
cancel context.CancelFunc
|
||||
}
|
||||
|
||||
type SIPCallMessage struct {
|
||||
@@ -118,7 +119,9 @@ func (scs *SIPCallServer) Run(ctx context.Context) error {
|
||||
return errors.New("sip.call.server unable to get router from context")
|
||||
}
|
||||
scs.router = router
|
||||
scs.ctx = ctx
|
||||
moduleContext, cancel := context.WithCancel(ctx)
|
||||
scs.ctx = moduleContext
|
||||
scs.cancel = cancel
|
||||
|
||||
diagoLogger := slog.New(slog.NewJSONHandler(io.Discard, nil))
|
||||
|
||||
@@ -228,3 +231,7 @@ func (scs *SIPCallServer) Output(ctx context.Context, payload any) error {
|
||||
}
|
||||
return errors.New("sip.dtmf.server can only output SipDTMFResponse or SipAudioFileResponse")
|
||||
}
|
||||
|
||||
func (scs *SIPCallServer) Stop() {
|
||||
scs.cancel()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user