ari

package module
v4.0.6+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2017 License: Apache-2.0 Imports: 15 Imported by: 0

README

ari - Golang Asterisk Rest Interface (ARI) library

Build Status

This is a go-based ARI library. It also includes some common convenience wrappers for various tasks, which can be found in /ext.

This library maintains semver, and APIs between major releases do change. Therefore, always use a vendoring tool which supports semver, such as glide or dep or use the gopkg.in aliasing, such as gopkg.in/CyCoreSystems/ari.v3.

The v3 branch is the most well-tested branch, while v4 fixes a number of shortcomings of v3, particularly for interoperating with proxies clients.

There is also a NATS-based ari-proxy which is designed to work with this client library. It can be found at CyCoreSystems/ari-proxy.

Cloud-ready

All configuration options for the client are able to be sourced by environment variable, making it easy to build applications without configuration files. Moreover, the default connection to Asterisk is set to localhost on port 8088, which should run on Kubernetes deployments without configuration.

The available environment variables (and defaults) are:

  • ARI_APPLICATION (randomly-generated UUID)
  • ARI_URL (http://localhost:8088/ari)
  • ARI_WSURL (ws://localhost:8088/ari/events)
  • ARI_WSORIGIN (http://localhost/)
  • ARI_USERNAME (none)
  • ARI_PASSWORD (none)

When using the ari-proxy, the process is even easier.

Resource Keys

In order to facilitate the construction of ARI systems across many Asterisk instances, in version 4, we introduce the concept of Resource Keys. Previous versions expected a simple ID (string) field for the identification of a resource to ARI. This reflects how ARI itself operates. However, for systems with multiple Asterisk instances, more metadata is necessary in order to properly address a resource. Specifically, we need to know the Asterisk node. There is also the concept of a Dialog, which offers an orthogonal logical grouping of events which transcends nodes and applications. This is not meaningful in the native client, but other transports, such as the ARI proxy, may make use of this for alternative routing of events.

This Key includes all of these data.

package ari

// Key identifies a unique resource in the system
type Key struct {
   // Kind indicates the type of resource the Key points to.  e.g., "channel",
   // "bridge", etc.
   Kind string   `json:"kind"`

   // ID indicates the unique identifier of the resource
   ID string `json:"id"`

   // Node indicates the unique identifier of the Asterisk node on which the
   // resource exists or will be created
   Node string `json:"node,omitempty"`

   // Dialog indicates a named scope of the resource, for receiving events
   Dialog string `json:"dialog,omitempty"`
}

At a basic level, when the specific Asterisk ID is not needed, a key can consist of a simple ID string:

  key := ari.NewKey(ari.ChannelKey, "myID")

For more interesting systems, however, we can declare the Node ID:

  key := ari.NewKey(ari.BridgeKey, "myID", ari.WithNode("00:01:02:30:40:50"))

We can also bind a dialog:

  key := ari.NewKey(ari.ChannelKey, "myID",
   ari.WithNode("00:01:02:30:40:50"),
   ari.WithDialog("privateConversation"))

We can also create a new key from an existing key. This allows us to easily copy the location information from the original key to a new key of a different resource. The location information is everything (including the Dialog) except for the key Kind and ID.

  brKey := key.New(ari.BridgeKey, "myBridgeID")

All ARI operations which accepted an ID for an operator now expect an *ari.Key instead. In many cases, this can be easily back-ported by wrapping IDs with ari.NewKey("channel", id).

Staging resources

A common issue for ARI resources is making sure a subscription exists before events for that resource are sent. Otherwise, important events which occur too quickly can become lost. This results in a chicken-and-egg problem for subscriptions.

In order to address this common issue, resource handles creation operations now offer a StageXXXX variant, which returns the handle for the resource without actually creating the resource. Once all of the subscriptions are bound to this handle, the caller may call resource.Exec() in order to create the resource in Asterisk.

   h := NewChannelHandle(key, c, nil)

   // Stage a playback
   pb, err := h.StagePlay("myPlaybackID", "sound:tt-monkeys")
   if err != nil {
      return err
   }
   
   // Add a subscription to the staged playback
   startSub := pb.Subscribe(EventTypes.PlaybackStarted)
   defer startSub.Cancel()

   // Execute the staged playback
   pb.Exec()

   // Wait for something to happen
   select {
      case <-time.After(time.Second):
        fmt.Println("timeout waiting for playback to start")
        return errors.New("timeout")
      case <-startSub.Events():
        fmt.Println("playback started")
   }

Play

Playback of media and waiting for (DTMF) responses therefrom is an incredibly common task in telephony. ARI provides many tools to perform these types of actions, but the asynchronous nature of the interface makes it fairly tedious to build these kinds of things.

In ext/play, there resides a tool for executing many common tasks surrounding media playback and response sequences. The core function, play.Play() plays, in sequence, a series of audio media URIs. It can be extended to expect and (optionally) wait for a DTMF response by supplying it with a Match function. There is a small convenience wrapper play.Prompt() which sets some common defaults for playbacks which expect a response.

The execution of a Play is configured by any number of option functions, which supply structured modifiers for the behaviour of the playback. You can even supply your own Match function for highly-customized matching.

Documentation

Overview

Package ari is a generated protocol buffer package.

It is generated from these files:

ari.proto

It has these top-level messages:

Key
CallerID
ChannelData
DialplanCEP

Index

Constants

View Source
const (
	// ApplicationKey is the key kind for ARI Application resources.
	ApplicationKey = "application"

	// BridgeKey is the key kind for the ARI Bridge resources.
	BridgeKey = "bridge"

	// ChannelKey is the key kind for the ARI Channel resource
	ChannelKey = "channel"

	// DeviceStateKey is the key kind for the ARI DeviceState resource
	DeviceStateKey = "devicestate"

	// EndpointKey is the key kind for the ARI Endpoint resource
	EndpointKey = "endpoint"

	// LiveRecordingKey is the key kind for the ARI LiveRecording resource
	LiveRecordingKey = "liverecording"

	// LoggingKey is the key kind for the ARI Logging resource
	LoggingKey = "logging"

	// MailboxKey is the key kind for the ARI Mailbox resource
	MailboxKey = "mailbox"

	// ModuleKey is the key kind for the ARI Module resource
	ModuleKey = "module"

	// PlaybackKey is the key kind for the ARI Playback resource
	PlaybackKey = "playback"

	// SoundKey is the key kind for the ARI Sound resource
	SoundKey = "sound"

	// StoredRecordingKey is the key kind for the ARI StoredRecording resource
	StoredRecordingKey = "storedrecording"

	// VariableKey is the key kind for the ARI Asterisk Variable resource
	VariableKey = "variable"
)
View Source
const DateFormat = "2006-01-02T15:04:05.000-0700"

DateFormat is the date format that ARI returns in the JSON bodies

View Source
const EndpointIDSeparator = "|" //TODO: confirm separator isn't terrible

EndpointIDSeparator seperates the ID components of the endpoint ID

Variables

View Source
var (
	ErrInvalidLengthAri = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowAri   = fmt.Errorf("proto: integer overflow")
)
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)

Functions

func ConfigID

func ConfigID(class, kind, id string) string

ConfigID returns the configuration Key ID for the given configuration class, type/kind, and id.

func EndpointID

func EndpointID(tech, resource string) string

EndpointID returns the endpoint Key ID for the given tech and resource

func FromEndpointID

func FromEndpointID(id string) (tech string, resource string, err error)

FromEndpointID converts the endpoint ID to the tech, resource pair.

func Once

func Once(ctx context.Context, bus Bus, key *Key, eTypes ...string) <-chan Event

Once listens for the first event of the provided types, returning a channel which supplies that event.

func ParseConfigID

func ParseConfigID(input string) (class, kind, id string, err error)

ParseConfigID parses the provided Config ID into its Class, Type, and ID components

Types

type Application

type Application interface {

	// List returns the list of applications in Asterisk, optionally using the key for filtering
	List(*Key) ([]*Key, error)

	// Get returns a handle to the application for further interaction
	Get(key *Key) *ApplicationHandle

	// Data returns the applications data
	Data(key *Key) (*ApplicationData, error)

	// Subscribe subscribes the given application to an event source
	// event source may be one of:
	//  - channel:<channelId>
	//  - bridge:<bridgeId>
	//  - endpoint:<tech>/<resource> (e.g. SIP/102)
	//  - deviceState:<deviceName>
	Subscribe(key *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
	Unsubscribe(key *Key, eventSource string) error
}

Application represents a communication path interacting with an Asterisk server for application-level resources

type ApplicationData

type ApplicationData struct {
	// Key is the unique identifier for this application instance in the cluster
	Key *Key `json:"key"`

	BridgeIDs   []string `json:"bridge_ids"`   // Subscribed BridgeIds
	ChannelIDs  []string `json:"channel_ids"`  // Subscribed ChannelIds
	DeviceNames []string `json:"device_names"` // Subscribed Device names
	EndpointIDs []string `json:"endpoint_ids"` // Subscribed Endpoints (tech/resource format)
	Name        string   `json:"name"`         // Name of the application
}

ApplicationData describes the data for a Stasis (Ari) application

type ApplicationHandle

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

ApplicationHandle provides a wrapper to an Application interface for operations on a specific application

func NewApplicationHandle

func NewApplicationHandle(key *Key, app Application) *ApplicationHandle

NewApplicationHandle creates a new handle to the application name

func (*ApplicationHandle) Data

func (ah *ApplicationHandle) Data() (ad *ApplicationData, err error)

Data retrives the data for the application

func (*ApplicationHandle) ID

func (ah *ApplicationHandle) ID() string

ID returns the identifier for the application

func (*ApplicationHandle) Key

func (ah *ApplicationHandle) Key() *Key

Key returns the key of the application

func (*ApplicationHandle) Match

func (ah *ApplicationHandle) Match(e Event) bool

Match returns true fo the event matches the application

func (*ApplicationHandle) Subscribe

func (ah *ApplicationHandle) Subscribe(eventSource string) (err error)

Subscribe subscribes the application to an event source event source may be one of:

  • channel:<channelId>
  • bridge:<bridgeId>
  • endpoint:<tech>/<resource> (e.g. SIP/102)
  • deviceState:<deviceName>

func (*ApplicationHandle) Unsubscribe

func (ah *ApplicationHandle) Unsubscribe(eventSource string) (err error)

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

type ApplicationReplaced

type ApplicationReplaced struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`
}

ApplicationReplaced - "Notification that another WebSocket has taken over for an application.An application may only be subscribed to by a single WebSocket at a time. If multiple WebSockets attempt to subscribe to the same application, the newer WebSocket wins, and the older one receives this event."

func (*ApplicationReplaced) Keys

func (evt *ApplicationReplaced) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type Asterisk

type Asterisk interface {

	// Info gets data about the asterisk system
	Info(key *Key) (*AsteriskInfo, error)

	// Variables returns the global asterisk variables
	Variables() AsteriskVariables

	// Logging returns the interface for working with asterisk logs
	Logging() Logging

	// Modules returns the interface for working with asterisk modules
	Modules() Modules

	// Config returns the interface for working with dynamic configuration
	Config() Config
}

Asterisk represents a communication path for the Asterisk server for system-level resources

type AsteriskInfo

type AsteriskInfo struct {
	BuildInfo  BuildInfo  `json:"build"`
	ConfigInfo ConfigInfo `json:"config"`
	StatusInfo StatusInfo `json:"status"`
	SystemInfo SystemInfo `json:"system"`
}

AsteriskInfo describes a running asterisk system

type AsteriskVariables

type AsteriskVariables interface {

	// Get returns the value of the given variable; the ID field of the Key is the variable name
	Get(key *Key) (string, error)

	// Set sets the variable; the ID field of the Key is the variable name
	Set(key *Key, value string) error
}

AsteriskVariables is an interface to interact with Asterisk global variables

type Bridge

type Bridge interface {

	// Create creates a bridge
	Create(key *Key, btype string, name string) (*BridgeHandle, error)

	// StageCreate creates a new bridge handle, staged with a bridge `Create` operation.
	StageCreate(key *Key, btype string, name string) (*BridgeHandle, error)

	// Get gets the BridgeHandle
	Get(key *Key) *BridgeHandle

	// Lists returns the lists of bridges in asterisk, optionally using the key for filtering.
	List(*Key) ([]*Key, error)

	// Data gets the bridge data
	Data(key *Key) (*BridgeData, error)

	// AddChannel adds a channel to the bridge
	AddChannel(key *Key, channelID string) error

	// RemoveChannel removes a channel from the bridge
	RemoveChannel(key *Key, channelID string) error

	// Delete deletes the bridge
	Delete(key *Key) error

	// Play plays the media URI to the bridge
	Play(key *Key, playbackID string, mediaURI string) (*PlaybackHandle, error)

	// StagePlay stages a `Play` operation and returns the `PlaybackHandle`
	// for invoking it.
	StagePlay(key *Key, playbackID string, mediaURI string) (*PlaybackHandle, error)

	// Record records the bridge
	Record(key *Key, name string, opts *RecordingOptions) (*LiveRecordingHandle, error)

	// StageRecord stages a `Record` operation and returns the `PlaybackHandle`
	// for invoking it.
	StageRecord(key *Key, name string, opts *RecordingOptions) (*LiveRecordingHandle, error)

	// Subscribe subscribes the given bridge events events
	Subscribe(key *Key, n ...string) Subscription
}

Bridge represents a communication path to an Asterisk server for working with bridge resources

type BridgeAttendedTransfer

type BridgeAttendedTransfer struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	DestinationApplication     string      `json:"destination_application"`      // Application that has been transferred into
	DestinationBridge          string      `json:"destination_bridge"`           // Bridge that survived the merge result
	DestinationLinkFirstLeg    ChannelData `json:"destination_link_first_leg"`   // First leg of a link transfer result
	DestinationLinkSecondLeg   ChannelData `json:"destination_link_second_leg"`  // Second leg of a link transfer result
	DestinationThreewayBridge  BridgeData  `json:"destination_threeway_bridge"`  // Bridge that survived the threeway result
	DestinationThreewayChannel ChannelData `json:"destination_threeway_channel"` // Transferer channel that survived the threeway result
	DestinationType            string      `json:"destination_type"`             // How the transfer was accomplished
	IsExternal                 bool        `json:"is_external"`                  // Whether the transfer was externally initiated or not
	ReplaceChannel             ChannelData `json:"replace_channel,omitempty"`    // The channel that is replacing transferer_first_leg in the swap
	Result                     string      `json:"result"`                       // The result of the transfer attempt
	TransferTarget             ChannelData `json:"transfer_target,omitempty"`    // The channel that is being transferred to
	Transferee                 ChannelData `json:"transferee,omitempty"`         // The channel that is being transferred
	TransfererFirstLeg         ChannelData `json:"transferer_first_leg"`         // First leg of the transferer
	TransfererFirstLegBridge   BridgeData  `json:"transferer_first_leg_bridge"`  // Bridge the transferer first leg is in
	TransfererSecondLeg        ChannelData `json:"transferer_second_leg"`        // Second leg of the transferer
	TransfererSecondLegBridge  BridgeData  `json:"transferer_second_leg_bridge"` // Bridge the transferer second leg is in
}

BridgeAttendedTransfer - "Notification that an attended transfer has occurred."

func (*BridgeAttendedTransfer) Keys

func (evt *BridgeAttendedTransfer) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type BridgeBlindTransfer

type BridgeBlindTransfer struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Bridge         BridgeData  `json:"bridge"`                    // The bridge being transferred
	Channel        ChannelData `json:"channel"`                   // The channel performing the blind transfer
	Context        string      `json:"context"`                   // The context transferred to
	Exten          string      `json:"exten"`                     // The extension transferred to
	IsExternal     bool        `json:"is_external"`               // Whether the transfer was externally initiated or not
	ReplaceChannel ChannelData `json:"replace_channel,omitempty"` // The channel that is replacing transferer when the transferee(s) can not be transferred directly
	Result         string      `json:"result"`                    // The result of the transfer attempt
	Transferee     ChannelData `json:"transferee,omitempty"`      // The channel that is being transferred
}

BridgeBlindTransfer - "Notification that a blind transfer has occurred."

func (*BridgeBlindTransfer) Keys

func (evt *BridgeBlindTransfer) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type BridgeCreated

type BridgeCreated struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Bridge BridgeData `json:"bridge"`
}

BridgeCreated - "Notification that a bridge has been created."

func (*BridgeCreated) Created

func (evt *BridgeCreated) Created() (bridgeID string, related string)

Created marks the BridgeCreated event that it created an event

func (*BridgeCreated) GetBridgeIDs

func (evt *BridgeCreated) GetBridgeIDs() (sx []string)

GetBridgeIDs gets the bridge IDs for the event

func (*BridgeCreated) GetChannelIDs

func (evt *BridgeCreated) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*BridgeCreated) Keys

func (evt *BridgeCreated) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type BridgeData

type BridgeData struct {
	// Key is the cluster-unique identifier for this bridge
	Key *Key `json:"key"`

	ID         string   `json:"id"`           // Unique Id for this bridge
	Class      string   `json:"bridge_class"` // Class of the bridge
	Type       string   `json:"bridge_type"`  // Type of bridge (mixing, holding, dtmf_events, proxy_media)
	ChannelIDs []string `json:"channels"`     // List of pariticipating channel ids
	Creator    string   `json:"creator"`      // Creating entity of the bridge
	Name       string   `json:"name"`         // The name of the bridge
	Technology string   `json:"technology"`   // Name of the bridging technology
}

BridgeData describes an Asterisk Bridge, the entity which merges media from one or more channels into a common audio output

func (*BridgeData) Channels

func (b *BridgeData) Channels() (list []*Key)

Channels returns the list of channels found in the bridge

type BridgeDestroyed

type BridgeDestroyed struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Bridge BridgeData `json:"bridge"`
}

BridgeDestroyed - "Notification that a bridge has been destroyed."

func (*BridgeDestroyed) Destroyed

func (evt *BridgeDestroyed) Destroyed() string

Destroyed returns the bridge that was finished by this event. Used by the proxy to route events to dialogs.

func (*BridgeDestroyed) GetBridgeIDs

func (evt *BridgeDestroyed) GetBridgeIDs() (sx []string)

GetBridgeIDs gets the bridge IDs for the event

func (*BridgeDestroyed) Keys

func (evt *BridgeDestroyed) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type BridgeHandle

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

BridgeHandle is the handle to a bridge for performing operations

func NewBridgeHandle

func NewBridgeHandle(key *Key, b Bridge, exec func(bh *BridgeHandle) error) *BridgeHandle

NewBridgeHandle creates a new bridge handle

func (*BridgeHandle) AddChannel

func (bh *BridgeHandle) AddChannel(channelID string) error

AddChannel adds a channel to the bridge

func (*BridgeHandle) Data

func (bh *BridgeHandle) Data() (*BridgeData, error)

Data gets the bridge data

func (*BridgeHandle) Delete

func (bh *BridgeHandle) Delete() (err error)

Delete deletes the bridge

func (*BridgeHandle) Exec

func (bh *BridgeHandle) Exec() error

Exec executes any staged operations attached on the bridge handle

func (*BridgeHandle) ID

func (bh *BridgeHandle) ID() string

ID returns the identifier for the bridge

func (*BridgeHandle) Key

func (bh *BridgeHandle) Key() *Key

Key returns the Key of the bridge

func (*BridgeHandle) Play

func (bh *BridgeHandle) Play(id string, mediaURI string) (*PlaybackHandle, error)

Play initiates playback of the specified media uri to the bridge, returning the Playback handle

func (*BridgeHandle) Record

func (bh *BridgeHandle) Record(name string, opts *RecordingOptions) (*LiveRecordingHandle, error)

Record records the bridge to the given filename

func (*BridgeHandle) RemoveChannel

func (bh *BridgeHandle) RemoveChannel(channelID string) error

RemoveChannel removes a channel from the bridge

func (*BridgeHandle) StagePlay

func (bh *BridgeHandle) StagePlay(id string, mediaURI string) (*PlaybackHandle, error)

StagePlay stages a `Play` operation.

func (*BridgeHandle) StageRecord

func (bh *BridgeHandle) StageRecord(name string, opts *RecordingOptions) (*LiveRecordingHandle, error)

StageRecord stages a `Record` operation

func (*BridgeHandle) Subscribe

func (bh *BridgeHandle) Subscribe(n ...string) Subscription

Subscribe creates a subscription to the list of events

type BridgeMerged

type BridgeMerged struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Bridge     BridgeData `json:"bridge"`
	BridgeFrom BridgeData `json:"bridge_from"`
}

BridgeMerged - "Notification that one bridge has merged into another."

func (*BridgeMerged) GetBridgeIDs

func (evt *BridgeMerged) GetBridgeIDs() (sx []string)

GetBridgeIDs gets the bridge IDs for the event

func (*BridgeMerged) Keys

func (evt *BridgeMerged) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type BridgeVideoSourceChanged

type BridgeVideoSourceChanged struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Bridge           BridgeData `json:"bridge"`
	OldVideoSourceId string     `json:"old_video_source_id,omitempty"`
}

BridgeVideoSourceChanged - "Notification that the source of video in a bridge has changed."

func (*BridgeVideoSourceChanged) Keys

func (evt *BridgeVideoSourceChanged) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type BuildInfo

type BuildInfo struct {
	Date    string `json:"date"`
	Kernel  string `json:"kernel"`
	Machine string `json:"machine"`
	Options string `json:"options"`
	Os      string `json:"os"`
	User    string `json:"user"`
}

BuildInfo describes information about how Asterisk was built

type Bus

type Bus interface {
	Close()
	Sender
	Subscriber
}

Bus is an event bus for ARI events. It receives and redistributes events based on a subscription model.

type CallerID

type CallerID struct {
	// Name is the name of the party
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Number is the number of the party
	Number string `protobuf:"bytes,2,opt,name=number,proto3" json:"number,omitempty"`
}

CallerID describes the name and number which identifies the caller to other endpoints

func CallerIDFromString

func CallerIDFromString(src string) (*CallerID, error)

CallerIDFromString interprets the provided string as a CallerID. Usually, this string will be of the following forms:

  • "Name" <number>
  • <number>
  • "Name" number

func (*CallerID) Descriptor

func (*CallerID) Descriptor() ([]byte, []int)

func (*CallerID) GetName

func (m *CallerID) GetName() string

func (*CallerID) GetNumber

func (m *CallerID) GetNumber() string

func (*CallerID) Marshal

func (m *CallerID) Marshal() (dAtA []byte, err error)

func (*CallerID) MarshalTo

func (m *CallerID) MarshalTo(dAtA []byte) (int, error)

func (*CallerID) ProtoMessage

func (*CallerID) ProtoMessage()

func (*CallerID) Reset

func (m *CallerID) Reset()

func (*CallerID) Size

func (m *CallerID) Size() (n int)

func (*CallerID) String

func (cid *CallerID) String() string

String returns the stringified callerid

func (*CallerID) Unmarshal

func (m *CallerID) Unmarshal(dAtA []byte) error

type Channel

type Channel interface {
	// Get returns a handle to a channel for further interaction
	Get(key *Key) *ChannelHandle

	// GetVariable retrieves the value of a channel variable
	GetVariable(*Key, string) (string, error)

	// List lists the channels in asterisk, optionally using the key for filtering
	List(*Key) ([]*Key, error)

	// Originate creates a new channel, returning a handle to it or an error, if
	// the creation failed.
	// The Key should be that of the linked channel, if one exists, so that the
	// Node can be matches to it.
	Originate(*Key, OriginateRequest) (*ChannelHandle, error)

	// StageOriginate creates a new Originate, created when the `Exec` method
	// on `ChannelHandle` is invoked.
	// The Key should be that of the linked channel, if one exists, so that the
	// Node can be matches to it.
	StageOriginate(*Key, OriginateRequest) (*ChannelHandle, error)

	// Create creates a new channel, returning a handle to it or an
	// error, if the creation failed. Create is already Staged via `Dial`.
	// The Key should be that of the linked channel, if one exists, so that the
	// Node can be matches to it.
	Create(*Key, ChannelCreateRequest) (*ChannelHandle, error)

	// Data returns the channel data for a given channel
	Data(key *Key) (*ChannelData, error)

	// Continue tells Asterisk to return a channel to the dialplan
	Continue(key *Key, context, extension string, priority int) error

	// Busy hangs up the channel with the "busy" cause code
	Busy(key *Key) error

	// Congestion hangs up the channel with the "congestion" cause code
	Congestion(key *Key) error

	// Answer answers the channel
	Answer(key *Key) error

	// Hangup hangs up the given channel
	Hangup(key *Key, reason string) error

	// Ring indicates ringing to the channel
	Ring(key *Key) error

	// StopRing stops ringing on the channel
	StopRing(key *Key) error

	// SendDTMF sends DTMF to the channel
	SendDTMF(key *Key, dtmf string, opts *DTMFOptions) error

	// Hold puts the channel on hold
	Hold(key *Key) error

	// StopHold retrieves the channel from hold
	StopHold(key *Key) error

	// Mute mutes a channel in the given direction (in,out,both)
	Mute(key *Key, dir Direction) error

	// Unmute unmutes a channel in the given direction (in,out,both)
	Unmute(key *Key, dir Direction) error

	// MOH plays music on hold
	MOH(key *Key, moh string) error

	// SetVariable sets a channel variable
	SetVariable(key *Key, name, value string) error

	// StopMOH stops music on hold
	StopMOH(key *Key) error

	// Silence plays silence to the channel
	Silence(key *Key) error

	// StopSilence stops the silence on the channel
	StopSilence(key *Key) error

	// Play plays the media URI to the channel
	Play(key *Key, playbackID string, mediaURI string) (*PlaybackHandle, error)

	// StagePlay stages a `Play` operation and returns the `PlaybackHandle`
	// for invoking it.
	StagePlay(key *Key, playbackID string, mediaURI string) (*PlaybackHandle, error)

	// Record records the channel
	Record(key *Key, name string, opts *RecordingOptions) (*LiveRecordingHandle, error)

	// StageRecord stages a `Record` operation and returns the `PlaybackHandle`
	// for invoking it.
	StageRecord(key *Key, name string, opts *RecordingOptions) (*LiveRecordingHandle, error)

	// Dial dials a created channel
	Dial(key *Key, caller string, timeout time.Duration) error

	// Snoop spies on a specific channel, creating a new snooping channel
	Snoop(key *Key, snoopID string, opts *SnoopOptions) (*ChannelHandle, error)

	// StageSnoop creates a new `ChannelHandle`, when `Exec`ed, snoops on the given channel ID and
	// creates a new snooping channel.
	StageSnoop(key *Key, snoopID string, opts *SnoopOptions) (*ChannelHandle, error)

	// Subscribe subscribes on the channel events
	Subscribe(key *Key, n ...string) Subscription
}

Channel represents a communication path interacting with an Asterisk server.

type ChannelCallerID

type ChannelCallerID struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	CallerPresentation    int         `json:"caller_presentation"`     // The integer representation of the Caller Presentation value.
	CallerPresentationTxt string      `json:"caller_presentation_txt"` // The text representation of the Caller Presentation value.
	Channel               ChannelData `json:"channel"`                 // The channel that changed Caller ID.
}

ChannelCallerID - "Channel changed Caller ID."

func (*ChannelCallerID) GetChannelIDs

func (evt *ChannelCallerID) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*ChannelCallerID) Keys

func (evt *ChannelCallerID) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type ChannelConnectedLine

type ChannelConnectedLine struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Channel ChannelData `json:"channel"` // The channel whose connected line has changed.
}

ChannelConnectedLine - "Channel changed Connected Line."

func (*ChannelConnectedLine) Keys

func (evt *ChannelConnectedLine) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type ChannelCreateRequest

type ChannelCreateRequest struct {
	// Endpoint is the target endpoint for the dial
	Endpoint string `json:"endpoint"`

	// App is the name of the Stasis application to execute on connection
	App string `json:"app"`

	// AppArgs is the set of (comma-separated) arguments for the Stasis App
	AppArgs string `json:"appArgs,omitempty"`

	// ChannelID is the ID to give to the newly-created channel
	ChannelID string `json:"channelId,omitempty"`

	// OtherChannelID is the ID of the second created channel (when creating Local channels)
	OtherChannelID string `json:"otherChannelId,omitempty"`

	// Originator is the unique ID of the calling channel, for which this new channel-dial is being created
	Originator string `json:"originator,omitempty"`

	// Formats is the comma-separated list of valid codecs to allow for the new channel, in the case that
	// the Originator is not specified
	Formats string `json:"formats,omitempty"`
}

ChannelCreateRequest describes how a channel should be created, when using the separate Create and Dial calls.

type ChannelCreated

type ChannelCreated struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Channel ChannelData `json:"channel"`
}

ChannelCreated - "Notification that a channel has been created."

func (*ChannelCreated) GetChannelIDs

func (evt *ChannelCreated) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*ChannelCreated) Keys

func (evt *ChannelCreated) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type ChannelData

type ChannelData struct {
	// Key is the key of the channel
	Key *Key `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
	// Id is the unique ID for this channel (AMI-style)
	ID string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	// Name is the name of this channel (tect/name-id)
	Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	// State is the current state of the channel
	State string `protobuf:"bytes,4,opt,name=state,proto3" json:"state,omitempty"`
	// Accountcode is the account code assigned to the channel
	Accountcode string `protobuf:"bytes,5,opt,name=accountcode,proto3" json:"accountcode,omitempty"`
	// Caller is the callerID of the calling endpoint
	Caller *CallerID `protobuf:"bytes,6,opt,name=caller" json:"caller,omitempty"`
	// Connected is the callerID of the connected line, if applicable
	Connected *CallerID `protobuf:"bytes,7,opt,name=connected" json:"connected,omitempty"`
	// Creationtime is the time at which the channel was created
	Creationtime *google_protobuf1.Timestamp `protobuf:"bytes,8,opt,name=creationtime" json:"creationtime,omitempty"`
	// Dialplan is the current location of the channel in the dialplan
	Dialplan *DialplanCEP `protobuf:"bytes,9,opt,name=dialplan" json:"dialplan,omitempty"`
}

ChannelData describes the data for a specific channel

func (*ChannelData) Descriptor

func (*ChannelData) Descriptor() ([]byte, []int)

func (*ChannelData) GetAccountcode

func (m *ChannelData) GetAccountcode() string

func (*ChannelData) GetCaller

func (m *ChannelData) GetCaller() *CallerID

func (*ChannelData) GetConnected

func (m *ChannelData) GetConnected() *CallerID

func (*ChannelData) GetCreationtime

func (m *ChannelData) GetCreationtime() *google_protobuf1.Timestamp

func (*ChannelData) GetDialplan

func (m *ChannelData) GetDialplan() *DialplanCEP

func (*ChannelData) GetID

func (m *ChannelData) GetID() string

func (*ChannelData) GetKey

func (m *ChannelData) GetKey() *Key

func (*ChannelData) GetName

func (m *ChannelData) GetName() string

func (*ChannelData) GetState

func (m *ChannelData) GetState() string

func (*ChannelData) Marshal

func (m *ChannelData) Marshal() (dAtA []byte, err error)

func (*ChannelData) MarshalJSON

func (d *ChannelData) MarshalJSON() ([]byte, error)

func (*ChannelData) MarshalTo

func (m *ChannelData) MarshalTo(dAtA []byte) (int, error)

func (*ChannelData) ProtoMessage

func (*ChannelData) ProtoMessage()

func (*ChannelData) Reset

func (m *ChannelData) Reset()

func (*ChannelData) Size

func (m *ChannelData) Size() (n int)

func (*ChannelData) String

func (m *ChannelData) String() string

func (*ChannelData) Unmarshal

func (m *ChannelData) Unmarshal(dAtA []byte) error

func (*ChannelData) UnmarshalJSON

func (d *ChannelData) UnmarshalJSON(data []byte) error

type ChannelDestroyed

type ChannelDestroyed struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Cause    int         `json:"cause"`     // Integer representation of the cause of the hangup
	CauseTxt string      `json:"cause_txt"` // Text representation of the cause of the hangup
	Channel  ChannelData `json:"channel"`
}

ChannelDestroyed - "Notification that a channel has been destroyed."

func (*ChannelDestroyed) Keys

func (evt *ChannelDestroyed) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type ChannelDialplan

type ChannelDialplan struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Channel         ChannelData `json:"channel"`           // The channel that changed dialplan location.
	DialplanApp     string      `json:"dialplan_app"`      // The application about to be executed.
	DialplanAppData string      `json:"dialplan_app_data"` // The data to be passed to the application.
}

