native

package
v6.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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 Connect

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

Connect creates and connects a new Client to Asterisk ARI.

func ConnectWithContext

func ConnectWithContext(ctx context.Context, chanMsgConnected chan bool, opts *Options) (ari.Client, error)

ConnectWithContext creates and connects a new Client to Asterisk ARI. Providing a Context allows the caller to cancel the request, which is useful should the caller be in a go routine that may be cancelled by it's parent.

Types

type Application

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

Application is a native implementation of ARI's Application functions

func (*Application) Data

func (a *Application) Data(key *ari.Key) (*ari.ApplicationData, error)

Data returns the details of a given ARI application Equivalent to GET /applications/{applicationName}

func (*Application) Get

func (a *Application) Get(key *ari.Key) *ari.ApplicationHandle

Get returns a managed handle to an ARI application

func (*Application) List

func (a *Application) List(filter *ari.Key) (ax []*ari.Key, err error)

List returns the list of applications managed by asterisk

func (*Application) Subscribe

func (a *Application) Subscribe(key *ari.Key, eventSource string) error

Subscribe subscribes the given application to an event source Equivalent to POST /applications/{applicationName}/subscription

func (*Application) Unsubscribe

func (a *Application) Unsubscribe(key *ari.Key, eventSource string) error

Unsubscribe unsubscribes (removes a subscription to) a given ARI application from the provided event source Equivalent to DELETE /applications/{applicationName}/subscription

type Asterisk

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

Asterisk provides the ARI Asterisk accessors for a native client

func (*Asterisk) Config

func (a *Asterisk) Config() ari.Config

Config provides the ARI Asterisk Config accessors for a native client

func (*Asterisk) Info

func (a *Asterisk) Info(key *ari.Key) (*ari.AsteriskInfo, error)

Info returns various data about the Asterisk system Equivalent to GET /asterisk/info

func (*Asterisk) Logging

func (a *Asterisk) Logging() ari.Logging

Logging provides the ARI Asterisk Logging accessors for a native client

func (*Asterisk) Modules

func (a *Asterisk) Modules() ari.Modules

Modules provides the ARI Asterisk Modules accessors for a native client

func (*Asterisk) Variables

func (a *Asterisk) Variables() ari.AsteriskVariables

Variables returns the variables interface for the Asterisk server

type AsteriskVariables

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

AsteriskVariables provides the ARI Variables accessors for server-level variables

func (*AsteriskVariables) Get

func (a *AsteriskVariables) Get(key *ari.Key) (string, error)

Get returns the value of the given global variable Equivalent to GET /asterisk/variable

func (*AsteriskVariables) Set

func (a *AsteriskVariables) Set(key *ari.Key, value string) (err error)

Set sets a global channel variable (Equivalent to POST /asterisk/variable)

type Bridge

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

Bridge provides the ARI Bridge accessors for the native client

func (*Bridge) AddChannel

func (b *Bridge) AddChannel(key *ari.Key, channelID string) (err error)

AddChannel adds a channel to a bridge Equivalent to Post /bridges/{id}/addChannel

func (*Bridge) AddChannelWithOptions

func (b *Bridge) AddChannelWithOptions(key *ari.Key, channelID string, options *ari.BridgeAddChannelOptions) error

AddChannelWithOptions adds a channel to a bridge, specifying additional options to be applied to that channel

func (*Bridge) Create

func (b *Bridge) Create(key *ari.Key, t string, name string) (bh *ari.BridgeHandle, err error)

Create creates a bridge and returns the lazy handle for the bridge

func (*Bridge) Data

func (b *Bridge) Data(key *ari.Key) (*ari.BridgeData, error)

Data returns the details of a bridge Equivalent to Get /bridges/{bridgeId}

func (*Bridge) Delete

func (b *Bridge) Delete(key *ari.Key) (err error)

Delete shuts down a bridge. If any channels are in this bridge, they will be removed and resume whatever they were doing beforehand. This means that the channels themselves are not deleted. Equivalent to DELETE /bridges/{id}

func (*Bridge) Get

func (b *Bridge) Get(key *ari.Key) *ari.BridgeHandle

Get gets the lazy handle for the given bridge id

func (*Bridge) List

func (b *Bridge) List(filter *ari.Key) (bx []*ari.Key, err error)

List lists the current bridges and returns a list of lazy handles

func (*Bridge) MOH

func (b *Bridge) MOH(key *ari.Key, class string) error

MOH requests that the given musiconhold class be played to the bridge

func (*Bridge) Play

func (b *Bridge) Play(key *ari.Key, playbackID string, mediaURI ...string) (*ari.PlaybackHandle, error)

Play attempts to play the given mediaURI on the bridge, using the playbackID as the identifier to the created playback handle

func (*Bridge) Record

func (b *Bridge) Record(key *ari.Key, name string, opts *ari.RecordingOptions) (*ari.LiveRecordingHandle, error)

Record attempts to record audio on the bridge, using name as the identifier for the created live recording handle

func (*Bridge) RemoveChannel

func (b *Bridge) RemoveChannel(key *ari.Key, channelID string) (err error)

RemoveChannel removes the specified channel from a bridge Equivalent to Post /bridges/{id}/removeChannel

func (*Bridge) StageCreate

func (b *Bridge) StageCreate(key *ari.Key, btype, name string) (*ari.BridgeHandle, error)

StageCreate creates a new bridge handle, staged with a bridge `Create` operation.

func (*Bridge) StagePlay

func (b *Bridge) StagePlay(key *ari.Key, playbackID string, mediaURI ...string) (*ari.PlaybackHandle, error)

StagePlay stages a `Play` operation on the bridge

func (*Bridge) StageRecord

func (b *Bridge) StageRecord(key *ari.Key, name string, opts *ari.RecordingOptions) (*ari.LiveRecordingHandle, error)

StageRecord stages a `Record` opreation

func (*Bridge) StopMOH

func (b *Bridge) StopMOH(key *ari.Key) error

StopMOH requests that any MusicOnHold which is playing to the bridge be stopped.

func (*Bridge) Subscribe

func (b *Bridge) Subscribe(key *ari.Key, n ...string) ari.Subscription

Subscribe creates an event subscription for events related to the given bridge␃entity

func (*Bridge) VideoSource

func (b *Bridge) VideoSource(key *ari.Key, channelID string) error

VideoSource sets a channel as the video source in a multi-party mixing bridge. This operation has no effect on bridges with two or fewer participants. Equivalent to POST /bridges/{bridgeId}/videoSource/{channelId}

func (*Bridge) VideoSourceDelete

func (b *Bridge) VideoSourceDelete(key *ari.Key) error

VideoSourceDelete removes any explicit video source in a multi-party mixing bridge. This operation has no effect on bridges with two or fewer participants. When no explicit video source is set, talk detection will be used to determine the active video stream. Equivalent to DELETE /bridges/{bridgeId}/videoSource

type Channel

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

Channel provides the ARI Channel accessors for the native client

func (*Channel) Answer

func (c *Channel) Answer(key *ari.Key) error

Answer answers a channel, if ringing (TODO: does this return an error if already answered?)

func (*Channel) Busy

func (c *Channel) Busy(key *ari.Key) error

Busy sends the busy status code to the channel (TODO: does this play a busy signal too)

func (*Channel) Congestion

func (c *Channel) Congestion(key *ari.Key) error

Congestion sends the congestion status code to the channel (TODO: does this play a tone?)

func (*Channel) Continue

func (c *Channel) Continue(key *ari.Key, context, extension string, priority int) (err error)

Continue tells a channel to process to the given ARI context and extension

func (*Channel) Create

func (c *Channel) Create(key *ari.Key, req ari.ChannelCreateRequest) (*ari.ChannelHandle, error)

Create creates a channel and returns the handle. TODO: expand differences between originate and create.

func (*Channel) Data

func (c *Channel) Data(key *ari.Key) (*ari.ChannelData, error)

Data retrieves the current state of the channel

func (*Channel) Dial

func (c *Channel) Dial(key *ari.Key, callingChannelID string, timeout time.Duration) error

Dial dials the given calling channel identifier

func (*Channel) ExternalMedia

func (c *Channel) ExternalMedia(key *ari.Key, opts ari.ExternalMediaOptions) (*ari.ChannelHandle, error)

ExternalMedia implements the ari.Channel interface

func (*Channel) Get

func (c *Channel) Get(key *ari.Key) *ari.ChannelHandle

Get gets the lazy handle for the given channel

func (*Channel) GetVariable

func (c *Channel) GetVariable(key *ari.Key, name string) (string, error)

GetVariable gets the value of the given variable

func (*Channel) Hangup

func (c *Channel) Hangup(key *ari.Key, reason string) error

Hangup hangs up the given channel using the (optional) reason.

func (*Channel) Hold

func (c *Channel) Hold(key *ari.Key) error

Hold puts a channel on hold (TODO: does this return an error if already on hold?)

func (*Channel) List

func (c *Channel) List(filter *ari.Key) (cx []*ari.Key, err error)

List lists the current channels and returns the list of channel handles

func (*Channel) MOH

func (c *Channel) MOH(key *ari.Key, class string) error

MOH plays the given music on hold class to the channel TODO: does this error when already playing MOH?

func (*Channel) Mute

func (c *Channel) Mute(key *ari.Key, dir ari.Direction) error

Mute mutes a channel in the given direction (TODO: does this return an error if already muted)

func (*Channel) Originate

func (c *Channel) Originate(referenceKey *ari.Key, req ari.OriginateRequest) (*ari.ChannelHandle, error)

Originate originates a channel and returns the handle.

**Note** that referenceKey is completely optional. It is used for placing the new channel onto the correct Asterisk node and for assigning default values for communications parameters such as codecs.

func (*Channel) Play

func (c *Channel) Play(key *ari.Key, playbackID string, mediaURI ...string) (*ari.PlaybackHandle, error)

Play plays the given media URI on the channel, using the playbackID as the identifier of the created ARI Playback entity

func (*Channel) Record

func (c *Channel) Record(key *ari.Key, name string, opts *ari.RecordingOptions) (*ari.LiveRecordingHandle, error)

Record records audio on the channel, using the name parameter as the name of the created LiveRecording entity.

func (*Channel) Ring

func (c *Channel) Ring(key *ari.Key) error

Ring causes a channel to start ringing (TODO: does this return an error if already ringing?)

func (*Channel) SendDTMF

func (c *Channel) SendDTMF(key *ari.Key, dtmf string, opts *ari.DTMFOptions) error

SendDTMF sends a string of digits and symbols to the channel

func (*Channel) SetVariable

func (c *Channel) SetVariable(key *ari.Key, name, value string) error

SetVariable sets the value of the given channel variable

func (*Channel) Silence

func (c *Channel) Silence(key *ari.Key) error

Silence silences a channel (TODO: does this error when already silences)

func (*Channel) Snoop

func (c *Channel) Snoop(key *ari.Key, snoopID string, opts *ari.SnoopOptions) (*ari.ChannelHandle, error)

Snoop snoops on a channel, using the the given snoopID as the new channel handle ID (TODO: confirm and expand description)

func (*Channel) StageExternalMedia

func (c *Channel) StageExternalMedia(key *ari.Key, opts ari.ExternalMediaOptions) (*ari.ChannelHandle, error)

StageExternalMedia implements the ari.Channel interface

func (*Channel) StageOriginate

func (c *Channel) StageOriginate(referenceKey *ari.Key, req ari.OriginateRequest) (*ari.ChannelHandle, error)

StageOriginate creates a new channel handle with a channel originate request staged.

**Note** that referenceKey is completely optional. It is used for placing the new channel onto the correct Asterisk node and for assigning default values for communications parameters such as codecs.

func (*Channel) StagePlay

func (c *Channel) StagePlay(key *ari.Key, playbackID string, mediaURI ...string) (*ari.PlaybackHandle, error)

StagePlay stages a `Play` operation on the bridge

func (*Channel) StageRecord

func (c *Channel) StageRecord(key *ari.Key, name string, opts *ari.RecordingOptions) (*ari.LiveRecordingHandle, error)

StageRecord stages a `Record` opreation

func (*Channel) StageSnoop

func (c *Channel) StageSnoop(key *ari.Key, snoopID string, opts *ari.SnoopOptions) (*ari.ChannelHandle, error)

StageSnoop creates a new `ChannelHandle` with a `Snoop` operation staged.

func (*Channel) StopHold

func (c *Channel) StopHold(key *ari.Key) (err error)

StopHold removes a channel from hold (TODO: does this return an error if not on hold)

func (*Channel) StopMOH

func (c *Channel) StopMOH(key *ari.Key) error

StopMOH stops any music on hold playing on the channel (TODO: does this error when no MOH is playing?)

func (*Channel) StopRing

func (c *Channel) StopRing(key *ari.Key) error

StopRing causes a channel to stop ringing (TODO: does this return an error if not ringing?)

func (*Channel) StopSilence

func (c *Channel) StopSilence(key *ari.Key) error

StopSilence stops the silence on a channel (TODO: does this error when not silenced)

func (*Channel) Subscribe

func (c *Channel) Subscribe(key *ari.Key, n ...string) ari.Subscription

Subscribe creates a new subscription for ARI events related to this channel

func (*Channel) Unmute

func (c *Channel) Unmute(key *ari.Key, dir ari.Direction) (err error)

Unmute unmutes a channel in the given direction (TODO: does this return an error if unmuted)

func (*Channel) UserEvent

func (c *Channel) UserEvent(key *ari.Key, ue *ari.ChannelUserevent) error

UserEvent - triggers a UserEvent for the given channel

type Client

type Client struct {

	// opts are the configuration options for the client
	Options *Options

	// WSConfig describes the configuration for the websocket connection to Asterisk, from which events will be received.
	WSConfig *websocket.Config
	// contains filtered or unexported fields
}

Client describes a native ARI client, which connects directly to an Asterisk HTTP-based ARI service.

func New

func New(opts *Options, chanMsgConnected chan bool) *Client

New creates a new ari.Client. This function should not be used directly unless you need finer control. nolint: gocyclo

func (*Client) Application

func (c *Client) Application() ari.Application

Application returns the ARI Application accessors for this client

func (*Client) ApplicationName

func (c *Client) ApplicationName() string

ApplicationName returns the client's ARI Application name

func (*Client) Asterisk

func (c *Client) Asterisk() ari.Asterisk

Asterisk returns the ARI Asterisk accessors for this client

func (*Client) Bridge

func (c *Client) Bridge() ari.Bridge

Bridge returns the ARI Bridge accessors for this client

func (*Client) Bus

func (c *Client) Bus() ari.Bus

Bus returns the Bus accessors for this client

func (*Client) Channel

func (c *Client) Channel() ari.Channel

Channel returns the ARI Channel accessors for this client

func (*Client) Close

func (c *Client) Close()

Close shuts down the ARI client

func (*Client) Connect

func (c *Client) Connect() error

Connect sets up and maintains and a websocket connection to Asterisk, passing any received events to the Bus

func (*Client) ConnectWithContext

func (c *Client) ConnectWithContext(ctx context.Context) error

ConnectWithContext sets up and maintains and a websocket connection to Asterisk, passing any received events to the Bus Providing a Context allows the caller to cancel the request, which is useful should the caller be in a go routine that may be cancelled by it's parent.

func (*Client) Connected

func (c *Client) Connected() bool

Connected indicates whether the websocket is connected

func (*Client) DeviceState

func (c *Client) DeviceState() ari.DeviceState

DeviceState returns the ARI DeviceState accessors for this client

func (*Client) Endpoint

func (c *Client) Endpoint() ari.Endpoint

Endpoint returns the ARI Endpoint accessors for this client

func (*Client) LiveRecording

func (c *Client) LiveRecording() ari.LiveRecording

LiveRecording returns the ARI LiveRecording accessors for this client

func (*Client) Mailbox

func (c *Client) Mailbox() ari.Mailbox

Mailbox returns the ARI Mailbox accessors for this client

func (*Client) Playback

func (c *Client) Playback() ari.Playback

Playback returns the ARI Playback accessors for this client

func (*Client) Sound

func (c *Client) Sound() ari.Sound

Sound returns the ARI Sound accessors for this client

func (*Client) StoredRecording

func (c *Client) StoredRecording() ari.StoredRecording

StoredRecording returns the ARI StoredRecording accessors for this client

func (*Client) TextMessage

func (c *Client) TextMessage() ari.TextMessage

TextMessage returns the ARI TextMessage accessors for this client

type Config

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

Config provides the ARI Configuration accessors for a native client

func (*Config) Data

func (c *Config) Data(key *ari.Key) (*ari.ConfigData, error)

Data retrieves the state of a configuration object

func (*Config) Delete

func (c *Config) Delete(key *ari.Key) error

Delete deletes the configuration object

func (*Config) Get

func (c *Config) Get(key *ari.Key) *ari.ConfigHandle

Get gets a lazy handle to a configuration object

func (*Config) Update

func (c *Config) Update(key *ari.Key, tuples []ari.ConfigTuple) (err error)

Update updates the given configuration object

type DeviceState

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

DeviceState provides the ARI DeviceState accessors for the native client

func (*DeviceState) Data

func (ds *DeviceState) Data(key *ari.Key) (*ari.DeviceStateData, error)

Data retrieves the current state of the device

func (*DeviceState) Delete

func (ds *DeviceState) Delete(key *ari.Key) error

Delete deletes the device

func (*DeviceState) Get

func (ds *DeviceState) Get(key *ari.Key) *ari.DeviceStateHandle

Get returns the lazy handle for the given device name

func (*DeviceState) List

func (ds *DeviceState) List(filter *ari.Key) (dx []*ari.Key, err error)

List lists the current devices and returns a list of handles

func (*DeviceState) Update

func (ds *DeviceState) Update(key *ari.Key, state string) error

Update updates the state of the device

type Endpoint

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

Endpoint provides the ARI Endpoint accessors for the native client

func (*Endpoint) Data

func (e *Endpoint) Data(key *ari.Key) (*ari.EndpointData, error)

Data retrieves the current state of the endpoint

func (*Endpoint) Get

func (e *Endpoint) Get(key *ari.Key) *ari.EndpointHandle

Get gets a lazy handle for the endpoint entity

func (*Endpoint) List

func (e *Endpoint) List(filter *ari.Key) (ex []*ari.Key, err error)

List lists the current endpoints and returns a list of handles

func (*Endpoint) ListByTech

func (e *Endpoint) ListByTech(tech string, filter *ari.Key) (ex []*ari.Key, err error)

ListByTech lists the current endpoints with the given technology and returns a list of handles.

type LiveRecording

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

LiveRecording provides the ARI LiveRecording accessors for the native client

func (*LiveRecording) Data

func (lr *LiveRecording) Data(key *ari.Key) (d *ari.LiveRecordingData, err error)

Data retrieves the state of the live recording

func (*LiveRecording) Get

