Documentation ¶
Overview ¶
Package goami2 library for Asterisk Manager Interface
Index ¶
- Variables
- type Client
- type Header
- type Message
- func (m *Message) ActionID() string
- func (m *Message) AddActionID()
- func (m *Message) AddField(key, value string)
- func (m *Message) Byte() []byte
- func (m *Message) DelField(key string)
- func (m *Message) Field(key string) string
- func (m *Message) FieldValues(key string) []string
- func (m *Message) Headers() []Header
- func (m *Message) IsEvent() bool
- func (m *Message) IsResponse() bool
- func (m *Message) IsSuccess() bool
- func (m *Message) JSON() string
- func (m *Message) Len() int
- func (m *Message) SetField(name, value string)
- func (m *Message) String() string
- func (m *Message) Var(key string) (string, bool)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a AMI connection management object
func NewClient ¶
NewClient creates client. It is using NewClientWithContext in the background with a bogus context. For better context control use NewClientWithContext function.
func NewClientWithContext ¶ added in v1.7.0
func NewClientWithContext(ctx context.Context, conn net.Conn, username, password string) (*Client, error)
NewClientWithContext creates client with provided connection net.Conn and login into AMI server. It returns error if fials to login. Runs internal connection loop and provides AMI messages via AllMessages and error via Err methods.
func (*Client) Action ¶
Action sends AMI action to an Asterisk server Returns true on success and false if fails This function is deprecated and will be removed Use Send or MustSend instead
func (*Client) AllMessages ¶ added in v1.5.1
AllMessages returns a channel that receives any AMI messages from the client connection
type Message ¶ added in v1.5.1
type Message struct {
// contains filtered or unexported fields
}
Message represents AMI message object
func (*Message) AddActionID ¶ added in v1.5.1
func (m *Message) AddActionID()
AddActionID create random ID and add ActionID field to the message
func (*Message) Field ¶ added in v1.5.1
Field return field value. Case insensitive field search by name
func (*Message) FieldValues ¶ added in v1.5.1
FieldValues list of values for multiple headers with the same name
func (*Message) IsResponse ¶ added in v1.5.1
IsResponse returns true if message is response
func (*Message) SetField ¶ added in v1.7.0
SetField get first available field by name and updates its value. If field not in list then append new field