ChannelDialplan - "Channel changed location in the dialplan."

func (*ChannelDialplan) GetChannelIDs

func (evt *ChannelDialplan) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*ChannelDialplan) Keys

func (evt *ChannelDialplan) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type ChannelDtmfReceived

type ChannelDtmfReceived struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Channel    ChannelData `json:"channel"`     // The channel on which DTMF was received
	Digit      string      `json:"digit"`       // DTMF digit received (0-9, A-E, # or *)
	DurationMs int         `json:"duration_ms"` // Number of milliseconds DTMF was received
}

ChannelDtmfReceived - "DTMF received on a channel.This event is sent when the DTMF ends. There is no notification about the start of DTMF"

func (*ChannelDtmfReceived) GetChannelIDs

func (evt *ChannelDtmfReceived) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*ChannelDtmfReceived) Keys

func (evt *ChannelDtmfReceived) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type ChannelEnteredBridge

type ChannelEnteredBridge struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Bridge  BridgeData  `json:"bridge"`
	Channel ChannelData `json:"channel"`
}

ChannelEnteredBridge - "Notification that a channel has entered a bridge."

func (*ChannelEnteredBridge) Created

func (evt *ChannelEnteredBridge) Created() (o string, related string)

Created marks the event as creating a bridge for a channel and dialog

