forked from CyCoreSystems/ari
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (30 loc) · 739 Bytes
/
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
package main
import (
"github.com/inconshreveable/log15"
"github.com/gimatov/ari/v5/client/native"
)
func main() {
// OPTIONAL: setup logging
log := log15.New()
native.Logger = log
log.Info("Connecting")
cl, 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 cl.Close()
log.Info("Connected")
info, err := cl.Asterisk().Info(nil)
if err != nil {
log.Error("Failed to get Asterisk Info", "error", err)
return
}
log.Info("Asterisk Info", "info", info)
}