Documentation ¶
Index ¶
- Variables
- func SetLogger(l LoggerInterface)
- func StringInSlice(str string, list []string) bool
- type Client
- type ConnectOptions
- type ESLConnection
- type ESLServer
- type ErrorCouldNotReadBody
- type ErrorInvalidCommand
- type ErrorInvalidContentLength
- type ErrorInvalidPassword
- type ErrorInvalidServerAddr
- type ErrorReadMIMEHeaders
- type ErrorSendEvent
- type ErrorUnexpectedAuthHeader
- type ErrorUnmarshallJSON
- type ErrorUnsuccessfulReply
- type ErrorUnsupportedMessageType
- type ErrorWriteTiemout
- type HandlerFunc
- type LoggerInterface
- type Message
- type SocketConnection
- func (sc *SocketConnection) Api(command string) error
- func (sc *SocketConnection) BgApi(command string) error
- func (c *SocketConnection) Close() error
- func (c *SocketConnection) Errors() chan error
- func (c *SocketConnection) Execute(command, args string, sync bool) (err error)
- func (sc *SocketConnection) ExecuteAnswer(args string, sync bool) (err error)
- func (sc *SocketConnection) ExecuteHangup(uuid string, args string, sync bool) (err error)
- func (sc *SocketConnection) ExecuteSet(key string, value string, sync bool) error
- func (c *SocketConnection) ExecuteUUID(uuid string, command string, args string, sync bool) (err error)
- func (c *SocketConnection) Messages() chan *Message
- func (c *SocketConnection) Send(cmd string) error
- func (c *SocketConnection) SendEvent(eventHeaders []string) error
- func (c *SocketConnection) SendMany(cmds []string) error
- func (c *SocketConnection) SendMsg(msg map[string]string, uuid, data string) error
Constants ¶
This section is empty.
Variables ¶
var ( // Size of buffer when we read from connection. // 1024 << 6 == 65536 ReadBufferSize = 1024 << 6 // Freeswitch events that we can handle (have logic for it) AvailableMessageTypes = []string{"auth/request", "text/disconnect-notice", "text/event-json", "text/event-plain", "api/response", "command/reply"} )
Functions ¶
func StringInSlice ¶
StringInSlice - Will check if string in list. This is equivalent to python if x in [] @TODO - What the fuck Nevio...
Types ¶
type Client ¶
type Client struct {
*SocketConnection
}
Client - In case you need to do inbound dialing against freeswitch server in order to originate call or see sofia statuses or whatever else you came up with
func NewClient ¶
func NewClient(aOpts ConnectOptions) (*Client, error)
NewClient - Will initiate new client that will establish connection and attempt to authenticate against connected freeswitch server
type ConnectOptions ¶
ConnectOptions represent a cinitial connection options
type ESLConnection ¶
type ESLConnection struct {
*SocketConnection
}
ESLConnection wrapper for incoming connection
type ESLServer ¶
type ESLServer struct {
// contains filtered or unexported fields
}
ESLServer - In case you need to start server, this Struct have it covered
func NewESLServer ¶
func NewESLServer() *ESLServer
NewESLServer - Will instanciate new outbound server
type ErrorCouldNotReadBody ¶
type ErrorCouldNotReadBody struct {
// contains filtered or unexported fields
}
ErrorCouldNotReadBody ...
type ErrorInvalidCommand ¶
type ErrorInvalidCommand struct {
// contains filtered or unexported fields
}
ErrorInvalidCommand fired when try to send invalid command
type ErrorInvalidContentLength ¶
type ErrorInvalidContentLength struct {
// contains filtered or unexported fields
}
ErrorInvalidContentLength ...
type ErrorInvalidPassword ¶
type ErrorInvalidPassword struct {
// contains filtered or unexported fields
}
ErrorInvalidPassword ...
type ErrorInvalidServerAddr ¶
type ErrorInvalidServerAddr struct {
// contains filtered or unexported fields
}
ErrorInvalidServerAddr ...
type ErrorReadMIMEHeaders ¶
type ErrorReadMIMEHeaders struct {
// contains filtered or unexported fields
}
ErrorReadMIMEHeaders ...
type ErrorSendEvent ¶
type ErrorSendEvent struct {
// contains filtered or unexported fields
}
ErrorSendEvent ...
type ErrorUnexpectedAuthHeader ¶
type ErrorUnexpectedAuthHeader struct {
// contains filtered or unexported fields
}
ErrorUnexpectedAuthHeader ...
type ErrorUnmarshallJSON ¶
type ErrorUnmarshallJSON struct {
// contains filtered or unexported fields
}
ErrorUnmarshallJSON ...
type ErrorUnsuccessfulReply ¶
type ErrorUnsuccessfulReply struct {
// contains filtered or unexported fields
}
ErrorUnsuccessfulReply ...
type ErrorUnsupportedMessageType ¶
type ErrorUnsupportedMessageType struct {
// contains filtered or unexported fields
}
ErrorUnsupportedMessageType ...
type ErrorWriteTiemout ¶
type ErrorWriteTiemout struct {
// contains filtered or unexported fields
}
ErrorWriteTiemout timeout error
type HandlerFunc ¶
type HandlerFunc func(*ESLConnection) bool
HandlerFunc hadler for incomming connection
type LoggerInterface ¶
type LoggerInterface interface { Debug(message string, args ...interface{}) Error(message string, args ...interface{}) Info(message string, args ...interface{}) Warning(message string, args ...interface{}) }
LoggerInterface base logger interface
type Message ¶
Message - Freeswitch Message that is received by GoESL. Message struct is here to help with parsing message and dumping its contents. In addition to that it's here to make sure received message is in fact message we wish/can support
func (*Message) Dump ¶
Dump - Will return message prepared to be dumped out. It's like prettify message for output
func (*Message) GetCallUUID ¶
GetCallUUID - Will return Caller-Unique-Id
type SocketConnection ¶
type SocketConnection struct {
// contains filtered or unexported fields
}
SocketConnection main connection against ESL
func (*SocketConnection) Api ¶
func (sc *SocketConnection) Api(command string) error
Api - Helper designed to attach api in front of the command so that you do not need to write it
func (*SocketConnection) BgApi ¶
func (sc *SocketConnection) BgApi(command string) error
BgApi - Helper designed to attach bgapi in front of the command so that you do not need to write it
func (*SocketConnection) Close ¶
func (c *SocketConnection) Close() error
Close - Will close down net connection and return error if error happen
func (*SocketConnection) Errors ¶
func (c *SocketConnection) Errors() chan error
Errors - returns error channel
func (*SocketConnection) Execute ¶
func (c *SocketConnection) Execute(command, args string, sync bool) (err error)
Execute - Helper fuck to execute commands with its args and sync/async mode
func (*SocketConnection) ExecuteAnswer ¶
func (sc *SocketConnection) ExecuteAnswer(args string, sync bool) (err error)
ExecuteAnswer - Helper desgned to help with executing Answer against active ESL session
func (*SocketConnection) ExecuteHangup ¶
func (sc *SocketConnection) ExecuteHangup(uuid string, args string, sync bool) (err error)
ExecuteHangup - Helper desgned to help with executing Hangup against active ESL session
func (*SocketConnection) ExecuteSet ¶
func (sc *SocketConnection) ExecuteSet(key string, value string, sync bool) error
ExecuteSet - Helper that you can use to execute SET application against active ESL session
func (*SocketConnection) ExecuteUUID ¶
func (c *SocketConnection) ExecuteUUID(uuid string, command string, args string, sync bool) (err error)
ExecuteUUID - Helper fuck to execute uuid specific commands with its args and sync/async mode
func (*SocketConnection) Messages ¶
func (c *SocketConnection) Messages() chan *Message
Messages - returns messages channel
func (*SocketConnection) Send ¶
func (c *SocketConnection) Send(cmd string) error
Send - Will send raw message to open net connection
func (*SocketConnection) SendEvent ¶
func (c *SocketConnection) SendEvent(eventHeaders []string) error
SendEvent - Will loop against passed event headers
func (*SocketConnection) SendMany ¶
func (c *SocketConnection) SendMany(cmds []string) error
SendMany - Will loop against passed commands and return 1st error if error happens