Documentation
¶
Index ¶
- type Amigo
- func (a *Amigo) Action(action map[string]string) (map[string]string, error)
- func (a *Amigo) AgiAction(channel, command string) (map[string]string, error)
- func (a *Amigo) CapitalizeProps(c bool)
- func (a *Amigo) Connect()
- func (a *Amigo) Connected() bool
- func (a *Amigo) On(event string, handler func(string))
- func (a *Amigo) RegisterDefaultHandler(f handlerFunc) error
- func (a *Amigo) RegisterHandler(event string, f handlerFunc) error
- func (a *Amigo) SetEventChannel(c chan map[string]string)
- func (a *Amigo) UnregisterDefaultHandler(f handlerFunc) error
- func (a *Amigo) UnregisterHandler(event string, f handlerFunc) error
- type Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Amigo ¶
type Amigo struct {
// contains filtered or unexported fields
}
Amigo is a main package struct
func New ¶
New creates new Amigo struct with credentials provided and returns pointer to it Usage: New(username string, secret string, [host string, [port string]])
func (*Amigo) Action ¶
Action used to execute Actions in Asterisk. Returns immediately response from asterisk. Full response will follow. Usage amigo.Action(action map[string]string)
func (*Amigo) AgiAction ¶
AgiAction used to execute Agi Actions in Asterisk. Returns full response. Usage amigo.AgiAction(channel, command string)
func (*Amigo) CapitalizeProps ¶
CapitalizeProps used to capitalise all prop's names when true provided.
func (*Amigo) Connect ¶
func (a *Amigo) Connect()
Connect with Asterisk. If connect fails, will try to reconnect every second.
func (*Amigo) Connected ¶
Connected returns true if successfully connected and logged in Asterisk and false otherwise.
func (*Amigo) On ¶
On register handler for package events. Now amigo will emit two types of events: "connect" fired on connection success and "error" on any error occured.
func (*Amigo) RegisterDefaultHandler ¶
RegisterDefaultHandler registers handler function that will called on each event
func (*Amigo) RegisterHandler ¶
RegisterHandler registers handler function for provided event name
func (*Amigo) SetEventChannel ¶
SetEventChannel sets channel for receiving all events
func (*Amigo) UnregisterDefaultHandler ¶
UnregisterDefaultHandler removes default handler function
func (*Amigo) UnregisterHandler ¶
UnregisterHandler removes handler function for provided event name
type Settings ¶
type Settings struct { Username string Password string Host string Port string ActionTimeout time.Duration DialTimeout time.Duration ReconnectInterval time.Duration Keepalive bool }
Settings represents connection settings for Amigo. Default: Username = admin, Password = amp111, Host = 127.0.0.1, Port = 5038, ActionTimeout = 3s DialTimeout = 10s