fsock: github.com/cgrates/fsock Index | Files

package fsock

import "github.com/cgrates/fsock"

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

Package Files

fsock.go utils.go

Constants

const EventBodyTag = "EvBody"

Variables

var (
    FS        *FSock // Used to share FS connection via package globals
    DelayFunc func() func() int

    ErrConnectionPoolTimeout = errors.New("ConnectionPool timeout")
)

func EventToMap Uses

func EventToMap(event string) (result map[string]string)

func FSEventStrToMap Uses

func FSEventStrToMap(fsevstr string, headers []string) map[string]string

Convert fseventStr into fseventMap

func MapChanData Uses

func MapChanData(chanInfoStr string) (chansInfoMap []map[string]string)

Converts string received from fsock into a list of channel info, each represented in a map

type FSock Uses

type FSock struct {
    // contains filtered or unexported fields
}

Connection to FreeSWITCH Socket

func NewFSock Uses

func NewFSock(fsaddr, fspaswd string, reconnects int, eventHandlers map[string][]func(string, int), eventFilters map[string][]string, l *syslog.Writer, connIdx int) (fsock *FSock, err error)

Connects to FS and starts buffering input

func (*FSock) Connect Uses

func (self *FSock) Connect() error

Connect or reconnect

func (*FSock) Connected Uses

func (self *FSock) Connected() (ok bool)

Connected checks if socket connected. Can be extended with pings

func (*FSock) Disconnect Uses

func (self *FSock) Disconnect() (err error)

Disconnects from socket

func (*FSock) LocalAddr Uses

func (self *FSock) LocalAddr() net.Addr

func (*FSock) ReadEvents Uses

func (self *FSock) ReadEvents() (err error)

ReadEvents reads events from socket, attempt reconnect if disconnected

func (*FSock) ReconnectIfNeeded Uses

func (self *FSock) ReconnectIfNeeded() (err error)

If not connected, attempt reconnect if allowed

func (*FSock) SendApiCmd Uses

func (self *FSock) SendApiCmd(cmdStr string) (string, error)

Send API command

func (*FSock) SendBgapiCmd Uses

func (self *FSock) SendBgapiCmd(cmdStr string) (out chan string, err error)

Send BGAPI command

func (*FSock) SendCmd Uses

func (self *FSock) SendCmd(cmdStr string) (string, error)

Generic proxy for commands

func (*FSock) SendCmdWithArgs Uses

func (self *FSock) SendCmdWithArgs(cmd string, args map[string]string, body string) (string, error)

func (*FSock) SendEvent Uses

func (self *FSock) SendEvent(eventSubclass string, eventParams map[string]string) (string, error)

SendEvent command

func (*FSock) SendEventWithBody Uses

func (self *FSock) SendEventWithBody(eventSubclass string, eventParams map[string]string, body string) (string, error)

SendEventWithBody command

func (*FSock) SendMsgCmd Uses

func (self *FSock) SendMsgCmd(uuid string, cmdargs map[string]string) error

SendMsgCmd command

func (*FSock) SendMsgCmdWithBody Uses

func (self *FSock) SendMsgCmdWithBody(uuid string, cmdargs map[string]string, body string) error

SendMsgCmdWithBody command

type FSockPool Uses

type FSockPool struct {
    // contains filtered or unexported fields
}

Connection handler for commands sent to FreeSWITCH

func NewFSockPool Uses

func NewFSockPool(maxFSocks int, fsaddr, fspasswd string, reconnects int, maxWaitConn time.Duration,
    eventHandlers map[string][]func(string, int), eventFilters map[string][]string, l *syslog.Writer, connIdx int) (*FSockPool, error)

Instantiates a new FSockPool

func (*FSockPool) PopFSock Uses

func (self *FSockPool) PopFSock() (fsock *FSock, err error)

func (*FSockPool) PushFSock Uses

func (self *FSockPool) PushFSock(fsk *FSock)

Package fsock imports 17 packages (graph) and is imported by 5 packages. Updated 2019-07-11. Refresh now. Tools for package owners.