func (lr *LiveRecording) Get(key *ari.Key) (h *ari.LiveRecordingHandle)

Get gets a lazy handle for the live recording name

func (*LiveRecording) Mute

func (lr *LiveRecording) Mute(key *ari.Key) error

Mute mutes the live recording (TODO: does it error if the live recording is already muted)

func (*LiveRecording) Pause

func (lr *LiveRecording) Pause(key *ari.Key) error

Pause pauses the live recording (TODO: does it error if the live recording is already paused)

func (*LiveRecording) Resume

func (lr *LiveRecording) Resume(key *ari.Key) error

Resume resumes the live recording (TODO: does it error if the live recording is already resumed)

func (*LiveRecording) Scrap

func (lr *LiveRecording) Scrap(key *ari.Key) error

Scrap removes a live recording (TODO: describe difference between scrap and delete)

func (*LiveRecording) Stop

func (lr *LiveRecording) Stop(key *ari.Key) error

Stop stops the live recording.

NOTE: if the recording is already stopped, this will return an error.

func (*LiveRecording) Stored

func (lr *LiveRecording) Stored(key *ari.Key) *ari.StoredRecordingHandle

Stored returns the StoredRecording handle for the given LiveRecording

func (*LiveRecording) Subscribe

func (lr *LiveRecording) Subscribe(key *ari.Key, n ...string) ari.Subscription

Subscribe is a shim to enable recording handles to subscribe to their underlying bridge/channel for events. It should not be called directly.

func (*LiveRecording) Unmute

func (lr *LiveRecording) Unmute(key *ari.Key) error

Unmute unmutes the live recording (TODO: does it error if the live recording is already muted)

type Logging

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

Logging provides the ARI Logging accessors for a native client

func (*Logging) Create

func (l *Logging) Create(key *ari.Key, levels string) (*ari.LogHandle, error)

Create creates a logging level

func (*Logging) Data

func (l *Logging) Data(key *ari.Key) (*ari.LogData, error)

Data returns the data of a logging channel

func (*Logging) Delete

func (l *Logging) Delete(key *ari.Key) error

Delete deletes the named log

func (*Logging) Get

func (l *Logging) Get(key *ari.Key) *ari.LogHandle

Get returns a logging channel handle

func (*Logging) List

func (l *Logging) List(filter *ari.Key) ([]*ari.Key, error)

List lists the logging entities

func (*Logging) Rotate

func (l *Logging) Rotate(key *ari.Key) error

Rotate rotates the given log

type Mailbox

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

Mailbox provides the ARI Mailbox accessors for the native client

func (*Mailbox) Data

func (m *Mailbox) Data(key *ari.Key) (*ari.MailboxData, error)

Data retrieves the state of the given mailbox

func (*Mailbox) Delete

func (m *Mailbox) Delete(key *ari.Key) error

Delete deletes the mailbox

func (*Mailbox) Get

func (m *Mailbox) Get(key *ari.Key) *ari.MailboxHandle

Get gets a lazy handle for the mailbox name

func (*Mailbox) List

func (m *Mailbox) List(filter *ari.Key) (mx []*ari.Key, err error)

List lists the mailboxes and returns a list of handles

func (*Mailbox) Update

func (m *Mailbox) Update(key *ari.Key, oldMessages int, newMessages int) error

Update updates the new and old message counts of the mailbox

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 Modules

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

Modules provides the ARI modules accessors for a native client

func (*Modules) Data

func (m *Modules) Data(key *ari.Key) (*ari.ModuleData, error)

Data retrieves the state of the named asterisk module

func (*Modules) Get

func (m *Modules) Get(key *ari.Key) *ari.ModuleHandle

Get obtains a lazy handle to an asterisk module

func (*Modules) List

func (m *Modules) List(filter *ari.Key) (ret []*ari.Key, err error)

List lists the modules and returns lists of handles

func (*Modules) Load

