File tree Expand file tree Collapse file tree 5 files changed +12
-0
lines changed Expand file tree Collapse file tree 5 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import (
12
12
13
13
// spell-checker:words myevents bgapi noevents nixevent sendevent
14
14
15
+ // Client represents a client FreeSWITCH connection.
15
16
type Client struct {
16
17
conn * conn
17
18
chErr chan error
Original file line number Diff line number Diff line change 9
9
"strings"
10
10
)
11
11
12
+ // command defines a structure of a ESL command.
12
13
type command struct {
13
14
name string
14
15
params string
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import (
15
15
"time"
16
16
)
17
17
18
+ // Event represents an ESL event with headers and a body.
18
19
type Event struct {
19
20
headers map [string ]string
20
21
body []byte
Original file line number Diff line number Diff line change 5
5
"strings"
6
6
)
7
7
8
+ // eventNames is a map that contains the predefined names of various events as keys.
8
9
var eventNames = map [string ]struct {}{
9
10
// spell-checker:disable
10
11
"CUSTOM" : {},
Original file line number Diff line number Diff line change @@ -6,9 +6,13 @@ import (
6
6
"log/slog"
7
7
)
8
8
9
+ // Option is a function type used to modify configuration options.
9
10
type Option func (* config )
10
11
11
12
// WithEvents returns an Option that sets the events channel of a config.
13
+ //
14
+ // If the autoClose parameter is specified, the channel will be automatically
15
+ // closed when the connection to the server is closed.
12
16
func WithEvents (events chan <- Event , autoClose ... bool ) Option {
13
17
return func (c * config ) {
14
18
c .events = events
@@ -23,12 +27,16 @@ func WithLog(log *slog.Logger) Option {
23
27
}
24
28
}
25
29
30
+ // WithDumpIn sets the writer to record all incoming messages.
31
+ // It is used for logging during debugging.
26
32
func WithDumpIn (w io.Writer ) Option {
27
33
return func (c * config ) {
28
34
c .r = w
29
35
}
30
36
}
31
37
38
+ // WithDumpOut sets the writer to record all outgoing commands.
39
+ // It is used for logging during debugging.
32
40
func WithDumpOut (w io.Writer ) Option {
33
41
return func (c * config ) {
34
42
c .w = w
You can’t perform that action at this time.
0 commit comments