func (*ChannelEnteredBridge) GetBridgeIDs

func (evt *ChannelEnteredBridge) GetBridgeIDs() (sx []string)

GetBridgeIDs gets the bridge IDs for the event

func (*ChannelEnteredBridge) GetChannelIDs

func (evt *ChannelEnteredBridge) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*ChannelEnteredBridge) Keys

func (evt *ChannelEnteredBridge) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type ChannelHandle

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

ChannelHandle provides a wrapper on the Channel interface for operations on a particular channel ID.

func NewChannelHandle

func NewChannelHandle(key *Key, c Channel, exec func(ch *ChannelHandle) error) *ChannelHandle

NewChannelHandle returns a handle to the given ARI channel

func (*ChannelHandle) Answer

func (ch *ChannelHandle) Answer() error

Answer answers the channel

func (*ChannelHandle) Busy

func (ch *ChannelHandle) Busy() error

Busy hangs up the channel with the "busy" cause code

func (*ChannelHandle) Congestion

func (ch *ChannelHandle) Congestion() error

Congestion hangs up the channel with the congestion cause code

func (*ChannelHandle) Continue

func (ch *ChannelHandle) Continue(context, extension string, priority int) error

Continue tells Asterisk to return the channel to the dialplan

func (*ChannelHandle) Create

Create creates (but does not dial) a new channel, using the present channel as its Originator.

func (*ChannelHandle) Data

func (ch *ChannelHandle) Data() (*ChannelData, error)

Data returns the channel's data

func (*ChannelHandle) Dial

func (ch *ChannelHandle) Dial(caller string, timeout time.Duration) error

Dial dials a created channel. `caller` is the optional channel ID of the calling party (if there is one). Timeout is the length of time to wait before the dial is answered before aborting.

func (*ChannelHandle) Exec

func (ch *ChannelHandle) Exec() (err error)

Exec executes any staged channel operations attached to this handle.

func (*ChannelHandle) GetVariable

func (ch *ChannelHandle) GetVariable(name string) (string, error)

GetVariable returns the value of a channel variable

func (*ChannelHandle) Hangup

func (ch *ChannelHandle) Hangup() error

Hangup hangs up the channel with the normal cause code

func (*ChannelHandle) Hold

func (ch *ChannelHandle) Hold() error

Hold puts the channel on hold

func (*ChannelHandle) ID

func (ch *ChannelHandle) ID() string

ID returns the identifier for the channel handle

func (*ChannelHandle) IsAnswered

func (ch *ChannelHandle) IsAnswered() (bool, error)

IsAnswered checks the current state of the channel to see if it is "Up"

func (*ChannelHandle) Key

func (ch *ChannelHandle) Key() *Key

Key returns the key for the channel handle

func (*ChannelHandle) MOH

func (ch *ChannelHandle) MOH(mohClass string) error

MOH plays music on hold of the given class to the channel

func (*ChannelHandle) Mute

func (ch *ChannelHandle) Mute(dir Direction) (err error)

Mute mutes the channel in the given direction (in, out, both)

func (*ChannelHandle) Originate

func (ch *ChannelHandle) Originate(req OriginateRequest) (*ChannelHandle, error)

Originate creates (and dials) a new channel using the present channel as its Originator.

func (*ChannelHandle) Play

func (ch *ChannelHandle) Play(id string, mediaURI string) (ph *PlaybackHandle, err error)

Play initiates playback of the specified media uri to the channel, returning the Playback handle

func (*ChannelHandle) Record

func (ch *ChannelHandle) Record(name string, opts *RecordingOptions) (*LiveRecordingHandle, error)

Record records the channel to the given filename

func (*ChannelHandle) Ring

func (ch *ChannelHandle) Ring() error

Ring indicates ringing to the channel

func (*ChannelHandle) SendDTMF

func (ch *ChannelHandle) SendDTMF(dtmf string, opts *DTMFOptions) error

SendDTMF sends the DTMF information to the server

func (*ChannelHandle) SetVariable

func (ch *ChannelHandle) SetVariable(name, value string) error

SetVariable sets the value of a channel variable

func (*ChannelHandle) Silence

func (ch *ChannelHandle) Silence() error

Silence plays silence to the channel

func (*ChannelHandle) Snoop

func (ch *ChannelHandle) Snoop(snoopID string, opts *SnoopOptions) (*ChannelHandle, error)

Snoop spies on a specific channel, creating a new snooping channel placed into the given app

func (*ChannelHandle) StageOriginate

func (ch *ChannelHandle) StageOriginate(req OriginateRequest) (*ChannelHandle, error)

StageOriginate stages an originate (channel creation and dial) to be Executed later.

func (*ChannelHandle) StagePlay

func (ch *ChannelHandle) StagePlay(id string, mediaURI string) (*PlaybackHandle, error)

StagePlay stages a `Play` operation.

func (*ChannelHandle) StageRecord

func (ch *ChannelHandle) StageRecord(name string, opts *RecordingOptions) (*LiveRecordingHandle, error)

StageRecord stages a `Record` operation

func (*ChannelHandle) StageSnoop

func (ch *ChannelHandle) StageSnoop(snoopID string, opts *SnoopOptions) (*ChannelHandle, error)

StageSnoop stages a `Snoop` operation

func (*ChannelHandle) StopHold

func (ch *ChannelHandle) StopHold() error

StopHold retrieves the channel from hold

func (*ChannelHandle) StopMOH

func (ch *ChannelHandle) StopMOH() error

StopMOH stops playing of music on hold to the channel

func (*ChannelHandle) StopRing

func (ch *ChannelHandle) StopRing() error

StopRing stops ringing on the channel

func (*ChannelHandle) StopSilence

func (ch *ChannelHandle) StopSilence() error

StopSilence stops silence to the channel

func (*ChannelHandle) Subscribe

func (ch *ChannelHandle) Subscribe(n ...string) Subscription

Subscribe subscribes the list of channel events

func (*ChannelHandle) Unmute

func (ch *ChannelHandle) Unmute(dir Direction) (err error)

Unmute unmutes the channel in the given direction (in, out, both)

type ChannelHangupRequest

type ChannelHangupRequest struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Cause   int         `json:"cause"`   // Integer representation of the cause of the hangup.
	Channel ChannelData `json:"channel"` // The channel on which the hangup was requested.
	Soft    bool        `json:"soft"`    // Whether the hangup request was a soft hangup request.
}

ChannelHangupRequest - "A hangup was requested on the channel."

func (*ChannelHangupRequest) GetChannelIDs

func (evt *ChannelHangupRequest) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*ChannelHangupRequest) Keys

func (evt *ChannelHangupRequest) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type ChannelHold

type ChannelHold struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Channel    ChannelData `json:"channel"`              // The channel that initiated the hold event.
	Musicclass string      `json:"musicclass,omitempty"` // The music on hold class that the initiator requested.
}

ChannelHold - "A channel initiated a media hold."

func (*ChannelHold) GetChannelIDs

func (evt *ChannelHold) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*ChannelHold) Keys

func (evt *ChannelHold) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type ChannelLeftBridge

type ChannelLeftBridge struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Bridge  BridgeData  `json:"bridge"`
	Channel ChannelData `json:"channel"`
}

ChannelLeftBridge - "Notification that a channel has left a bridge."

func (*ChannelLeftBridge) GetBridgeIDs

func (evt *ChannelLeftBridge) GetBridgeIDs() (sx []string)

GetBridgeIDs gets the bridge IDs for the event

func (*ChannelLeftBridge) GetChannelIDs

func (evt *ChannelLeftBridge) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*ChannelLeftBridge) Keys

func (evt *ChannelLeftBridge) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type ChannelStateChange

type ChannelStateChange struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Channel ChannelData `json:"channel"`
}

ChannelStateChange - "Notification of a channel's state change."

func (*ChannelStateChange) GetChannelIDs

func (evt *ChannelStateChange) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*ChannelStateChange) Keys

func (evt *ChannelStateChange) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type ChannelTalkingFinished

type ChannelTalkingFinished struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Channel  ChannelData `json:"channel"`  // The channel on which talking completed.
	Duration int         `json:"duration"` // The length of time, in milliseconds, that talking was detected on the channel
}

ChannelTalkingFinished - "Talking is no longer detected on the channel."

func (*ChannelTalkingFinished) Keys

func (evt *ChannelTalkingFinished) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type ChannelTalkingStarted

type ChannelTalkingStarted struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Channel ChannelData `json:"channel"` // The channel on which talking started.
}

ChannelTalkingStarted - "Talking was detected on the channel."

func (*ChannelTalkingStarted) GetChannelIDs

func (evt *ChannelTalkingStarted) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*ChannelTalkingStarted) Keys

func (evt *ChannelTalkingStarted) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type ChannelUnhold

type ChannelUnhold struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Channel ChannelData `json:"channel"` // The channel that initiated the unhold event.
}

ChannelUnhold - "A channel initiated a media unhold."

func (*ChannelUnhold) GetChannelIDs

func (evt *ChannelUnhold) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*ChannelUnhold) Keys

func (evt *ChannelUnhold) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type ChannelUserevent

type ChannelUserevent struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Bridge    BridgeData   `json:"bridge,omitempty"`   // A bridge that is signaled with the user event.
	Channel   ChannelData  `json:"channel,omitempty"`  // A channel that is signaled with the user event.
	Endpoint  EndpointData `json:"endpoint,omitempty"` // A endpoint that is signaled with the user event.
	Eventname string       `json:"eventname"`          // The name of the user event.
	Userevent interface{}  `json:"userevent"`          // Custom Userevent data
}

ChannelUserevent - "User-generated event with additional user-defined fields in the object."

func (*ChannelUserevent) GetBridgeIDs

func (evt *ChannelUserevent) GetBridgeIDs() (sx []string)

GetBridgeIDs gets the bridge IDs for the event

func (*ChannelUserevent) GetChannelIDs

func (evt *ChannelUserevent) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*ChannelUserevent) GetEndpointIDs

func (evt *ChannelUserevent) GetEndpointIDs() (sx []string)

GetEndpointIDs gets the bridge IDs for the event

func (*ChannelUserevent) Keys

func (evt *ChannelUserevent) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type ChannelVarset

type ChannelVarset struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Channel  ChannelData `json:"channel,omitempty"` // The channel on which the variable was set.If missing, the variable is a global variable.
	Value    string      `json:"value"`             // The new value of the variable.
	Variable string      `json:"variable"`          // The variable that changed.
}

ChannelVarset - "Channel variable changed."

func (*ChannelVarset) GetChannelIDs

func (evt *ChannelVarset) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*ChannelVarset) Keys

func (evt *ChannelVarset) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type Client

type Client interface {
	ApplicationName() string
	Close()

	Application() Application
	Asterisk() Asterisk
	Bridge() Bridge
	Bus() Bus
	Channel() Channel
	DeviceState() DeviceState
	Endpoint() Endpoint
	LiveRecording() LiveRecording
	Mailbox() Mailbox
	Playback() Playback
	Sound() Sound
	StoredRecording() StoredRecording
	TextMessage() TextMessage
}

Client represents a set of operations to interact with an Asterisk ARI server. It is agnostic to transport and implementation.

type Config

type Config interface {

	// Get gets the reference to a config object
	Get(key *Key) *ConfigHandle

	// Data gets the data for the config object
	Data(key *Key) (*ConfigData, error)

	// Update creates or updates the given tuples
	Update(key *Key, tuples []ConfigTuple) error

	// Delete deletes the dynamic configuration object.
	Delete(key *Key) error
}

Config represents a transport to the asterisk config ARI resource.

type ConfigData

type ConfigData struct {
	// Key is the cluster-unique identifier for this configuration
	Key *Key `json:"key"`

	Class string
	Type  string
	Name  string

	Fields []ConfigTuple
}

ConfigData contains the data for a given configuration object

func (*ConfigData) ID

func (cd *ConfigData) ID() string

ID returns the ID of the ConfigData structure

type ConfigHandle

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

A ConfigHandle is a reference to a Config object on the asterisk service

func NewConfigHandle

func NewConfigHandle(key *Key, c Config) *ConfigHandle

NewConfigHandle builds a new config handle

func (*ConfigHandle) Data

func (h *ConfigHandle) Data() (*ConfigData, error)

Data gets the current data for the config handle

func (*ConfigHandle) Delete

func (h *ConfigHandle) Delete() error

Delete deletes the dynamic configuration object

func (*ConfigHandle) ID

func (h *ConfigHandle) ID() string

ID returns the unique identifier for the config object

func (*ConfigHandle) Update

func (h *ConfigHandle) Update(tuples []ConfigTuple) error

Update creates or updates the given config tuples

type ConfigInfo

type ConfigInfo struct {
	DefaultLanguage string  `json:"default_language"`
	MaxChannels     int     `json:"max_channels,omitempty"` //omitempty denotes an optional field, meaning the field may not be present if no value is assigned.
	MaxLoad         float64 `json:"max_load,omitempty"`
	MaxOpenFiles    int     `json:"max_open_files,omitempty"`
	Name            string  `json:"name"`  // Asterisk system name
	SetID           SetID   `json:"setid"` // Effective user/group id under which Asterisk is running
}

