Documentation ¶
Overview ¶
utils.go is released under the MIT License <http://www.opensource.org/licenses/mit-license.php Copyright (C) ITsysCOM. All Rights Reserved.
Provides FreeSWITCH socket communication.
Index ¶
- Constants
- Variables
- func EventToMap(event string) (result map[string]string)
- func FSEventStrToMap(fsevstr string, headers []string) map[string]string
- func MapChanData(chanInfoStr string, chanDelim string) (chansInfoMap []map[string]string)
- type FSConn
- type FSock
- func (fs *FSock) Connect() (err error)
- func (fs *FSock) Connected() (ok bool)
- func (fs *FSock) Disconnect() (err error)
- func (fs *FSock) LocalAddr() net.Addr
- func (fs *FSock) ReconnectIfNeeded() (err error)
- func (fs *FSock) SendApiCmd(cmdStr string) (string, error)
- func (fs *FSock) SendBgapiCmd(cmdStr string) (out chan string, err error)
- func (fs *FSock) SendCmd(cmdStr string) (rply string, err error)
- func (fs *FSock) SendCmdWithArgs(cmd string, args map[string]string, body string) (string, error)
- func (fs *FSock) SendEvent(eventSubclass string, eventParams map[string]string) (string, error)
- func (fs *FSock) SendEventWithBody(eventSubclass string, eventParams map[string]string, body string) (string, error)
- func (fs *FSock) SendMsgCmd(uuid string, cmdargs map[string]string) error
- func (fs *FSock) SendMsgCmdWithBody(uuid string, cmdargs map[string]string, body string) (err error)
- type FSockPool
Constants ¶
const EventBodyTag = "EvBody"
Variables ¶
var (
ErrConnectionPoolTimeout = errors.New("ConnectionPool timeout")
)
Functions ¶
func EventToMap ¶
func FSEventStrToMap ¶
FSEventStrToMap transforms an FreeSWITCH event string into a map, optionally filtering headers.
Types ¶
type FSConn ¶
type FSConn struct {
// contains filtered or unexported fields
}
func NewFSConn ¶
func NewFSConn(addr, passwd string, connIdx int, replyTimeout time.Duration, connErr chan error, lgr logger, evFilters map[string][]string, eventHandlers map[string][]func(string, int), bgapi bool, ) (*FSConn, error)
NewFSConn constructs and connects a FSConn
func (*FSConn) Disconnect ¶
Disconnect will disconnect the fsConn from FreeSWITCH
type FSock ¶
type FSock struct {
// contains filtered or unexported fields
}
FSock reperesents the connection to FreeSWITCH Socket
func NewFSock ¶
func NewFSock(addr, passwd string, reconnects int, maxReconnectInterval, replyTimeout time.Duration, delayFunc func(time.Duration, time.Duration) func() time.Duration, eventHandlers map[string][]func(string, int), eventFilters map[string][]string, logger logger, connIdx int, bgapi bool, stopError chan error, ) (fsock *FSock, err error)
NewFSock connects to FS and starts buffering input.
func (*FSock) Disconnect ¶
Disconnect adds up locking for disconnect
func (*FSock) ReconnectIfNeeded ¶
ReconnectIfNeeded adds up locking to reconnectIfNeeded
func (*FSock) SendApiCmd ¶
Send API command
func (*FSock) SendBgapiCmd ¶
Send BGAPI command
func (*FSock) SendCmdWithArgs ¶
func (*FSock) SendEventWithBody ¶
func (fs *FSock) SendEventWithBody(eventSubclass string, eventParams map[string]string, body string) (string, error)
SendEventWithBody command
func (*FSock) SendMsgCmd ¶
SendMsgCmd command
type FSockPool ¶
type FSockPool struct {
// contains filtered or unexported fields
}
Connection handler for commands sent to FreeSWITCH
func NewFSockPool ¶
func NewFSockPool(maxFSocks int, addr, passwd string, reconnects int, maxWaitConn, maxReconnectInterval, replyTimeout time.Duration, delayFuncConstructor func(time.Duration, time.Duration) func() time.Duration, eventHandlers map[string][]func(string, int), eventFilters map[string][]string, logger logger, connIdx int, bgapi bool, stopError chan error, ) *FSockPool
Instantiates a new FSockPool