ari icon indicating copy to clipboard operation
ari copied to clipboard

_examples/play h.Hangup() don't work

Open remotejob opened this issue 3 years ago • 1 comments

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

}`

remotejob avatar Feb 20 '21 04:02 remotejob

Did you find any solution? @remotejob

raszia avatar Jun 21 '21 19:06 raszia