-
Notifications
You must be signed in to change notification settings - Fork 73
/
main.go
59 lines (49 loc) · 1.26 KB
/
main.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
58
59
package main
import (
"github.com/inconshreveable/log15"
"github.com/CyCoreSystems/ari/v5/client/native"
)
func main() {
// OPTIONAL: setup logging
log := log15.New()
native.Logger = log
log.Info("connecting")
appA, err := native.Connect(&native.Options{
Application: "example",
Username: "admin",
Password: "admin",
URL: "http://localhost:8088/ari",
WebsocketURL: "ws://localhost:8088/ari/events",
})
if err != nil {
log.Error("failed to build native ARI client", "error", err)
return
}
defer appA.Close()
log.Info("Connected A")
appB, err := native.Connect(&native.Options{
Application: "exampleB",
Username: "admin",
Password: "admin",
URL: "http://localhost:8088/ari",
WebsocketURL: "ws://localhost:8088/ari/events",
})
if err != nil {
log.Error("failed to build native ARI client", "error", err)
return
}
defer appB.Close()
log.Info("Connected B")
infoA, err := appA.Asterisk().Info(nil)
if err != nil {
log.Error("Failed to get Asterisk Info", "error", err)
return
}
log.Info("AppA AsteriskInfo", "info", infoA)
infoB, err := appB.Asterisk().Info(nil)
if err != nil {
log.Error("Failed to get Asterisk Info", "error", err)
return
}
log.Info("AppB AsteriskInfo", "info", infoB)
}