ami

package
v0.0.0-...-2552c51 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RequestTimeoutDefault = time.Second * 20
)

Functions

This section is empty.

Types

type ActionData

type ActionData map[string]string

func (ActionData) ActionID

func (s ActionData) ActionID() string

type Client

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

Client object

func New

func New(host, login, password string, ctxGlobal context.Context, stateChanged func(State, error)) (cl *Client)

func (Client) Close

func (s Client) Close()

Close finish work with client

func (Client) Event

func (s Client) Event() chan Event

func (*Client) Originate

func (s *Client) Originate(req *OriginateRequest) (*Originate, error)

func (Client) Request

func (s Client) Request(req Request, timeout time.Duration) (resp Response, accepted bool)

func (Client) Start

func (s Client) Start()

start open connection to asterisk ami server

func (Client) State

func (s Client) State() State

type Event

type Event struct {
	ActionData
	// contains filtered or unexported fields
}

func (Event) Name

func (s Event) Name() string

func (Event) UUID

func (s Event) UUID() int64

type EventListener

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

type Originate

type Originate struct {
	*OriginateRequest
	// contains filtered or unexported fields
}

func (*Originate) Events

func (s *Originate) Events() (res <-chan Event)

func (*Originate) IsFinished

func (s *Originate) IsFinished() bool

type OriginateRequest

type OriginateRequest struct {
	Channel     string
	Context     string
	Exten       string
	Priority    string
	Timeout     time.Duration
	CallerID    string
	Variable    json.Map
	Account     string
	Application string
	Data        string
	// contains filtered or unexported fields
}

func (*OriginateRequest) Request

func (s *OriginateRequest) Request() (res Request)

type Request

type Request struct {
	ActionData
	Variables json.Map
	// contains filtered or unexported fields
}

func InitRequest

func InitRequest(action string) Request

func (*Request) SetParam

func (s *Request) SetParam(key, value string)

func (*Request) SetVariable

func (s *Request) SetVariable(key, value string)

func (*Request) SetVariables

func (s *Request) SetVariables(m json.Map)

type Response

type Response struct {
	ActionData
}

func (Response) ErrorMessage

func (s Response) ErrorMessage() string

func (Response) IsError

func (s Response) IsError() bool

type State

type State byte
const (
	StateStopped State = iota
	StateConnection
	StateConnected
	StateAuth
	StateAvailable
	StateBusy
)

func (State) String

func (s State) String() string

Jump to

Keyboard shortcuts

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