Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
remotejob opened this issue Feb 20, 2021 · 1 comment
Open

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

remotejob opened this issue Feb 20, 2021 · 1 comment

Comments

@remotejob
Copy link

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

}`

@raszia
Copy link

raszia commented Jun 21, 2021

Did you find any solution? @remotejob

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants