Documentation
¶
Index ¶
- Variables
- func CodeFromError(err error) int
- func Delete(conn *Conn, url string, ret interface{}, req string) error
- func Get(conn *Conn, url string, ret interface{}) error
- func New(opts Options) (*ari.Client, error)
- func Post(conn *Conn, requestURL string, ret interface{}, req interface{}) error
- func Put(conn *Conn, url string, ret interface{}, req interface{}) error
- type Conn
- type MissingParams
- type Options
- type RequestError
Constants ¶
This section is empty.
Variables ¶
var AsteriskCodec = websocket.Codec{
Marshal: marshal,
Unmarshal: unmarshal,
}
AsteriskCodec is a websocket Codec for Asterisk messages
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)
var MaxIdleConnections = 20
MaxIdleConnections is the maximum number of idle web client connections to maintain.
var RequestTimeout = 2 * time.Second
RequestTimeout describes the maximum amount of time to wait for a response to any request.
Functions ¶
func CodeFromError ¶
CodeFromError extracts and returns the code from an error, or 0 if not found.
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
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 ¶
RequestError describes an error with an error Code.