forked from CyCoreSystems/ari-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
modules.go
57 lines (46 loc) · 1.35 KB
/
modules.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package server
import (
"context"
"github.com/CyCoreSystems/ari-proxy/v5/proxy"
)
func (s *Server) asteriskModuleLoad(ctx context.Context, reply string, req *proxy.Request) {
s.sendError(reply, s.ari.Asterisk().Modules().Load(req.Key))
}
func (s *Server) asteriskModuleUnload(ctx context.Context, reply string, req *proxy.Request) {
s.sendError(reply, s.ari.Asterisk().Modules().Unload(req.Key))
}
func (s *Server) asteriskModuleReload(ctx context.Context, reply string, req *proxy.Request) {
s.sendError(reply, s.ari.Asterisk().Modules().Reload(req.Key))
}
func (s *Server) asteriskModuleData(ctx context.Context, reply string, req *proxy.Request) {
data, err := s.ari.Asterisk().Modules().Data(req.Key)
if err != nil {
s.sendError(reply, err)
return
}
s.publish(reply, &proxy.Response{
Data: &proxy.EntityData{
Module: data,
},
})
}
func (s *Server) asteriskModuleGet(ctx context.Context, reply string, req *proxy.Request) {
data, err := s.ari.Asterisk().Modules().Data(req.Key)
if err != nil {
s.sendError(reply, err)
return
}
s.publish(reply, &proxy.Response{
Key: data.Key,
})
}
func (s *Server) asteriskModuleList(ctx context.Context, reply string, req *proxy.Request) {
list, err := s.ari.Asterisk().Modules().List(nil)
if err != nil {
s.sendError(reply, err)
return
}
s.publish(reply, &proxy.Response{
Keys: list,
})
}