func (m *Modules) Load(key *ari.Key) error

Load loads the named asterisk module

func (*Modules) Reload

func (m *Modules) Reload(key *ari.Key) error

Reload reloads the named asterisk module

func (*Modules) Unload

func (m *Modules) Unload(key *ari.Key) error

Unload unloads the named asterisk module

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

	// WebsocketOrigin is the origin to report for the websocket connection.
	// Defaults to http://localhost/
	WebsocketOrigin string

	// Username for ARI authentication
	Username string

	// Password for ARI authentication
	Password string

	// Allow subscribe to all events in Asterisk Server
	SubscribeAll bool
}

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

type Playback

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

Playback provides the ARI Playback accessors for the native client

func (*Playback) Control

func (a *Playback) Control(key *ari.Key, op string) error

Control performs the given operation on the current playback. Available operations are:

  • restart
  • pause
  • unpause
  • reverse
  • forward

func (*Playback) Data

func (a *Playback) Data(key *ari.Key) (*ari.PlaybackData, error)

Data returns a playback's details. (Equivalent to GET /playbacks/{playbackID})

func (*Playback) Get

func (a *Playback) Get(key *ari.Key) *ari.PlaybackHandle

Get gets a lazy handle for the given playback identifier

func (*Playback) Stop

func (a *Playback) Stop(key *ari.Key) error

Stop stops a playback session. (Equivalent to DELETE /playbacks/{playbackID})

func (*Playback) Subscribe

func (a *Playback) Subscribe(key *ari.Key, n ...string) ari.Subscription

Subscribe listens for ARI events for the given playback entity

type RequestError

type RequestError interface {
	error
	Code() int
}

RequestError describes an error with an error Code.

type Sound

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

Sound provides the ARI Sound accessors for the native client

func (*Sound) Data

func (s *Sound) Data(key *ari.Key) (*ari.SoundData, error)

Data returns the details of a given ARI Sound Equivalent to GET /sounds/{name}

func (*Sound) List

func (s *Sound) List(filters map[string]string, keyFilter *ari.Key) (sh []*ari.Key, err error)

List returns available sounds limited by the provided filters. valid filters are "lang", "format", and nil (no filter) An empty filter returns all available sounds

type StoredRecording

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

StoredRecording provides the ARI StoredRecording accessors for the native client

func (*StoredRecording) Copy

func (sr *StoredRecording) Copy(key *ari.Key, dest string) (*ari.StoredRecordingHandle, error)

Copy copies a stored recording and returns the new handle

func (*StoredRecording) Data

func (sr *StoredRecording) Data(key *ari.Key) (*ari.StoredRecordingData, error)

Data retrieves the state of the stored recording

func (*StoredRecording) Delete

func (sr *StoredRecording) Delete(key *ari.Key) error

Delete deletes the stored recording

func (*StoredRecording) Get

func (sr *StoredRecording) Get(key *ari.Key) *ari.StoredRecordingHandle

Get gets a lazy handle for the given stored recording name

func (*StoredRecording) List

func (sr *StoredRecording) List(filter *ari.Key) (sx []*ari.Key, err error)

List lists the current stored recordings and returns a list of handles

func (*StoredRecording) StageCopy

func (sr *StoredRecording) StageCopy(key *ari.Key, dest string) (*ari.StoredRecordingHandle, error)

StageCopy creates a `StoredRecordingHandle` with a `Copy` operation staged.

type TextMessage

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

TextMessage provides the ARI TextMessage accessors for the native client

func (*TextMessage) Send

func (t *TextMessage) Send(from, tech, resource, body string, vars map[string]string) error

Send sends a text message to an endpoint

func (*TextMessage) SendByURI

func (t *TextMessage) SendByURI(from, to, body string, vars map[string]string) error

SendByURI sends a text message to an endpoint by free-form URI (rather than tech/resource)

Jump to

Keyboard shortcuts

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