ConfigInfo describes information about the Asterisk configuration

type ConfigTuple

type ConfigTuple struct {
	Attribute string `json:"attribute"`
	Value     string `json:"value"`
}

ConfigTuple is the key-value pair that defines a configuration entry

type ContactInfo

type ContactInfo struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Aor           string `json:"aor"`                      // The Address of Record this contact belongs to.
	ContactStatus string `json:"contact_status"`           // The current status of the contact.
	RoundtripUsec string `json:"roundtrip_usec,omitempty"` // Current round trip time, in microseconds, for the contact.
	Uri           string `json:"uri"`                      // The location of the contact.
}

ContactInfo - "Detailed information about a contact on an endpoint."

func (*ContactInfo) Keys

func (evt *ContactInfo) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type ContactStatusChange

type ContactStatusChange struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	ContactInfo ContactInfo  `json:"contact_info"`
	Endpoint    EndpointData `json:"endpoint"`
}

ContactStatusChange - "The state of a contact on an endpoint has changed."

func (*ContactStatusChange) GetEndpointIDs

func (evt *ContactStatusChange) GetEndpointIDs() (sx []string)

GetEndpointIDs gets the bridge IDs for the event

func (*ContactStatusChange) Keys

func (evt *ContactStatusChange) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type DTMFOptions

type DTMFOptions struct {
	Before   time.Duration
	Between  time.Duration
	Duration time.Duration
	After    time.Duration
}

DTMFOptions is the list of pptions for DTMF sending

type DTMFSender

type DTMFSender interface {
	SendDTMF(dtmf string, opts *DTMFOptions)
}

DTMFSender is an object which can be send DTMF signals

type DateTime

type DateTime time.Time

DateTime is an alias type for attaching a custom asterisk unmarshaller and marshaller for JSON

func (DateTime) MarshalJSON

func (dt DateTime) MarshalJSON() ([]byte, error)

MarshalJSON converts the given date object to ARIs date format

func (DateTime) String

func (dt DateTime) String() string

func (*DateTime) UnmarshalJSON

func (dt *DateTime) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the given date per ARIs date format

type DeviceState

type DeviceState interface {
	Get(key *Key) *DeviceStateHandle

	List(filter *Key) ([]*Key, error)

	Data(key *Key) (*DeviceStateData, error)

	Update(key *Key, state string) error

	Delete(key *Key) error
}

DeviceState represents a communication path interacting with an Asterisk server for device state resources

type DeviceStateChanged

type DeviceStateChanged struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	DeviceState DeviceStateData `json:"device_state"` // Device state object
}

DeviceStateChanged - "Notification that a device state has changed."

func (*DeviceStateChanged) Keys

func (evt *DeviceStateChanged) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type DeviceStateData

type DeviceStateData struct {
	// Key is the cluster-unique identifier for this device state
	Key *Key `json:"key"`

	State string `json:"state"`
}

DeviceStateData is the device state for the device

type DeviceStateHandle

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

DeviceStateHandle is a representation of a device state that can be interacted with

func NewDeviceStateHandle

func NewDeviceStateHandle(key *Key, d DeviceState) *DeviceStateHandle

NewDeviceStateHandle creates a new deviceState handle

func (*DeviceStateHandle) Data

func (dsh *DeviceStateHandle) Data() (d *DeviceStateData, err error)

Data gets the device state

func (*DeviceStateHandle) Delete

func (dsh *DeviceStateHandle) Delete() (err error)

Delete deletes the device state

func (*DeviceStateHandle) ID

func (dsh *DeviceStateHandle) ID() string

ID returns the identifier for the device

func (*DeviceStateHandle) Key

func (dsh *DeviceStateHandle) Key() *Key

Key returns the key for the device

func (*DeviceStateHandle) Update

func (dsh *DeviceStateHandle) Update(state string) (err error)

Update updates the device state, implicitly creating it if not exists

type Dial

type Dial struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Caller     ChannelData `json:"caller,omitempty"`     // The calling channel.
	Dialstatus string      `json:"dialstatus"`           // Current status of the dialing attempt to the peer.
	Dialstring string      `json:"dialstring,omitempty"` // The dial string for calling the peer channel.
	Forward    string      `json:"forward,omitempty"`    // Forwarding target requested by the original dialed channel.
	Forwarded  ChannelData `json:"forwarded,omitempty"`  // Channel that the caller has been forwarded to.
	Peer       ChannelData `json:"peer"`                 // The dialed channel.
}

Dial - "Dialing state has changed."

func (*Dial) GetChannelIDs

func (evt *Dial) GetChannelIDs() (sx []string)

GetChannelIDs gets the bridge IDs for the event

func (*Dial) Keys

func (evt *Dial) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type DialplanCEP

type DialplanCEP struct {
	// Context describes the section in the dialplan
	Context string `protobuf:"bytes,1,opt,name=context,proto3" json:"context,omitempty"`
	// Exten describes the label in the section of the dialplan
	Exten string `protobuf:"bytes,2,opt,name=exten,proto3" json:"exten,omitempty"`
	// Priority indicates the index at the label in the section of the dialplan
	Priority int64 `protobuf:"varint,3,opt,name=priority,proto3" json:"priority,omitempty"`
}

Dialplan describes a location in the Asterisk dialplan

func (*DialplanCEP) Descriptor

func (*DialplanCEP) Descriptor() ([]byte, []int)

func (*DialplanCEP) GetContext

func (m *DialplanCEP) GetContext() string

func (*DialplanCEP) GetExten

func (m *DialplanCEP) GetExten() string

func (*DialplanCEP) GetPriority

func (m *DialplanCEP) GetPriority() int64

func (*DialplanCEP) Marshal

func (m *DialplanCEP) Marshal() (dAtA []byte, err error)

func (*DialplanCEP) MarshalTo

func (m *DialplanCEP) MarshalTo(dAtA []byte) (int, error)

func (*DialplanCEP) ProtoMessage

func (*DialplanCEP) ProtoMessage()

func (*DialplanCEP) Reset

func (m *DialplanCEP) Reset()

func (*DialplanCEP) Size

func (m *DialplanCEP) Size() (n int)

func (*DialplanCEP) String

func (m *DialplanCEP) String() string

func (*DialplanCEP) Unmarshal

func (m *DialplanCEP) Unmarshal(dAtA []byte) error

type Direction

type Direction string

Direction describes an audio direction, as used by Mute, Snoop, and possibly others. Valid values are "in", "out", and "both".

const (
	// DirectionNone indicates audio should not flow in any direction
	DirectionNone Direction = "none"

	// DirectionIn indicates the direction flowing from the channel into Asterisk
	DirectionIn Direction = "in"

	// DirectionOut indicates the direction flowing from Asterisk to the channel
	DirectionOut Direction = "out"

	// DirectionBoth indicates both the directions flowing both inward to Asterisk and outward from Asterisk.
	DirectionBoth Direction = "both"
)

type DurationSec

type DurationSec time.Duration

DurationSec is a JSON type for duration in seconds

func (DurationSec) MarshalJSON

func (ds DurationSec) MarshalJSON() ([]byte, error)

MarshalJSON converts the duration into a JSON friendly format

func (*DurationSec) UnmarshalJSON

func (ds *DurationSec) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the data into the duration seconds object

type Endpoint

type Endpoint interface {

	// List lists the endpoints
	List(filter *Key) ([]*Key, error)

	// List available endpoints for a given endpoint technology
	ListByTech(tech string, filter *Key) ([]*Key, error)

	// Get returns a handle to the endpoint for further operations
	Get(key *Key) *EndpointHandle

	// Data returns the state of the endpoint
	Data(key *Key) (*EndpointData, error)
}

Endpoint represents a communication path to an Asterisk server for endpoint resources

type EndpointData

type EndpointData struct {
	// Key is the cluster-unique identifier for this Endpoint
	Key *Key `json:"key"`

	ChannelIDs []string `json:"channel_ids"`     // List of channel Ids which are associated with this endpoint
	Resource   string   `json:"resource"`        // The endpoint's resource name
	State      string   `json:"state,omitempty"` // The state of the endpoint
	Technology string   `json:"technology"`      // The technology of the endpoint (e.g. SIP, PJSIP, DAHDI, etc)
}

EndpointData describes an external device which may offer or accept calls to or from Asterisk. Devices are defined by a technology/resource pair.

Allowed states: 'unknown', 'offline', 'online'

func (*EndpointData) ID

func (ed *EndpointData) ID() string

ID returns the ID for the endpoint

type EndpointHandle

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

An EndpointHandle is a reference to an endpoint attached to a transport to an asterisk server

func NewEndpointHandle

func NewEndpointHandle(key *Key, e Endpoint) *EndpointHandle

NewEndpointHandle creates a new EndpointHandle

func (*EndpointHandle) Data

func (eh *EndpointHandle) Data() (*EndpointData, error)

Data returns the state of the endpoint

func (*EndpointHandle) ID

func (eh *EndpointHandle) ID() string

ID returns the identifier for the endpoint

func (*EndpointHandle) Key

func (eh *EndpointHandle) Key() *Key

Key returns the key for the endpoint

type EndpointStateChange

type EndpointStateChange struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Endpoint EndpointData `json:"endpoint"`
}

EndpointStateChange - "Endpoint state changed."

func (*EndpointStateChange) GetChannelIDs

func (evt *EndpointStateChange) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*EndpointStateChange) GetEndpointIDs

func (evt *EndpointStateChange) GetEndpointIDs() (sx []string)

GetEndpointIDs gets the endpoint IDs for the event

func (*EndpointStateChange) Keys

func (evt *EndpointStateChange) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type Event

type Event interface {
	// GetApplication returns the name of the ARI application to which this event is associated
	GetApplication() string

	// GetDialog returns any dialog by which this event has been tagged
	GetDialog() string

	// GetNode returns the unique ID of the Asterisk system on which this event originated
	GetNode() string

	// GetType returns the type name of this event
	GetType() string

	// Key returns a key using the location information from the Event
	Key(kind, id string) *Key

	// Keys returns the related entity keys for the event
	Keys() Keys

	// SetDialog tags the event with a Dialog
	SetDialog(string)
}

Event is the top level event interface

func DecodeEvent

func DecodeEvent(data []byte) (Event, error)

DecodeEvent converts a JSON-encoded event to an ARI event.

type EventData

type EventData struct {
	// Application indicates the ARI application which emitted this event
	Application string `json:"application"`

	// Dialog indicates a dialog to which the event has been bound
	Dialog string `json:"dialog,omitempty"`

	// Node indicates the unique identifier of the source Asterisk box for this event
	Node string `json:"asterisk_id,omitempty"`

	// Timestamp indicates the time this event was generated
	Timestamp DateTime `json:"timestamp,omitempty"`

	// Type is the type name of this event
	Type string `json:"type"`
}

EventData provides the basic metadata for an ARI event

func (*EventData) GetApplication

func (e *EventData) GetApplication() string

GetApplication gets the application of the event

func (*EventData) GetDialog

func (e *EventData) GetDialog() string

GetDialog gets the dialog, if present, to which this event has been tagged

func (*EventData) GetNode

func (e *EventData) GetNode() string

GetNode gets the node ID of the source Asterisk instance

func (*EventData) GetType

func (e *EventData) GetType() string

GetType gets the type of the event

func (*EventData) Key

func (e *EventData) Key(kind, id string) *Key

Key returns a new, fully qualified key from the EventData

func (*EventData) SetDialog

func (e *EventData) SetDialog(id string)

SetDialog tags the event with the given dialog ID. If a dialog is already set, it will be overwritten.

type EventTypes

