-
Notifications
You must be signed in to change notification settings - Fork 73
/
asterisk.go
75 lines (62 loc) · 2.49 KB
/
asterisk.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package ari
// Asterisk represents a communication path for
// the Asterisk server for system-level resources
type Asterisk interface {
// Info gets data about the asterisk system
Info(key *Key) (*AsteriskInfo, error)
// Variables returns the global asterisk variables
Variables() AsteriskVariables
// Logging returns the interface for working with asterisk logs
Logging() Logging
// Modules returns the interface for working with asterisk modules
Modules() Modules
// Config returns the interface for working with dynamic configuration
Config() Config
}
// AsteriskInfo describes a running asterisk system
type AsteriskInfo struct {
BuildInfo BuildInfo `json:"build"`
ConfigInfo ConfigInfo `json:"config"`
StatusInfo StatusInfo `json:"status"`
SystemInfo SystemInfo `json:"system"`
}
// BuildInfo describes information about how Asterisk was built
type BuildInfo struct {
Date string `json:"date"`
Kernel string `json:"kernel"`
Machine string `json:"machine"`
Options string `json:"options"`
Os string `json:"os"`
User string `json:"user"`
}
// ConfigInfo describes information about the Asterisk configuration
type ConfigInfo struct {
DefaultLanguage string `json:"default_language"`
MaxChannels int `json:"max_channels,omitempty"` // omitempty denotes an optional field, meaning the field may not be present if no value is assigned.
MaxLoad float64 `json:"max_load,omitempty"`
MaxOpenFiles int `json:"max_open_files,omitempty"`
Name string `json:"name"` // Asterisk system name
SetID SetID `json:"setid"` // Effective user/group id under which Asterisk is running
}
// SetID describes a userid/groupid pair
type SetID struct {
Group string `json:"group"` // group id (not name? why string?)
User string `json:"user"` // user id (not name? why string?)
}
// StatusInfo describes the state of an Asterisk system
type StatusInfo struct {
LastReloadTime DateTime `json:"last_reload_time"`
StartupTime DateTime `json:"startup_time"`
}
// SystemInfo describes information about the Asterisk system
type SystemInfo struct {
EntityID string `json:"entity_id"`
Version string `json:"version"`
}
// AsteriskVariables is an interface to interact with Asterisk global variables
type AsteriskVariables interface {
// Get returns the value of the given variable; the ID field of the Key is the variable name
Get(key *Key) (string, error)
// Set sets the variable; the ID field of the Key is the variable name
Set(key *Key, value string) error
}