Documentation
¶
Index ¶
- Variables
- type Event
- func (e Event) Body() string
- func (e Event) ContentLength() int
- func (e Event) ContentType() string
- func (e Event) Get(key string) string
- func (e Event) IsCustom() bool
- func (e Event) LogValue() slog.Value
- func (e Event) Name() string
- func (e Event) Sequence() int64
- func (e Event) Timestamp() time.Time
- func (e Event) Variable(name string) string
- type Monitor
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotConnected = errors.New("not connected") ErrAccessDenied = errors.New("access denied") ErrInvalidPassword = errors.New("invalid password") ErrTimeout = errors.New("timeout") )
Monitor errors.
Functions ¶
This section is empty.
Types ¶
type Event ¶
Event represents an ESL event with headers and a body.
func (Event) ContentLength ¶
ContentLength returns the length of the body in the Event.
func (Event) ContentType ¶
ContentType returns the content type of the event.
func (Event) LogValue ¶
LogValue returns the log value of the Event.
It returns a slog.Value that contains the name and sequence of the Event.
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor represents a FreeSWITCH ESL Monitor instance.
func New ¶
New creates a new FreeSWITCH ESL Monitor instance.
If the address doesn't contain a port, use the default port (8021). Panic if the address is malformed.
func (*Monitor) Run ¶
Run connects to the ESL server and subscribes to the events.
The connection is closed when the context is canceled or expired, and an error is returned. The error is the context error.
Returns an error if the connection fails or the authentication fails.
func (*Monitor) Subscribe ¶
Subscribe adds a new subscriber to the Monitor.
The send channel is used to send events to the subscriber.
The events parameter is a list of event names. If no events are provided or the "*" wildcard is used, all events are subscribed.
func (*Monitor) WithCommandsTimeout ¶
WithCommandsTimeout sets the command timeout. The default command timeout is 5 seconds.
Used on authorization and subscription requests.