type EventTypes struct {
	All                      string
	ApplicationReplaced      string
	BridgeAttendedTransfer   string
	BridgeBlindTransfer      string
	BridgeCreated            string
	BridgeDestroyed          string
	BridgeMerged             string
	BridgeVideoSourceChanged string
	ChannelCallerID          string
	ChannelConnectedLine     string
	ChannelCreated           string
	ChannelDestroyed         string
	ChannelDialplan          string
	ChannelDtmfReceived      string
	ChannelEnteredBridge     string
	ChannelHangupRequest     string
	ChannelHold              string
	ChannelLeftBridge        string
	ChannelStateChange       string
	ChannelTalkingFinished   string
	ChannelTalkingStarted    string
	ChannelUnhold            string
	ChannelUserevent         string
	ChannelVarset            string
	ContactInfo              string
	ContactStatusChange      string
	DeviceStateChanged       string
	Dial                     string
	EndpointStateChange      string
	MissingParams            string
	Peer                     string
	PeerStatusChange         string
	PlaybackContinuing       string
	PlaybackFinished         string
	PlaybackStarted          string
	RecordingFailed          string
	RecordingFinished        string
	RecordingStarted         string
	StasisEnd                string
	StasisStart              string
	TextMessageReceived      string
}

EventTypes enumerates the list of event types

var Events EventTypes

Events is the instance for grabbing event types

type FormatLangPair

type FormatLangPair struct {
	Format   string `json:"format"`
	Language string `json:"language"`
}

FormatLangPair describes the format and language of a sound file

type Header map[string][]string

Header represents a set of key-value pairs to store transport-related metadata on Events

func (Header) Add

func (h Header) Add(key, val string)

Add appens the value to the list of values for the given header key.

func (Header) Del

func (h Header) Del(key string)

Del deletes the values associated with the given header key.

func (Header) Get

func (h Header) Get(key string) string

Get returns the first value associated with the given header key.

func (Header) Set

func (h Header) Set(key, val string)

Set sets the value for the given header key, replacing any existing values.

type Key

type Key struct {
	// Kind indicates the type of resource the Key points to.  e.g., "channel",
	// "bridge", etc.
	Kind string `protobuf:"bytes,1,opt,name=kind,proto3" json:"kind,omitempty"`
	// ID indicates the unique identifier of the resource
	ID string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	// Node indicates the unique identifier of the Asterisk node on which the
	// resource exists or will be created
	Node string `protobuf:"bytes,3,opt,name=node,proto3" json:"node,omitempty"`
	// Dialog indicates a named scope of the resource, for receiving events
	Dialog string `protobuf:"bytes,4,opt,name=dialog,proto3" json:"dialog,omitempty"`
	// App indiciates the ARI application that this key is bound to.
	App string `protobuf:"bytes,5,opt,name=app,proto3" json:"app,omitempty"`
}

Key identifies a unique resource in the system

func AppKey

func AppKey(app string) *Key

AppKey returns a key that is bound to the given application.

func DialogKey

func DialogKey(dialog string) *Key

DialogKey returns a key that is bound to the given dialog.

func KindKey

func KindKey(kind string, opts ...KeyOptionFunc) *Key

KindKey returns a key that is bound by a type only

func NewEndpointKey

func NewEndpointKey(tech, resource string, opts ...KeyOptionFunc) *Key

NewEndpointKey returns the key for the given endpoint

func NewKey

func NewKey(kind string, id string, opts ...KeyOptionFunc) *Key

NewKey builds a new key given the kind, identifier, and any optional arguments.

func NodeKey

func NodeKey(app, node string) *Key

NodeKey returns a key that is bound to the given application and node

func (*Key) Descriptor

func (*Key) Descriptor() ([]byte, []int)

func (*Key) GetApp

func (m *Key) GetApp() string

func (*Key) GetDialog

func (m *Key) GetDialog() string

func (*Key) GetID

func (m *Key) GetID() string

func (*Key) GetKind

func (m *Key) GetKind() string

func (*Key) GetNode

func (m *Key) GetNode() string

func (*Key) Marshal

func (m *Key) Marshal() (dAtA []byte, err error)

func (*Key) MarshalTo

func (m *Key) MarshalTo(dAtA []byte) (int, error)

func (*Key) Match

func (k *Key) Match(o *Key) bool

Match returns true if the given key matches the subject. Empty partial key fields are wildcards.

func (*Key) New

func (k *Key) New(kind, id string) *Key

New returns a new key with the location information from the source key. This includes the App, the Node, and the Dialog. the `kind` and `id` parameters are optional. If kind is empty, the resulting key will not be typed. If id is empty, the key will not be unique.

func (*Key) ProtoMessage

func (*Key) ProtoMessage()

func (*Key) Reset

func (m *Key) Reset()

func (*Key) Size

func (m *Key) Size() (n int)

func (*Key) String

func (k *Key) String() string

func (*Key) Unmarshal

func (m *Key) Unmarshal(dAtA []byte) error

type KeyOptionFunc

type KeyOptionFunc func(Key) Key

KeyOptionFunc is a functional argument alias for providing options for ARI keys

func WithApp

func WithApp(app string) KeyOptionFunc

WithApp sets the given node identifier on the key.

func WithDialog

func WithDialog(dialog string) KeyOptionFunc

WithDialog sets the given dialog identifier on the key.

func WithLocationOf

func WithLocationOf(ref *Key) KeyOptionFunc

WithLocationOf copies the partial key fields Node, Application, Dialog from the reference key

func WithNode

func WithNode(node string) KeyOptionFunc

WithNode sets the given node identifier on the key.

type Keys

type Keys []*Key

Keys is a list of keys

func (Keys) Bridges

func (kx Keys) Bridges() Keys

Bridges returns just the bridge keys from a set of Keys

func (Keys) Channels

func (kx Keys) Channels() Keys

Channels returns just the channel keys from a set of Keys

func (Keys) Filter

func (kx Keys) Filter(mx ...Matcher) (ret Keys)

Filter filters the key list using the given key type match

func (Keys) First

func (kx Keys) First() *Key

First returns the first key from a list of keys. It is safe to use on empty lists, in which case, it will return nil.

func (Keys) ID

func (kx Keys) ID(id string) *Key

ID returns the key from a set of keys with ID matching the given ID. If the key does not exist in the set, nil is returned.

func (Keys) Without

func (kx Keys) Without(m Matcher) (ret Keys)

Without removes keys that match the given matcher

type LiveRecording

type LiveRecording interface {

	// Get gets the Recording by type
	Get(key *Key) *LiveRecordingHandle

	// Data gets the data for the live recording
	Data(key *Key) (*LiveRecordingData, error)

	// Stop stops the live recording
	Stop(key *Key) error

	// Pause pauses the live recording
	Pause(key *Key) error

	// Resume resumes the live recording
	Resume(key *Key) error

	// Mute mutes the live recording
	Mute(key *Key) error

	// Unmute unmutes the live recording
	Unmute(key *Key) error

	// Scrap Stops and deletes the current LiveRecording
	Scrap(key *Key) error

	// Stored returns the StoredRecording handle for this LiveRecording
	Stored(key *Key) *StoredRecordingHandle

	// Subscribe subscribes to events
	Subscribe(key *Key, n ...string) Subscription
}

LiveRecording represents a communication path interacting with an Asterisk server for live recording resources

type LiveRecordingData

type LiveRecordingData struct {
	// Key is the cluster-unique identifier for this live recording
	Key *Key `json:"key"`

	Cause     string      `json:"cause,omitempty"`            // If failed, the cause of the failure
	Duration  DurationSec `json:"duration,omitempty"`         // Length of recording in seconds
	Format    string      `json:"format"`                     // Format of recording (wav, gsm, etc)
	Name      string      `json:"name"`                       // (base) name for the recording
	Silence   DurationSec `json:"silence_duration,omitempty"` // If silence was detected in the recording, the duration in seconds of that silence (requires that maxSilenceSeconds be non-zero)
	State     string      `json:"state"`                      // Current state of the recording
	Talking   DurationSec `json:"talking_duration,omitempty"` // Duration of talking, in seconds, that has been detected in the recording (requires that maxSilenceSeconds be non-zero)
	TargetURI string      `json:"target_uri"`                 // URI for the channel or bridge which is being recorded (TODO: figure out format for this)
}

LiveRecordingData is the data for a live recording

func (*LiveRecordingData) ID

func (s *LiveRecordingData) ID() string

ID returns the identifier of the live recording

type LiveRecordingHandle

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

A LiveRecordingHandle is a reference to a live recording that can be operated on

func NewLiveRecordingHandle

func NewLiveRecordingHandle(key *Key, r LiveRecording, exec func(*LiveRecordingHandle) (err error)) *LiveRecordingHandle

NewLiveRecordingHandle creates a new live recording handle

func (*LiveRecordingHandle) Data

Data gets the data for the live recording

func (*LiveRecordingHandle) Exec

func (h *LiveRecordingHandle) Exec() (err error)

Exec executes any staged operations attached to the `LiveRecordingHandle`

func (*LiveRecordingHandle) ID

func (h *LiveRecordingHandle) ID() string

ID returns the identifier of the live recording

func (*LiveRecordingHandle) Key

func (h *LiveRecordingHandle) Key() *Key

Key returns the key of the live recording

func (*LiveRecordingHandle) Mute

func (h *LiveRecordingHandle) Mute() error

Mute mutes the recording

func (*LiveRecordingHandle) Pause

func (h *LiveRecordingHandle) Pause() error

Pause pauses the recording

func (*LiveRecordingHandle) Resume

func (h *LiveRecordingHandle) Resume() error

Resume resumes the recording

func (*LiveRecordingHandle) Scrap

func (h *LiveRecordingHandle) Scrap() error

Scrap stops and deletes the recording

func (*LiveRecordingHandle) Stop

func (h *LiveRecordingHandle) Stop() error

Stop stops and saves the recording

func (*LiveRecordingHandle) Stored

Stored returns the StoredRecordingHandle for this LiveRecordingHandle

func (*LiveRecordingHandle) Subscribe

func (h *LiveRecordingHandle) Subscribe(n ...string) Subscription

Subscribe subscribes the recording handle's underlying recorder to the provided event types.

func (*LiveRecordingHandle) Unmute

func (h *LiveRecordingHandle) Unmute() error

Unmute mutes the recording

type LogData

type LogData struct {
	// Key is the cluster-unique identifier for this logging channel
	Key *Key `json:"key"`

	// Name is the name of the logging channel
	Name string `json:"channel"`

	// Levels is a comma-separated list of logging levels for this channel
	Levels string `json:"levels"`

	// Type indicates the type of logs for this channel
	Types string `json:"types"`

	// Status indicates whether this logging channel is enabled
	Status string `json:"status"`
}

LogData represents the log data

type LogHandle

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

LogHandle provides an interface to manipulate a logging channel

func NewLogHandle

func NewLogHandle(key *Key, l Logging) *LogHandle

