amilib

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 6 Imported by: 3

README

amilib

Asterisk AMI library for amiproxy

The premises is you will have a cluster of asterisk servers , This library will allow to queue commands in any of the asterisks of the cluster or in an AWS loadbalance etc, etc. The goal is reduce the load in a system by accessing the asterisk using a proxy which is part of the project to queue the commands instead the AMI directly. There are libraries similar to this one using direct access to the port or using a different protocols, mostly ARI that require more call handling or event handling. The idea of this library is push and forget, trying to archieve high volumen of processing calls or events without needing a lot of ports to get this.

Documentation

Index

Constants

View Source
const DateFormat = "2006-01-02T15:04:05.000-0700"

DateFormat is the date format that ARI returns in the JSON bodies

Variables

This section is empty.

Functions

This section is empty.

Types

type AMIClientInterface

type AMIClientInterface interface {
	// Close shuts down the client
	Close() error

	//Connect to the client
	Connect(ctx context.Context) error

	//Set the logger handler for client
	SetLogHandler(log zerolog.Logger)

	//Set the listen for the client
	Listen(ctx context.Context) error
}

type Config

type Config interface {
	Get() (*ConfigData, error)
	Put(cfg *ConfigData) error
	Delete() error
}

type ConfigData

type ConfigData struct {
	NatsUrl  string
	UserName string
	Password string
	Server   string
	Port     int
	Verbose  bool
	Events   bool
}

func NewConfig

func NewConfig() *ConfigData

func (ConfigData) Delete

func (c ConfigData) Delete() error

func (ConfigData) Get

func (c ConfigData) Get() (*ConfigData, error)

func (ConfigData) Put

func (c ConfigData) Put(*ConfigData) error

type DateTime

type DateTime time.Time

DateTime is an alias type for attaching a custom asterisk unmarshaller and marshaller for JSON

func (DateTime) MarshalJSON

func (dt DateTime) MarshalJSON() ([]byte, error)

MarshalJSON converts the given date object to ARIs date format

func (DateTime) String

func (dt DateTime) String() string

func (*DateTime) UnmarshalJSON

func (dt *DateTime) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the given date per ARIs date format

type DurationSec

type DurationSec time.Duration

DurationSec is a JSON type for duration in seconds

func (DurationSec) MarshalJSON

func (ds DurationSec) MarshalJSON() ([]byte, error)

MarshalJSON converts the duration into a JSON friendly format

func (*DurationSec) UnmarshalJSON

func (ds *DurationSec) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the data into the duration seconds object

type EventType added in v1.0.2

type EventType string
const (
	All               EventType = "all"
	FullyBooted       EventType = "FullyBooted"
	Hangup            EventType = "Hangup"
	Newstate          EventType = "Newstate"
	DialEnd           EventType = "DialEnd"
	SoftHangupRequest EventType = "SoftHangupRequest"
	HangupRequest     EventType = "HangupRequest"
	MixMonitorStart   EventType = "MixMonitorStart"
	MixMonitorStop    EventType = "MixMonitorStop"
	NewConnectedLine  EventType = "NewConnectedLine"
	DialBegin         EventType = "DialBegin"
	NewCallerid       EventType = "NewCallerid"
	NewAccountCode    EventType = "NewAccountCode"
)

func (EventType) String added in v1.0.2

func (evt EventType) String() string

type RequestHandlerFunc added in v1.0.2

type RequestHandlerFunc func(*amitools.Request) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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