kamevapi

package module
v1.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2023 License: MIT Imports: 11 Imported by: 0

README

kamevapi

Kamailio evapi connector from Go

Build Status

Installation

go get github.com/cgrates/kamevapi

Support

Join CGRateS on Google Groups here.

License

kamevapi.go is released under the MIT License.

Copyright (C) ITsysCOM GmbH. All Rights Reserved.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KamEvapi

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

func NewKamEvapi

func NewKamEvapi(addr string, connIdx int, recons int, maxReconnectInterval time.Duration,
	delayFunc func(time.Duration, time.Duration) func() time.Duration,
	eventHandlers map[*regexp.Regexp][]func([]byte, int), logger *log.Logger) (*KamEvapi, error)

NewKamEvapi creates a new kamEvApi, connects it and in case forkRead is enabled starts listening in background

func (*KamEvapi) Connect

func (kea *KamEvapi) Connect() error

Connect or reconnect

func (*KamEvapi) Connected

func (kea *KamEvapi) Connected() bool

Connected checks if socket connected. Can be extended with pings

func (*KamEvapi) Disconnect

func (kea *KamEvapi) Disconnect() (err error)

Disconnect disconnects from socket

func (*KamEvapi) ReadEvents

func (kea *KamEvapi) ReadEvents() (err error)

ReadEvents reads events from socket, attempt reconnect if disconnected

func (*KamEvapi) ReconnectIfNeeded

func (kea *KamEvapi) ReconnectIfNeeded() error

ReconnectIfNeeded if not connected, attempt reconnect if allowed

func (*KamEvapi) RemoteAddr

func (kea *KamEvapi) RemoteAddr() net.Addr

RemoteAddr returns the connection address if is connected

func (*KamEvapi) Send

func (kea *KamEvapi) Send(dataStr string) error

Send data to Kamailio

type KamEvapiPool

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

Connection handler for commands sent to FreeSWITCH

func NewKamEvapiPool

func NewKamEvapiPool(maxconns int, kamAddr string, connIdx, reconnects int, maxReconnectInterval time.Duration,
	delayFuncConstructor func(time.Duration, time.Duration) func() time.Duration, l *log.Logger) (*KamEvapiPool, error)

Instantiates a new KamEvapiPool

func (*KamEvapiPool) PopKamEvapi

func (keap *KamEvapiPool) PopKamEvapi() (*KamEvapi, error)

Retrieves a connection from the pool

func (*KamEvapiPool) PushKamEvapi

func (keap *KamEvapiPool) PushKamEvapi(kea *KamEvapi)

Push the connection back to the pool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL