| 40 | } |
| 41 | |
| 42 | func appStart(ctx context.Context) func(*ari.ChannelHandle, *ari.StasisStart) { |
| 43 | return func(h *ari.ChannelHandle, startEvent *ari.StasisStart) { |
| 44 | defer h.Hangup() |
| 45 | |
| 46 | log.Info("running app", "channel", h.Key().ID) |
| 47 | |
| 48 | if err := h.Answer(); err != nil { |
| 49 | log.Error("failed to answer call", "error", err) |
| 50 | // return |
| 51 | } |
| 52 | |
| 53 | if err := play.Play(ctx, h, play.URI("sound:tt-monkeys")).Err(); err != nil { |
| 54 | log.Error("failed to play sound", "error", err) |
| 55 | return |
| 56 | } |
| 57 | |
| 58 | log.Info("completed playback") |
| 59 | return |
| 60 | } |
| 61 | } |