Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigID(class, kind, id string) string
- func EndpointID(tech, resource string) string
- func FromEndpointID(id string) (tech string, resource string, err error)
- func Once(ctx context.Context, bus Bus, key *Key, eTypes ...string) <-chan Event
- func ParseConfigID(input string) (class, kind, id string, err error)
- type Application
- type ApplicationData
- type ApplicationHandle
- func (ah *ApplicationHandle) Data() (ad *ApplicationData, err error)
- func (ah *ApplicationHandle) ID() string
- func (ah *ApplicationHandle) Key() *Key
- func (ah *ApplicationHandle) Match(e Event) bool
- func (ah *ApplicationHandle) Subscribe(eventSource string) (err error)
- func (ah *ApplicationHandle) Unsubscribe(eventSource string) (err error)
- type ApplicationReplaced
- type Asterisk
- type AsteriskInfo
- type AsteriskVariables
- type Bridge
- type BridgeAttendedTransfer
- type BridgeBlindTransfer
- type BridgeCreated
- type BridgeData
- type BridgeDestroyed
- type BridgeHandle
- func (bh *BridgeHandle) AddChannel(channelID string) error
- func (bh *BridgeHandle) Data() (*BridgeData, error)
- func (bh *BridgeHandle) Delete() (err error)
- func (bh *BridgeHandle) Exec() error
- func (bh *BridgeHandle) ID() string
- func (bh *BridgeHandle) Key() *Key
- func (bh *BridgeHandle) Play(id string, mediaURI string) (*PlaybackHandle, error)
- func (bh *BridgeHandle) Record(name string, opts *RecordingOptions) (*LiveRecordingHandle, error)
- func (bh *BridgeHandle) RemoveChannel(channelID string) error
- func (bh *BridgeHandle) StagePlay(id string, mediaURI string) (*PlaybackHandle, error)
- func (bh *BridgeHandle) StageRecord(name string, opts *RecordingOptions) (*LiveRecordingHandle, error)
- func (bh *BridgeHandle) Subscribe(n ...string) Subscription
- type BridgeMerged
- type BridgeVideoSourceChanged
- type BuildInfo
- type Bus
- type CallerID
- type Channel
- type ChannelCallerID
- type ChannelConnectedLine
- type ChannelCreateRequest
- type ChannelCreated
- type ChannelData
- type ChannelDestroyed
- type ChannelDialplan
- type ChannelDtmfReceived
- type ChannelEnteredBridge
- type ChannelHandle
- func (ch *ChannelHandle) Answer() error
- func (ch *ChannelHandle) Busy() error
- func (ch *ChannelHandle) Congestion() error
- func (ch *ChannelHandle) Continue(context, extension string, priority int) error
- func (ch *ChannelHandle) Create(req ChannelCreateRequest) (*ChannelHandle, error)
- func (ch *ChannelHandle) Data() (*ChannelData, error)
- func (ch *ChannelHandle) Dial(caller string, timeout time.Duration) error
- func (ch *ChannelHandle) Exec() (err error)
- func (ch *ChannelHandle) GetVariable(name string) (string, error)
- func (ch *ChannelHandle) Hangup() error
- func (ch *ChannelHandle) Hold() error
- func (ch *ChannelHandle) ID() string
- func (ch *ChannelHandle) IsAnswered() (bool, error)
- func (ch *ChannelHandle) Key() *Key
- func (ch *ChannelHandle) MOH(mohClass string) error
- func (ch *ChannelHandle) Mute(dir Direction) (err error)
- func (ch *ChannelHandle) Originate(req OriginateRequest) (*ChannelHandle, error)
- func (ch *ChannelHandle) Play(id string, mediaURI string) (ph *PlaybackHandle, err error)
- func (ch *ChannelHandle) Record(name string, opts *RecordingOptions) (*LiveRecordingHandle, error)
- func (ch *ChannelHandle) Ring() error
- func (ch *ChannelHandle) SendDTMF(dtmf string, opts *DTMFOptions) error
- func (ch *ChannelHandle) SetVariable(name, value string) error
- func (ch *ChannelHandle) Silence() error
- func (ch *ChannelHandle) Snoop(snoopID string, opts *SnoopOptions) (*ChannelHandle, error)
- func (ch *ChannelHandle) StageOriginate(req OriginateRequest) (*ChannelHandle, error)
- func (ch *ChannelHandle) StagePlay(id string, mediaURI string) (*PlaybackHandle, error)
- func (ch *ChannelHandle) StageRecord(name string, opts *RecordingOptions) (*LiveRecordingHandle, error)
- func (ch *ChannelHandle) StageSnoop(snoopID string, opts *SnoopOptions) (*ChannelHandle, error)
- func (ch *ChannelHandle) StopHold() error
- func (ch *ChannelHandle) StopMOH() error
- func (ch *ChannelHandle) StopRing() error
- func (ch *ChannelHandle) StopSilence() error
- func (ch *ChannelHandle) Subscribe(n ...string) Subscription
- func (ch *ChannelHandle) Unmute(dir Direction) (err error)
- type ChannelHangupRequest
- type ChannelHold
- type ChannelLeftBridge
- type ChannelStateChange
- type ChannelTalkingFinished
- type ChannelTalkingStarted
- type ChannelUnhold
- type ChannelUserevent
- type ChannelVarset
- type Client
- type Config
- type ConfigData
- type ConfigHandle
- type ConfigInfo
- type ConfigTuple
- type ContactInfo
- type ContactStatusChange
- type DTMFOptions
- type DTMFSender
- type DateTime
- type DeviceState
- type DeviceStateChanged
- type DeviceStateData
- type DeviceStateHandle
- type Dial
- type DialplanCEP
- type Direction
- type DurationSec
- type Endpoint
- type EndpointData
- type EndpointHandle
- type EndpointStateChange
- type Event
- type EventData
- type EventTypes
- type FormatLangPair
- type Header
- type Key
- type KeyOptionFunc
- type Keys
- type LiveRecording
- type LiveRecordingData
- type LiveRecordingHandle
- func (h *LiveRecordingHandle) Data() (*LiveRecordingData, error)
- func (h *LiveRecordingHandle) Exec() (err error)
- func (h *LiveRecordingHandle) ID() string
- func (h *LiveRecordingHandle) Key() *Key
- func (h *LiveRecordingHandle) Mute() error
- func (h *LiveRecordingHandle) Pause() error
- func (h *LiveRecordingHandle) Resume() error
- func (h *LiveRecordingHandle) Scrap() error
- func (h *LiveRecordingHandle) Stop() error
- func (h *LiveRecordingHandle) Stored() *StoredRecordingHandle
- func (h *LiveRecordingHandle) Subscribe(n ...string) Subscription
- func (h *LiveRecordingHandle) Unmute() error
- type LogData
- type LogHandle
- type Logging
- type Mailbox
- type MailboxData
- type MailboxHandle
- type MatchFunc
- type Matcher
- type Message
- type MissingParams
- type ModuleData
- type ModuleHandle
- type Modules
- type OriginateRequest
- type Peer
- type PeerStatusChange
- type Playback
- type PlaybackContinuing
- type PlaybackData
- type PlaybackFinished
- type PlaybackHandle
- func (ph *PlaybackHandle) Control(op string) error
- func (ph *PlaybackHandle) Data() (*PlaybackData, error)
- func (ph *PlaybackHandle) Exec() (err error)
- func (ph *PlaybackHandle) ID() string
- func (ph *PlaybackHandle) Key() *Key
- func (ph *PlaybackHandle) Stop() error
- func (ph *PlaybackHandle) Subscribe(n ...string) Subscription
- type PlaybackStarted
- type Player
- type Recorder
- type Recording
- type RecordingFailed
- type RecordingFinished
- type RecordingOptions
- type RecordingStarted
- type Sender
- type SetID
- type SnoopOptions
- type Sound
- type SoundData
- type StasisEnd
- type StasisStart
- type StatusInfo
- type StoredRecording
- type StoredRecordingData
- type StoredRecordingHandle
- func (s *StoredRecordingHandle) Copy(dest string) (*StoredRecordingHandle, error)
- func (s *StoredRecordingHandle) Data() (*StoredRecordingData, error)
- func (s *StoredRecordingHandle) Delete() error
- func (s *StoredRecordingHandle) Exec() (err error)
- func (s *StoredRecordingHandle) ID() string
- func (s *StoredRecordingHandle) Key() *Key
- type Subscriber
- type Subscription
- type SystemInfo
- type TextMessage
- type TextMessageData
- type TextMessageReceived
- type TextMessageVariable
Constants ¶
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" )
const DateFormat = "2006-01-02T15:04:05.000-0700"
DateFormat is the date format that ARI returns in the JSON bodies
const EndpointIDSeparator = "|" //TODO: confirm separator isn't terrible
EndpointIDSeparator seperates the ID components of the endpoint ID
Variables ¶
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 ¶
ConfigID returns the configuration Key ID for the given configuration class, type/kind, and id.
func EndpointID ¶
EndpointID returns the endpoint Key ID for the given tech and resource
func FromEndpointID ¶
FromEndpointID converts the endpoint ID to the tech, resource pair.
func Once ¶
Once listens for the first event of the provided types, returning a channel which supplies that event.
func ParseConfigID ¶
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) 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 ¶
CallerID describes the name and number which identifies the caller to other endpoints
func CallerIDFromString ¶
CallerIDFromString interprets the provided string as a CallerID. Usually, this string will be of the following forms:
- "Name" <number>
- <number>
- "Name" number
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 unique identifier for a channel in the cluster Key *Key `json:"key,omitempty"` ID string `json:"id"` // Unique id for this channel (same as for AMI) Name string `json:"name"` // Name of this channel (tech/name-id format) State string `json:"state"` // State of the channel Accountcode string `json:"accountcode"` Caller CallerID `json:"caller"` // CallerId of the calling endpoint Connected CallerID `json:"connected"` // CallerId of the connected line Creationtime DateTime `json:"creationtime"` Dialplan DialplanCEP `json:"dialplan"` // Current location in the dialplan }
ChannelData is the data for a specific channel
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) 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 ¶
func (ch *ChannelHandle) Create(req ChannelCreateRequest) (*ChannelHandle, error)
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) 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 ¶
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 ¶
DateTime is an alias type for attaching a custom asterisk unmarshaller and marshaller for JSON
func (DateTime) MarshalJSON ¶
MarshalJSON converts the given date object to ARIs date format
func (*DateTime) UnmarshalJSON ¶
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 ¶
GetChannelIDs gets the bridge IDs for the event
type DialplanCEP ¶
type DialplanCEP struct { Context string `json:"context"` Exten string `json:"exten"` Priority int64 `json:"priority"` }
DialplanCEP describes a location in the dialplan (context,extension,priority)
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 ¶
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'
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 ¶
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 ¶
GetApplication gets the application of the event
func (*EventData) GetDialog ¶
GetDialog gets the dialog, if present, to which this event has been tagged
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 ¶
FormatLangPair describes the format and language of a sound file
type Header ¶
Header represents a set of key-value pairs to store transport-related metadata on Events
type Key ¶
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"` // App indiciates the ARI application that this key is bound to. App string `json:"app,omitempty"` }
Key identifies a unique resource in the system
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 (*Key) Match ¶
Match returns true if the given key matches the subject. Empty partial key fields are wildcards.
type KeyOptionFunc ¶
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) First ¶
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.
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 ¶
func (h *LiveRecordingHandle) Data() (*LiveRecordingData, error)
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 ¶
func (h *LiveRecordingHandle) Stored() *StoredRecordingHandle
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 ¶
NewLogHandle builds a new log handle given the `Key` and `Logging“ client
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) 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
type MatchFunc ¶
MatchFunc is the functional type alias for providing functional `Matcher` implementations
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
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."
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) 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 ¶
GetChannelIDs gets the channel IDs for the 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 ¶
func (s *StoredRecordingHandle) Copy(dest string) (*StoredRecordingHandle, error)
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 ¶
func (s *StoredRecordingHandle) Data() (*StoredRecordingData, error)
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 ¶
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 ¶
TextMessageVariable describes a key-value pair (associated with a text message)
Source Files ¶
- application.go
- asterisk.go
- bridge.go
- bus.go
- callerid.go
- channel.go
- client.go
- config.go
- datetime.go
- device.go
- dialplan.go
- direction.go
- dtmf.go
- endpoint.go
- events.go
- events_gen.go
- key.go
- liveRecording.go
- logger.go
- logging.go
- mailbox.go
- message.go
- modules.go
- originate.go
- playback.go
- recording.go
- sound.go
- storedRecording.go
- textMessage.go
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
|
|