ari
ari copied to clipboard
_examples/play h.Hangup() don't work
Asterisk 18.0.0 go version go1.15.6
it's a play file but don't make h.Hangup() ??
`func app(ctx context.Context, h *ari.ChannelHandle) { defer h.Hangup()
ctx, cancel := context.WithCancel(ctx)
defer cancel()
log.Info("Running app", "channel", h.ID())
end := h.Subscribe(ari.Events.StasisEnd)
defer end.Cancel()
// End the app when the channel goes away
go func() {
<-end.Events()
cancel()
}()
if err := h.Answer(); err != nil {
log.Error("failed to answer call", "error", err)
return
}
if err := play.Play(ctx, h, play.URI("sound:tt-monkeys")).Err(); err != nil {
log.Error("failed to play sound", "error", err)
return
}
log.Info("completed playback")
// end.Cancel()
h.Hangup()
return
}`
Did you find any solution? @remotejob