native

package
v3.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2016 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AsteriskCodec = websocket.Codec{
	Marshal:   marshal,
	Unmarshal: unmarshal,
}

AsteriskCodec is a websocket Codec for Asterisk messages

View Source
var Logger = log15.New()

Logger defaults to a discard handler (null output). If you wish to enable logging, you can set your own handler like so:

ari.Logger.SetHandler(log15.StderrHandler)
View Source
var MaxIdleConnections = 20

MaxIdleConnections is the maximum number of idle web client connections to maintain.

View Source
var RequestTimeout = 2 * time.Second

RequestTimeout describes the maximum amount of time to wait for a response to any request.

Functions

func CodeFromError

func CodeFromError(err error) int

CodeFromError extracts and returns the code from an error, or 0 if not found.

func Delete

func Delete(conn *Conn, url string, ret interface{}, req string) error

Delete calls the ARI server with a DELETE request

func Get

func Get(conn *Conn, url string, ret interface{}) error

Get calls the ARI server with a GET request

func New

func New(opts Options) (*ari.Client, error)

New creates a new ari.Client connected to a native ARI server

func Post

func Post(conn *Conn, requestURL string, ret interface{}, req interface{}) error

Post calls the ARI server with a POST request.

func Put

func Put(conn *Conn, url string, ret interface{}, req interface{}) error

Put calls the ARI server with a PUT request.

Types

type Conn

type Conn struct {
	Options Options // client options

	WSConfig *websocket.Config // websocket connection configuration

	ReadyChan chan struct{}

	Bus ari.Bus // event bus
	// contains filtered or unexported fields
}

Conn is a connection to a native ARI server

func (*Conn) Close

func (c *Conn) Close() error

Close closes the ARI client

func (*Conn) Listen

func (c *Conn) Listen() (err error)

Listen maintains and listens to a websocket connection until told to stop.

type MissingParams

type MissingParams struct {
	//Message
	Type   string   `json:"type"`
	Params []string `json:"params"` // List of missing parameters which are required
}

MissingParams is an error message response emitted when a request does not contain required parameters

type Options

type Options struct {
	// Application is the the name of this ARI application
	Application string

	// URL is the root URL of the ARI server (asterisk box).
	// Default to http://localhost:8088/ari
	URL string

	// WebsocketURL is the URL for ARI Websocket events.
	// Defaults to the events directory of URL, with a protocol of ws.
	// Usually ws://localhost:8088/ari/events.
	WebsocketURL string

	// Username for ARI authentication
	Username string

	// Password for ARI authentication
	Password string

	// Optional context to act as parent
	Context context.Context
}

Options describes the options for connecting to a native Asterisk ARI server.

type RequestError

type RequestError interface {
	error
	Code() int
}

RequestError describes an error with an error Code.

Jump to

Keyboard shortcuts

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