NewLogHandle builds a new log handle given the `Key` and `Logging“ client

func (*LogHandle) Data

func (l *LogHandle) Data() (*LogData, error)

Data returns the data for the logging channel

func (*LogHandle) Delete

func (l *LogHandle) Delete() error

Delete removes the logging channel from Asterisk

func (*LogHandle) ID

func (l *LogHandle) ID() string

ID returns the ID (name) of the logging channel

func (*LogHandle) Key

func (l *LogHandle) Key() *Key

Key returns the Key of the logging channel

func (*LogHandle) Rotate

func (l *LogHandle) Rotate() error

Rotate causes the logging channel's logfiles to be rotated

type Logging

type Logging interface {

	// Create creates a new log.  The levels are a comma-separated list of
	// logging levels on which this channel should operate.  The name of the
	// channel should be the key's ID.
	Create(key *Key, levels string) (*LogHandle, error)

	// Data retrives the data for a logging channel
	Data(key *Key) (*LogData, error)

	// Data retrives the data for a logging channel
	Get(key *Key) *LogHandle

	// List the logs
	List(filter *Key) ([]*Key, error)

	// Rotate rotates the log
	Rotate(key *Key) error

	// Delete deletes the log
	Delete(key *Key) error
}

Logging represents a communication path to an Asterisk server for working with logging resources

type Mailbox

type Mailbox interface {

	// Get gets a handle to the mailbox for further operations
	Get(key *Key) *MailboxHandle

	// List lists the mailboxes in asterisk
	List(filter *Key) ([]*Key, error)

	// Data gets the current state of the mailbox
	Data(key *Key) (*MailboxData, error)

	// Update updates the state of the mailbox, or creates if does not exist
	Update(key *Key, oldMessages int, newMessages int) error

	// Delete deletes the mailbox
	Delete(key *Key) error
}

Mailbox is the communication path to an Asterisk server for operating on mailbox resources

type MailboxData

type MailboxData struct {
	// Key is the cluster-unique identifier for this mailbox
	Key *Key `json:"key"`

	Name        string `json:"name"`
	NewMessages int    `json:"new_messages"` // Number of new (unread) messages
	OldMessages int    `json:"old_messages"` // Number of old (read) messages
}

MailboxData respresents the state of an Asterisk (voice) mailbox

type MailboxHandle

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

A MailboxHandle is a handle to a mailbox instance attached to an ari transport

func NewMailboxHandle

func NewMailboxHandle(key *Key, m Mailbox) *MailboxHandle

NewMailboxHandle creates a new mailbox handle given the name and mailbox transport

func (*MailboxHandle) Data

func (mh *MailboxHandle) Data() (*MailboxData, error)

Data gets the current state of the mailbox

func (*MailboxHandle) Delete

func (mh *MailboxHandle) Delete() error

Delete deletes the mailbox

func (*MailboxHandle) ID

func (mh *MailboxHandle) ID() string

ID returns the identifier for the mailbox handle

func (*MailboxHandle) Key

func (mh *MailboxHandle) Key() *Key

Key returns the key for the mailbox handle

func (*MailboxHandle) Update

func (mh *MailboxHandle) Update(oldMessages int, newMessages int) error

Update updates the state of the mailbox, or creates if does not exist

type MatchFunc

type MatchFunc func(*Key) bool

MatchFunc is the functional type alias for providing functional `Matcher` implementations

func (MatchFunc) Match

func (mf MatchFunc) Match(o *Key) bool

Match invokes the match function given the key

type Matcher

type Matcher interface {
	Match(o *Key) bool
}

A Matcher provides the functionality for matching against a key.

type Message

type Message struct {
	Type string `json:"type"`
}

Message is the first extension of the RawMessage type, containing only a Type

type MissingParams

type MissingParams struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Params []string `json:"params"` // A list of the missing parameters
}

MissingParams - "Error event sent when required params are missing."

func (*MissingParams) Keys

func (evt *MissingParams) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type ModuleData

type ModuleData struct {
	// Key is the cluster-unique identifier for this module
	Key *Key `json:"key"`

	Name         string `json:"name"`
	Description  string `json:"description"`
	SupportLevel string `json:"support_level"`
	UseCount     int    `json:"use_count"`
	Status       string `json:"status"`
}

ModuleData is the data for an asterisk module

type ModuleHandle

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

ModuleHandle is the reference to an asterisk module

func NewModuleHandle

func NewModuleHandle(key *Key, m Modules) *ModuleHandle

NewModuleHandle returns a new module handle

func (*ModuleHandle) Data

func (mh *ModuleHandle) Data() (*ModuleData, error)

Data gets the module data

func (*ModuleHandle) ID

func (mh *ModuleHandle) ID() string

ID returns the identifier for the module

func (*ModuleHandle) Key

func (mh *ModuleHandle) Key() *Key

Key returns the key for the module

func (*ModuleHandle) Load

func (mh *ModuleHandle) Load() error

Load loads the module

func (*ModuleHandle) Reload

func (mh *ModuleHandle) Reload() error

Reload reloads the module

func (*ModuleHandle) Unload

func (mh *ModuleHandle) Unload() error

Unload unloads the module

type Modules

type Modules interface {
	Get(key *Key) *ModuleHandle

	List(filter *Key) ([]*Key, error)

	Load(key *Key) error

	Reload(key *Key) error

	Unload(key *Key) error

	Data(key *Key) (*ModuleData, error)
}

Modules is the communication path for interacting with the asterisk modules resource

type OriginateRequest

type OriginateRequest struct {
	Endpoint string `json:"endpoint"`           // Endpoint to use (tech/resource notation)
	Timeout  int    `json:"timeout,omitempty"`  // Dial Timeout in seconds (-1 = no limit)
	CallerID string `json:"callerId,omitempty"` // CallerID to set for outgoing call

	// One set of:
	Context   string `json:"context,omitempty"` // Drop the channel into the dialplan
	Extension string `json:"extension,omitempty"`
	Priority  int64  `json:"priority,omitempty"`
	// OR
	App     string `json:"app,omitempty"`     // Associate channel to Stasis (Ari) application
	AppArgs string `json:"appArgs,omitempty"` // Arguments to the application

	//  The label to dial after the endpoint answers.
	// Will supersede 'priority' if provided. Mutually exclusive with 'app'.
	Label string `json:"label,omitempty"`

	// The format name capability list to use if originator is not specified.
	// Ex. "ulaw,slin16". Format names can be found with "core show codecs".
	Formats string `json:"formats,omitempty"` //

	// Channel ID declarations
	ChannelID      string `json:"channelId,omitempty"`      // Optionally assign channel id
	OtherChannelID string `json:"otherChannelId,omitempty"` // Optionally assign second channel's id (only for local channels)

	// Originator is the channel for whom this Originate request is being made, if there is one.
	// It is used by Asterisk to set the right codecs (and possibly other parameters) such that
	// when the new channel is bridged to the Originator channel, there should be no transcoding.
	// This is a purely optional (but helpful, where applicable) field.
	Originator string `json:"originator,omitempty"`

	// Variables describes the set of channel variables to apply to the new channel
	Variables map[string]string `json:"variables,omitempty"`
}

OriginateRequest is the basic structure for all channel creation methods

type Peer

type Peer struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Address    string `json:"address,omitempty"` // The IP address of the peer.
	Cause      string `json:"cause,omitempty"`   // An optional reason associated with the change in peer_status.
	PeerStatus string `json:"peer_status"`       // The current state of the peer. Note that the values of the status are dependent on the underlying peer technology.
	Port       string `json:"port,omitempty"`    // The port of the peer.
	Time       string `json:"time,omitempty"`    // The last known time the peer was contacted.
}

Peer - "Detailed information about a remote peer that communicates with Asterisk."

func (*Peer) Keys

func (evt *Peer) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type PeerStatusChange

type PeerStatusChange struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Endpoint EndpointData `json:"endpoint"`
	Peer     Peer         `json:"peer"`
}

PeerStatusChange - "The state of a peer associated with an endpoint has changed."

func (*PeerStatusChange) GetEndpointIDs

func (evt *PeerStatusChange) GetEndpointIDs() (sx []string)

GetEndpointIDs gets the endpoint IDs for the event

func (*PeerStatusChange) Keys

func (evt *PeerStatusChange) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type Playback

type Playback interface {

	// Get gets the handle to the given playback ID
	Get(key *Key) *PlaybackHandle

	// Data gets the playback data
	Data(key *Key) (*PlaybackData, error)

	// Control performs the given operation on the current playback.  Available operations are:
	//   - restart
	//   - pause
	//   - unpause
	//   - reverse
	//   - forward
	Control(key *Key, op string) error

	// Stop stops the playback
	Stop(key *Key) error

	// Subscribe subscribes on the playback events
	Subscribe(key *Key, n ...string) Subscription
}

Playback represents a communication path for interacting with an Asterisk server for playback resources

type PlaybackContinuing

type PlaybackContinuing struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Playback PlaybackData `json:"playback"` // Playback control object
}

PlaybackContinuing - "Event showing the continuation of a media playback operation from one media URI to the next in the list."

func (*PlaybackContinuing) GetBridgeIDs

func (evt *PlaybackContinuing) GetBridgeIDs() (sx []string)

GetBridgeIDs gets the bridge IDs for the event

func (*PlaybackContinuing) GetChannelIDs

func (evt *PlaybackContinuing) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*PlaybackContinuing) GetPlaybackIDs

func (evt *PlaybackContinuing) GetPlaybackIDs() (sx []string)

GetPlaybackIDs gets the playback IDs for the event

func (*PlaybackContinuing) Keys

func (evt *PlaybackContinuing) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type PlaybackData

type PlaybackData struct {
	// Key is the cluster-unique identifier for this playback
	Key *Key `json:"key"`

	ID        string `json:"id"` // Unique ID for this playback session
	Language  string `json:"language,omitempty"`
	MediaURI  string `json:"media_uri"`  // URI for the media which is to be played
	State     string `json:"state"`      // State of the playback operation
	TargetURI string `json:"target_uri"` // URI of the channel or bridge on which the media should be played (follows format of 'type':'name')
}

PlaybackData represents the state of a playback

type PlaybackFinished

type PlaybackFinished struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Playback PlaybackData `json:"playback"` // Playback control object
}

PlaybackFinished - "Event showing the completion of a media playback operation."

func (*PlaybackFinished) Destroyed

func (evt *PlaybackFinished) Destroyed() (playbackID string)

Destroyed returns the playbacK ID that was finished by this event. Used by the proxy to route events to dialogs.

func (*PlaybackFinished) GetBridgeIDs

func (evt *PlaybackFinished) GetBridgeIDs() (sx []string)

GetBridgeIDs gets the bridge IDs for the event

func (*PlaybackFinished) GetChannelIDs

func (evt *PlaybackFinished) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*PlaybackFinished) GetPlaybackIDs

func (evt *PlaybackFinished) GetPlaybackIDs() (sx []string)

GetPlaybackIDs gets the playback IDs for the event

func (*PlaybackFinished) Keys

func (evt *PlaybackFinished) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type PlaybackHandle

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

PlaybackHandle is the handle for performing playback operations

func NewPlaybackHandle

func NewPlaybackHandle(key *Key, pb Playback, exec func(pb *PlaybackHandle) error) *PlaybackHandle

NewPlaybackHandle builds a handle to the playback id

func (*PlaybackHandle) Control

func (ph *PlaybackHandle) Control(op string) error

Control performs the given operation

func (*PlaybackHandle) Data

func (ph *PlaybackHandle) Data() (*PlaybackData, error)

Data gets the playback data

func (*PlaybackHandle) Exec

func (ph *PlaybackHandle) Exec() (err error)

Exec executes any staged operations

func (*PlaybackHandle) ID

func (ph *PlaybackHandle) ID() string

ID returns the identifier for the playback

func (*PlaybackHandle) Key

func (ph *PlaybackHandle) Key() *Key

Key returns the Key for the playback

func (*PlaybackHandle) Stop

func (ph *PlaybackHandle) Stop() error

Stop stops the playback

func (*PlaybackHandle) Subscribe

func (ph *PlaybackHandle) Subscribe(n ...string) Subscription

Subscribe subscribes the list of channel events

type PlaybackStarted

type PlaybackStarted struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Playback PlaybackData `json:"playback"` // Playback control object
}

PlaybackStarted - "Event showing the start of a media playback operation."

func (*PlaybackStarted) Created

func (evt *PlaybackStarted) Created() (playbackID, otherID string)

Created returns the playbacK ID that we created plus the ID that the playback is operating on (a bridge or channel). Used by the proxy to route events to dialogs

func (*PlaybackStarted) GetBridgeIDs

func (evt *PlaybackStarted) GetBridgeIDs() (sx []string)

GetBridgeIDs gets the bridge IDs for the event

func (*PlaybackStarted) GetChannelIDs

func (evt *PlaybackStarted) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*PlaybackStarted) GetPlaybackIDs

func (evt *PlaybackStarted) GetPlaybackIDs() (sx []string)

GetPlaybackIDs gets the playback IDs for the event

func (*PlaybackStarted) Keys

func (evt *PlaybackStarted) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type Player

type Player interface {
	// Play plays the audio using the given playback ID and media URI
	Play(string, string) (*PlaybackHandle, error)

	// StagePlay stages a `Play` operation
	StagePlay(string, string) (*PlaybackHandle, error)

	// Subscribe subscribes the player to events
	Subscribe(n ...string) Subscription
}

A Player is an entity which can play an audio URI

type Recorder

type Recorder interface {
	// Record starts a recording, using the provided options, and returning a handle for the live recording
	Record(string, *RecordingOptions) (*LiveRecordingHandle, error)

	// StageRecord stages a recording, using the provided options, and returning a handle for the live recording.  The recording will actually be started only when Exec() is called.
	StageRecord(string, *RecordingOptions) (*LiveRecordingHandle, error)

	// Subscribe subscribes to events from the Recorder
	Subscribe(n ...string) Subscription
}

Recorder describes an interface of something which can Record

type Recording

type Recording struct {
	Stored StoredRecording
	Live   LiveRecording
}

Recording is a namespace for the recording types

type RecordingFailed

type RecordingFailed struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Recording LiveRecordingData `json:"recording"` // Recording control object
}

RecordingFailed - "Event showing failure of a recording operation."

func (*RecordingFailed) Destroyed

func (evt *RecordingFailed) Destroyed() string

Destroyed returns the item that gets destroyed by this event

func (*RecordingFailed) GetBridgeIDs

func (evt *RecordingFailed) GetBridgeIDs() (sx []string)

GetBridgeIDs gets the bridge IDs for the event

func (*RecordingFailed) GetChannelIDs

func (evt *RecordingFailed) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*RecordingFailed) GetRecordingIDs

func (evt *RecordingFailed) GetRecordingIDs() (sx []string)

GetRecordingIDs gets the recording IDs for the event

func (*RecordingFailed) Keys

func (evt *RecordingFailed) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type RecordingFinished

type RecordingFinished struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Recording LiveRecordingData `json:"recording"` // Recording control object
}

RecordingFinished - "Event showing the completion of a recording operation."

func (*RecordingFinished) Destroyed

func (evt *RecordingFinished) Destroyed() string

Destroyed returns the item that gets destroyed by this event

func (*RecordingFinished) GetBridgeIDs

func (evt *RecordingFinished) GetBridgeIDs() (sx []string)

GetBridgeIDs gets the bridge IDs for the event

func (*RecordingFinished) GetChannelIDs

func (evt *RecordingFinished) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*RecordingFinished) GetRecordingIDs

func (evt *RecordingFinished) GetRecordingIDs() (sx []string)

GetRecordingIDs gets the recording IDs for the event

func (*RecordingFinished) Keys

func (evt *RecordingFinished) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type RecordingOptions

type RecordingOptions struct {
	// Format is the file format/encoding to which the recording should be stored.
	// This will usually be one of: slin, ulaw, alaw, wav, gsm.
	// If not specified, this will default to slin.
	Format string

	// MaxDuration is the maximum duration of the recording, after which the recording will
	// automatically stop.  If not set, there is no maximum.
	MaxDuration time.Duration

	// MaxSilence is the maximum duration of detected to be found before terminating the recording.
	MaxSilence time.Duration

	// Exists determines what should happen if the given recording already exists.
	// Valid values are: "fail", "overwrite", or "append".
	// If not specified, it will default to "fail"
	Exists string

	// Beep indicates whether a beep should be played to the recorded
	// party at the beginning of the recording.
	Beep bool

	// Terminate indicates whether the recording should be terminated on
	// receipt of a DTMF digit.
	// valid options are: "none", "any", "*", and "#"
	// If not specified, it will default to "none" (never terminate on DTMF).
	Terminate string
}

RecordingOptions describes the set of options available when making a recording.

type RecordingStarted

type RecordingStarted struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Recording LiveRecordingData `json:"recording"` // Recording control object
}

RecordingStarted - "Event showing the start of a recording operation."

func (*RecordingStarted) GetBridgeIDs

func (evt *RecordingStarted) GetBridgeIDs() (sx []string)

GetBridgeIDs gets the bridge IDs for the event

func (*RecordingStarted) GetChannelIDs

func (evt *RecordingStarted) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*RecordingStarted) GetRecordingIDs

func (evt *RecordingStarted) GetRecordingIDs() (sx []string)

GetRecordingIDs gets the recording IDs for the event

func (*RecordingStarted) Keys

func (evt *RecordingStarted) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type Sender

type Sender interface {
	Send(e Event)
}

A Sender is an entity which can send event bus messages

type SetID

type SetID struct {
	Group string `json:"group"` // group id (not name? why string?)
	User  string `json:"user"`  // user id (not name? why string?)
}

SetID describes a userid/groupid pair

type SnoopOptions

type SnoopOptions struct {
	// App is the ARI application into which the newly-created Snoop channel should be dropped.
	App string `json:"app"`

	// AppArgs is the set of arguments to pass with the newly-created Snoop channel's entry into ARI.
	AppArgs string `json:"appArgs,omitempty"`

	// Spy describes the direction of audio on which to spy (none, in, out, both).
	// The default is 'none'.
	Spy Direction `json:"spy,omitempty"`

	// Whisper describes the direction of audio on which to send (none, in, out, both).
	// The default is 'none'.
	Whisper Direction `json:"whisper,omitempty"`
}

SnoopOptions enumerates the non-required arguments for the snoop operation

type Sound

type Sound interface {

	// List returns available sounds limited by the provided filters.
	// Valid filters are "lang", "format", and nil (no filter)
	List(filters map[string]string, keyFilter *Key) ([]*Key, error)

	// Data returns the Sound's data
	Data(key *Key) (*SoundData, error)
}

Sound represents a communication path to the asterisk server for Sound resources

type SoundData

type SoundData struct {
	// Key is the cluster-unique identifier for this sound
	Key *Key `json:"key"`

	Formats []FormatLangPair `json:"formats"`
	ID      string           `json:"id"`
	Text    string           `json:"text,omitempty"`
}

SoundData describes a media file which may be played back

type StasisEnd

type StasisEnd struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Channel ChannelData `json:"channel"`
}

StasisEnd - "Notification that a channel has left a Stasis application."

func (*StasisEnd) GetChannelIDs

func (evt *StasisEnd) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*StasisEnd) Keys

func (evt *StasisEnd) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type StasisStart

type StasisStart struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Args           []string    `json:"args"` // Arguments to the application
	Channel        ChannelData `json:"channel"`
	ReplaceChannel ChannelData `json:"replace_channel,omitempty"`
}

StasisStart - "Notification that a channel has entered a Stasis application."

func (*StasisStart) GetChannelIDs

func (evt *StasisStart) GetChannelIDs() (sx []string)

GetChannelIDs gets the channel IDs for the event

func (*StasisStart) Keys

func (evt *StasisStart) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type StatusInfo

type StatusInfo struct {
	LastReloadTime DateTime `json:"last_reload_time"`
	StartupTime    DateTime `json:"startup_time"`
}

StatusInfo describes the state of an Asterisk system

type StoredRecording

type StoredRecording interface {

	// List lists the recordings
	List(filter *Key) ([]*Key, error)

	// Get gets the Recording by type
	Get(key *Key) *StoredRecordingHandle

	// data gets the data for the stored recording
	Data(key *Key) (*StoredRecordingData, error)

	// Copy copies the recording to the destination name
	//
	// NOTE: because ARI offers no forced-copy, Copy should always return the
	// StoredRecordingHandle of the destination, even if the Copy fails.  Doing so
	// allows the user to Delete the existing StoredRecording before retrying.
	Copy(key *Key, dest string) (*StoredRecordingHandle, error)

	// Delete deletes the recording
	Delete(key *Key) error
}

StoredRecording represents a communication path interacting with an Asterisk server for stored recording resources

type StoredRecordingData

type StoredRecordingData struct {
	// Key is the cluster-unique identifier for this stored recording
	Key *Key `json:"key"`

	Format string `json:"format"`
	Name   string `json:"name"`
}

StoredRecordingData is the data for a stored recording

func (StoredRecordingData) ID

func (d StoredRecordingData) ID() string

ID returns the identifier for the stored recording.

type StoredRecordingHandle

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

A StoredRecordingHandle is a reference to a stored recording that can be operated on

func NewStoredRecordingHandle

func NewStoredRecordingHandle(key *Key, s StoredRecording, exec func(a *StoredRecordingHandle) error) *StoredRecordingHandle

NewStoredRecordingHandle creates a new stored recording handle

func (*StoredRecordingHandle) Copy

Copy copies the stored recording.

NOTE: because ARI offers no forced-copy, this should always return the StoredRecordingHandle of the destination, even if the Copy fails. Doing so allows the user to Delete the existing StoredRecording before retrying.

func (*StoredRecordingHandle) Data

Data gets the data for the stored recording

func (*StoredRecordingHandle) Delete

func (s *StoredRecordingHandle) Delete() error

Delete deletes the recording

func (*StoredRecordingHandle) Exec

func (s *StoredRecordingHandle) Exec() (err error)

Exec executes any staged operations

func (*StoredRecordingHandle) ID

func (s *StoredRecordingHandle) ID() string

ID returns the identifier for the stored recording

func (*StoredRecordingHandle) Key

func (s *StoredRecordingHandle) Key() *Key

Key returns the Key for the stored recording

type Subscriber

type Subscriber interface {
	Subscribe(key *Key, n ...string) Subscription
}

A Subscriber is an entity which can create ARI event subscriptions

type Subscription

type Subscription interface {
	// Events returns a channel on which events related to this subscription are sent.
	Events() <-chan Event

	// Cancel terminates the subscription
	Cancel()
}

A Subscription is a subscription on series of ARI events

type SystemInfo

type SystemInfo struct {
	EntityID string `json:"entity_id"`
	Version  string `json:"version"`
}

SystemInfo describes information about the Asterisk system

type TextMessage

type TextMessage interface {

	// Send() sends a text message to an endpoint
	Send(from, tech, resource, body string, vars map[string]string) error

	// SendByURI sends a text message to an endpoint by free-form URI
	SendByURI(from, to, body string, vars map[string]string) error
}

TextMessage needs some verbiage here

type TextMessageData

type TextMessageData struct {
	// Key is the cluster-unique identifier for this text message
	Key *Key `json:"key"`

	Body      string                `json:"body"` // The body (text) of the message
	From      string                `json:"from"` // Technology-specific source URI
	To        string                `json:"to"`   // Technology-specific destination URI
	Variables []TextMessageVariable `json:"variables,omitempty"`
}

TextMessageData describes text message

type TextMessageReceived

type TextMessageReceived struct {
	EventData `json:",inline"`

	// Header describes any transport-related metadata
	Header Header `json:"-"`

	Endpoint EndpointData    `json:"endpoint,omitempty"`
	Message  TextMessageData `json:"message"`
}

TextMessageReceived - "A text message was received from an endpoint."

func (*TextMessageReceived) GetEndpointIDs

func (evt *TextMessageReceived) GetEndpointIDs() (sx []string)

GetEndpointIDs gets the bridge IDs for the event

func (*TextMessageReceived) Keys

func (evt *TextMessageReceived) Keys() (sx Keys)

Keys returns the list of keys associated with this event

type TextMessageVariable

type TextMessageVariable struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

TextMessageVariable describes a key-value pair (associated with a text message)

Directories

Path Synopsis
_examples
client
ext
audiouri
Package audiouri provides conversions for common sounds to asterisk-supported audio URIs
Package audiouri provides conversions for common sounds to asterisk-supported audio URIs
play
Package play provides a set of tools for feature-rich audio playbacks and IVR primitives.
Package play provides a set of tools for feature-rich audio playbacks and IVR primitives.
internal

Jump to

Keyboard shortcuts

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