server

package
Version: v2.5.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package server provides a proxy for ARI calls. It is usable via the client/nc Client and can use any given ari.Client

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(subj string, request []byte, reply Reply)

Handler is left for compat

type Handler2

type Handler2 func(msg *session.Message, reply Reply)

A Handler2 is a function which provides a session-aware request-response for nats

type Options

type Options struct {
	URL string

	Logger log15.Logger
	Parent context.Context
}

Options are the group of options for the ari-proxy server

type Reply

type Reply func(interface{}, error)

Reply is a function which, when called, replies to the request via the response object or error.

type Server

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

	// AsteriskID is the unique identifier for the Asterisk box
	// to which this server is connected.
	AsteriskID string

	// NATSPrefix is the string which should be prepended to all NATS subjects, sending and receiving.  It defaults to "ari.".
	NATSPrefix string

	// Dialog is the dialog manager
	Dialog dialog.Manager

	// Log is the log15.Logger for the service.  You may replace or call SetHandler() on this at any time to change the logging of the service.
	Log log15.Logger
	// contains filtered or unexported fields
}

Server describes the asterisk-facing ARI proxy server

func New

func New() *Server

New returns a new Server

func (*Server) Listen

func (s *Server) Listen(ctx context.Context, ariOpts *native.Options, natsURI string) (err error)

Listen runs the given server, listening to ARI and NATS, as specified

func (*Server) ListenOn

func (s *Server) ListenOn(ctx context.Context, a ari.Client, n *nats.EncodedConn) error

ListenOn runs the given server, listening on the provided ARI and NATS connections

func (*Server) Ready

func (s *Server) Ready() <-chan struct{}

Ready returns a channel which is closed when the Server is ready

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL