MCPcopy Create free account
hub / github.com/CyCoreSystems/ari-proxy / appStart

Function appStart

_examples/record/main.go:44–72  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

42}
43
44func appStart(ctx context.Context) func(*ari.ChannelHandle, *ari.StasisStart) {
45 return func(h *ari.ChannelHandle, startEvent *ari.StasisStart) {
46 defer h.Hangup()
47
48 log.Info("running app", "channel", h.Key().ID)
49
50 if err := h.Answer(); err != nil {
51 log.Error("failed to answer call", "error", err)
52 // return
53 }
54
55 res, err := record.Record(ctx, h,
56 record.TerminateOn("any"),
57 record.IfExists("overwrite"),
58 ).Result()
59 if err != nil {
60 log.Error("failed to record", "error", err)
61 return
62 }
63
64 if err = res.Save("test-recording"); err != nil {
65 log.Error("failed to save recording", "error", err)
66 }
67
68 log.Info("completed recording")
69
70 h.Hangup()
71 }
72}

Callers 1

mainFunction · 0.70

Calls 5

HangupMethod · 0.80
InfoMethod · 0.80
AnswerMethod · 0.80
ErrorMethod · 0.45
RecordMethod · 0.45

Tested by

no test coverage detected