Documentation ¶
Index ¶
- Constants
- Variables
- func NewBridgeContext(ctx context.Context, b *Bridge) context.Context
- func NewBridgeContextWithKey(ctx context.Context, b *Bridge, name string) context.Context
- func NewChannelContext(ctx context.Context, c *Channel) context.Context
- func NewChannelContextWithKey(ctx context.Context, c *Channel, name string) context.Context
- func NewClientContext(ctx context.Context, c *Client) context.Context
- func NewClientContextWithKey(ctx context.Context, c *Client, name string) context.Context
- type AddChannelRequest
- type Application
- type ApplicationReplaced
- type AsteriskDate
- type AsteriskInfo
- type Bridge
- type BridgeAttendedTransfer
- type BridgeBlindTransfer
- type BridgeCreated
- type BridgeDestroyed
- type BridgeEvent
- type BridgeMerged
- type BuildInfo
- type CallerId
- type Channel
- func (c *Channel) Answer() error
- func (c *Channel) AttachClient(a *Client)
- func (c *Channel) Busy() error
- func (c *Channel) Congestion() error
- func (c *Channel) Continue(context string, extension string, priority int64) error
- func (c *Channel) Get(name string) (string, error)
- func (c *Channel) GetClient() *Client
- func (c *Channel) Hangup() error
- func (c *Channel) Hold() error
- func (c *Channel) MOH(mohClass string) error
- func (c *Channel) Mute(dir string) error
- func (c *Channel) Play(mediaUri string) (string, error)
- func (c *Channel) Record(name string, format string) (*LiveRecording, error)
- func (c *Channel) Ring() error
- func (c *Channel) SendDTMF(dtmf string) error
- func (c *Channel) Set(name string, value string) error
- func (c *Channel) Silence() error
- func (c *Channel) Snoop() (string, error)
- func (c *Channel) StopMOH() error
- func (c *Channel) StopRing() error
- func (c *Channel) StopSilence() error
- func (c *Channel) Unhold() error
- func (c *Channel) Unmute(dir string) error
- type ChannelCallerId
- type ChannelCreated
- type ChannelDestroyed
- type ChannelDialplan
- type ChannelDtmfReceived
- type ChannelEnteredBridge
- type ChannelEvent
- type ChannelHangupRequest
- type ChannelLeftBridge
- type ChannelStateChange
- type ChannelTalkingFinished
- type ChannelTalkingStarted
- type ChannelUserevent
- type ChannelVarset
- type Client
- func ClientFromContext(ctx context.Context) (*Client, bool)
- func ClientFromContextWithKey(ctx context.Context, name string) (*Client, bool)
- func NewClient(appName, aurl, wsurl, username, password string) (Client, error)
- func NewClientWithStop(appName, aurl, wsurl, username, password string, stopChan <-chan struct{}) (Client, error)
- func (c *Client) AddChannel(bridgeId string, req AddChannelRequest) error
- func (c *Client) AnswerChannel(channelId string) error
- func (c *Client) AriDelete(url string, ret interface{}, req interface{}) RequestError
- func (c *Client) AriGet(url string, ret interface{}) RequestError
- func (c *Client) AriPost(url string, ret interface{}, req interface{}) RequestError
- func (c *Client) AriPut(url string, ret interface{}, req interface{}) RequestError
- func (c *Client) BridgeDelete(bridgeId string) error
- func (c *Client) BridgeStopMoh(bridgeId string) error
- func (c *Client) ChangeDeviceState(deviceName string, deviceState string) error
- func (c *Client) ChangeMailboxState(mailboxName string, oldMessages int, newMessages int) error
- func (c *Client) CheckDirection(dir *string) error
- func (c *Client) Close()
- func (c *Client) ContinueChannel(channelId string, req ContinueChannelRequest) error
- func (c *Client) ControlPlayback(playbackId string, operation string) error
- func (c *Client) CopyStoredRecording(recordingName string, destination string) (StoredRecording, error)
- func (c *Client) CreateBridge(req CreateBridgeRequest) (Bridge, error)
- func (c *Client) CreateChannel(req OriginateRequest) (Channel, error)
- func (c *Client) CreateChannelWithId(id string, req OriginateRequest) (Channel, error)
- func (c *Client) CreateUserEvent(eventName string, req CreateUserEventRequest) error
- func (c *Client) DeleteDeviceState(deviceName string) error
- func (c *Client) DeleteMailbox(mailboxName string) error
- func (c *Client) DeleteStoredRecording(recordingName string) error
- func (c *Client) GetApplication(applicationName string) (Application, error)
- func (c *Client) GetAsteriskInfo(only string) (*AsteriskInfo, error)
- func (c *Client) GetAsteriskVariable(variable string) (string, error)
- func (c *Client) GetBridge(bridgeId string) (Bridge, error)
- func (c *Client) GetChannel(channelId string) (Channel, error)
- func (c *Client) GetChannelVariable(channelId string, variable string) (Variable, error)
- func (c *Client) GetDeviceState(deviceName string) (DeviceState, error)
- func (c *Client) GetEndpoint(tech string, resource string) (Endpoint, error)
- func (c *Client) GetEndpointsByTech(tech string) ([]Endpoint, error)
- func (c *Client) GetEvents(app string) (Message, error)
- func (c *Client) GetLiveRecording(recordingName string) (LiveRecording, error)
- func (c *Client) GetMailbox(mailboxName string) (Mailbox, error)
- func (c *Client) GetPlaybackDetails(playbackId string) (Playback, error)
- func (c *Client) GetSound(soundId string) (Sound, error)
- func (c *Client) GetStoredRecording(recordingName string) (StoredRecording, error)
- func (c *Client) Go()
- func (c *Client) HangupChannel(channelId string, reason string) error
- func (c *Client) HoldChannel(channelId string) error
- func (c *Client) ListApplications() ([]Application, error)
- func (c *Client) ListBridges() ([]Bridge, error)
- func (c *Client) ListChannels() ([]Channel, error)
- func (c *Client) ListDeviceStates() ([]DeviceState, error)
- func (c *Client) ListEndpoints() ([]Endpoint, error)
- func (c *Client) ListMailboxes() ([]Mailbox, error)
- func (c *Client) ListSounds(filters map[string]string) ([]Sound, error)
- func (c *Client) ListSoundsFiltered(filters map[string]string) ([]Sound, error)
- func (c *Client) ListStoredRecordings() ([]StoredRecording, error)
- func (c *Client) Listen(closedChan chan bool)
- func (c *Client) MuteChannel(channelId string, direction string) error
- func (c *Client) MuteLiveRecording(recordingName string) error
- func (c *Client) NewBridge() (Bridge, error)
- func (c *Client) NewChannel(endpoint string, cid *CallerId, vars map[string]string) (Channel, error)
- func (c *Client) NewOriginateRequest(endpoint string) OriginateRequest
- func (c *Client) ParseMessage(data []byte)
- func (c *Client) PauseLiveRecording(recordingName string) error
- func (c *Client) PlayMOHToChannel(channelId string, mohClass string) error
- func (c *Client) PlayMedia(channelId, mediaUri string) (string, error)
- func (c *Client) PlayMusicOnHold(bridgeId string, mohClass string) error
- func (c *Client) PlaySilenceToChannel(channelId string) error
- func (c *Client) PlayToBridge(bridgeId string, req PlayMediaRequest) (Playback, error)
- func (c *Client) PlayToBridgeById(bridgeId string, playbackId string, req PlayMediaRequest) (Playback, error)
- func (c *Client) PlayToChannel(channelId string, req PlayMediaRequest) (Playback, error)
- func (c *Client) PlayToChannelById(channelId string, playbackId string, req PlayMediaRequest) (Playback, error)
- func (c *Client) RecordBridge(bridgeId string, req RecordRequest) (LiveRecording, error)
- func (c *Client) RecordChannel(channelId string, req RecordRequest) (LiveRecording, error)
- func (c *Client) RemoveChannel(bridgeId string, channelId string) error
- func (c *Client) ResumeLiveRecording(recordingName string) error
- func (c *Client) RingChannel(channelId string) error
- func (c *Client) ScrapLiveRecording(recordingName string) error
- func (c *Client) SendDTMFToChannel(channelId string, req SendDTMFToChannelRequest) error
- func (c *Client) SendMessage(from, tech, resource, body string, vars map[string]string) error
- func (c *Client) SendMessageByUri(from, to, body string, vars map[string]string) error
- func (c *Client) SetAsteriskVariable(variable string, value string) error
- func (c *Client) SetChannelVariable(channelId string, variable string, value string) error
- func (c *Client) StartSnoopChannel(channelId string, req SnoopRequest) (Channel, error)
- func (c *Client) StartSnoopChannelById(channelId string, snoopId string, req SnoopRequest) (Channel, error)
- func (c *Client) StopHoldChannel(channelId string) error
- func (c *Client) StopLiveRecording(recordingName string) error
- func (c *Client) StopMohChannel(channelId string) error
- func (c *Client) StopPlayback(playbackId string) RequestError
- func (c *Client) StopRinging(channelId string) error
- func (c *Client) StopSilenceChannel(channelId string) error
- func (c *Client) SubscribeApplication(applicationName string, eventSource string) (Application, error)
- func (c *Client) UnMuteChannel(channelId string, direction string) error
- func (c *Client) UnmuteLiveRecording(recordingName string) error
- func (c *Client) UnsubscribeApplication(applicationName string, eventSource string) (Application, error)
- func (c *Client) UpsertBridge(bridgeId string, req CreateBridgeRequest) (Bridge, error)
- type ConfigInfo
- type ContinueChannelRequest
- type CreateBridgeRequest
- type CreateUserEventRequest
- type DeviceState
- type DeviceStateChanged
- type Dial
- type DialplanCEP
- type Distribution
- type Distributor
- type Endpoint
- type EndpointStateChange
- type Event
- type FormatLangPair
- type LiveRecording
- type Mailbox
- type Message
- type MessageRawer
- type MissingParams
- type OriginateRequest
- type PlayMediaRequest
- type Playback
- type PlaybackFinished
- type PlaybackStarted
- type RawMessage
- type RecordRequest
- type RecordingFailed
- type RecordingFinished
- type RecordingStarted
- type RequestError
- type SendDTMFToChannelRequest
- type SetId
- type SnoopRequest
- type Sound
- type StasisEnd
- type StasisStart
- type StatusInfo
- type StoredRecording
- type Subscription
- type SystemInfo
- type TextMessage
- type TextMessageReceived
- type TextMessageVariable
- type Variable
Constants ¶
const ( MuteIn = "in" MuteOut = "out" MuteBoth = "both" )
Mute-related constants for use with the mute commands `MuteIn` mutes audio coming in to the channel from Asterisk `MuteOut` mutes audio coming out from the channel to Asterisk `MuteBoth` mutes audio in both directions
const AST_CAUSE_ACCESS_INFO_DISCARDED = 43
const AST_CAUSE_ANSWERED_ELSEWHERE = 26
const AST_CAUSE_BEARERCAPABILITY_NOTAUTH = 57
const AST_CAUSE_BEARERCAPABILITY_NOTAVAIL = 58
const AST_CAUSE_BEARERCAPABILITY_NOTIMPL = 65
const AST_CAUSE_CALL_AWARDED_DELIVERED = 7
const AST_CAUSE_CALL_REJECTED = 21
const AST_CAUSE_CHANNEL_UNACCEPTABLE = 6
const AST_CAUSE_CHAN_NOT_IMPLEMENTED = 66
const AST_CAUSE_DESTINATION_OUT_OF_ORDER = 27
const AST_CAUSE_FACILITY_NOT_IMPLEMENTED = 69
const AST_CAUSE_FACILITY_NOT_SUBSCRIBED = 50
const AST_CAUSE_FACILITY_REJECTED = 29
const AST_CAUSE_IE_NONEXIST = 99
const AST_CAUSE_INCOMING_CALL_BARRED = 54
const AST_CAUSE_INCOMPATIBLE_DESTINATION = 88
const AST_CAUSE_INTERWORKING = 127
const AST_CAUSE_INVALID_CALL_REFERENCE = 81
const AST_CAUSE_INVALID_IE_CONTENTS = 100
const AST_CAUSE_INVALID_MSG_UNSPECIFIED = 95
const AST_CAUSE_INVALID_NUMBER_FORMAT = 28
const AST_CAUSE_MANDATORY_IE_LENGTH_ERROR = 103
const AST_CAUSE_MANDATORY_IE_MISSING = 96
const AST_CAUSE_MESSAGE_TYPE_NONEXIST = 97
const AST_CAUSE_MISDIALLED_TRUNK_PREFIX = 5
const AST_CAUSE_NETWORK_OUT_OF_ORDER = 38
const AST_CAUSE_NORMAL_CIRCUIT_CONGESTION = 34
const AST_CAUSE_NORMAL_CLEARING = 16
const AST_CAUSE_NORMAL_TEMPORARY_FAILURE = 41
const AST_CAUSE_NORMAL_UNSPECIFIED = 31
const AST_CAUSE_NO_ANSWER = 19
const AST_CAUSE_NO_ROUTE_DESTINATION = 3
const AST_CAUSE_NO_ROUTE_TRANSIT_NET = 2
const AST_CAUSE_NO_USER_RESPONSE = 18
const AST_CAUSE_NUMBER_CHANGED = 22
const AST_CAUSE_NUMBER_PORTED_NOT_HERE = 14
const AST_CAUSE_OUTGOING_CALL_BARRED = 52
const AST_CAUSE_PRE_EMPTED = 8
const AST_CAUSE_PROTOCOL_ERROR = 111
const AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE = 102
const AST_CAUSE_REDIRECTED_TO_NEW_DESTINATION = 23
const AST_CAUSE_REQUESTED_CHAN_UNAVAIL = 44
const AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY = 30
const AST_CAUSE_SUBSCRIBER_ABSENT = 20
const AST_CAUSE_SWITCH_CONGESTION = 42
const AST_CAUSE_UNALLOCATED = 1
const AST_CAUSE_USER_BUSY = 17
const AST_CAUSE_WRONG_CALL_STATE = 101
const AST_CAUSE_WRONG_MESSAGE = 98
const AsteriskDateFormat = "2006-01-02T15:04:05.000-0700"
Variables ¶
var ( DefaultBaseUri = "http://216.66.0.147:8088/ari" DefaultWsUri = "ws://216.66.0.147:8088/ari/events" DefaultUsername = "enswitch" DefaultSecret = "enswitchDev" )
var DefaultClient, _ = NewClient("default", DefaultBaseUri, DefaultWsUri, DefaultUsername, DefaultSecret)
var Logger = log15.New()
Logger
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 NewBridgeContext ¶
NewBridgeContext returns a context with the bridge attached
func NewBridgeContextWithKey ¶
NewBridgeContextWithKey returns a context with the bridge attached as the given key
func NewChannelContext ¶
NewChannelContext returns a context with the channel attached
func NewChannelContextWithKey ¶
NewChannelContext returns a context with the channel attached as the given key
func NewClientContext ¶
NewClientContext returns a context with the client attached
Types ¶
type AddChannelRequest ¶
type AddChannelRequest struct { ChannelId string `json:"channel"` Role string `json:"role,omitempty"` }
Request structure to add a channel to a bridge. Only Channel is required. Channel field allows for comma-separated-values to add multiple channels.
type Application ¶
type Application struct { Bridge_ids []string `json:"bridge_ids"` // Subscribed BridgeIds Channel_ids []string `json:"channel_ids"` // Subscribed ChannelIds Device_names []string `json:"device_names"` // Subscribed Device names Endpoint_ids []string `json:"endpoint_ids"` // Subscribed Endpoints (tech/resource format) Name string `json:"name"` // Name of the application }
Application describes a Stasis (Ari) application
type ApplicationReplaced ¶
type ApplicationReplaced Event
ApplicationReplaced is a notification to the original application that notifications about this application are now going to a different WebSocket connection. There can only be a single websocket connection for each application at any given time.
type AsteriskDate ¶
Asterisk ARI does not supply a format that the built-in golang json date parser can use, so we have to write our own unmarshal routine for it
func (AsteriskDate) MarshalJSON ¶
func (d AsteriskDate) MarshalJSON() ([]byte, error)
func (AsteriskDate) String ¶
func (d AsteriskDate) String() string
func (*AsteriskDate) UnmarshalJSON ¶
func (d *AsteriskDate) UnmarshalJSON(data []byte) error
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 Bridge ¶
type Bridge struct { Id string `json:"id"` // Unique Id for this bridge Bridge_class string `json:"bridge"` // Class of the bridge (TODO: huh?) Bridge_type string `json:"bridge_type"` // Type of bridge (mixing, holding, dtmf_events, proxy_media) Channels []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 // contains filtered or unexported fields }
Bridge describes an Asterisk Bridge, the entity which merges media from one or more channels into a common audio output
func BridgeFromContext ¶
BridgeFromContext returns the default Bridge stored in the context
func BridgeFromContextWithKey ¶
BridgeFromContextWithKey returns the Bridge stored in the context
type BridgeAttendedTransfer ¶
type BridgeAttendedTransfer struct { Event Destination_application string `json:"destination_application,omitempty"` Destination_bridge string `json:"desination_bridge,omitempty"` Destination_link_first_leg Channel `json:"destination_link_first_leg,omitempty"` Destination_link_second_leg Channel `json:"destination_link_second_leg,omitempty"` Destination_threeway_bridge Bridge `json:"destination_threeway_bridge,omitempty"` Destination_threeway_channel Channel `json:"destination_threeway_channel,omitempty"` Destination_type string `json:"destination_type"` Is_external bool `json:"is_external"` Result string `json:"result"` Transferer_first_leg Channel `json:"transferer_first_leg"` Transferer_first_leg_bridge Bridge `json:"transferer_first_leg_bridge,omitempty"` Transferer_second_leg Channel `json:"transferer_second_leg"` Transferer_second_leg_bridge Bridge `json:"transferer_second_leg_bridge,omitempty"` }
BridgeAttendedTransfer events signify that an attended transfer has occurred
type BridgeBlindTransfer ¶
type BridgeBlindTransfer struct { Event Bridge Bridge `json:"bridge,omitempty"` Channel Channel `json:"channel"` Context string `json:"context"` }
BridgeBlindTransfer events signify that a blind transfer has occurred
type BridgeCreated ¶
BridgeCreated events indicate a bridge has been created
type BridgeDestroyed ¶
BridgeDestroyed events indicate a bridge has been destroyed
type BridgeEvent ¶
BridgeEvent (meta) is an event which affects a bridge
type BridgeMerged ¶
type BridgeMerged struct { Event Bridge Bridge `json:"bridge"` // New bridge Bridge_from Bridge `json: "bridge_from"` // Old (independant) bridge -- TODO: verify this assumption }
BridgeMerged events indicate a bridge has been merged into another (bridge)
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 CallerId ¶
CallerId describes the name and number which identifies the caller to other endpoints
type Channel ¶
type Channel struct { Accountcode string `json:"accountcode"` Caller CallerId `json:"caller"` // CallerId of the calling endpoint Connected CallerId `json:"connected"` // CallerId of (TODO: what?) Creationtime AsteriskDate `json:"creationtime"` Dialplan DialplanCEP `json:"dialplan"` // Current location in the dialplan 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 // contains filtered or unexported fields }
Channel describes a(n active) communication connection between Asterisk and an Endpoint
func ChannelFromContext ¶
ChannelFromContext returns the default Channel stored in the context
func ChannelFromContextWithKey ¶
ChannelFromContextWithKey returns the default Channel stored in the context
func (*Channel) AttachClient ¶
AttachClient attaches the provided ARI client to the channel
func (*Channel) Congestion ¶
Congestion hangs up the current channel with the "congestion" cause code
func (*Channel) Mute ¶
Mute mutes the channel in the given direction (one of "in", "out", or "both")
func (*Channel) Play ¶
Play initiates playback of the specified media uri to the channel, returning the Playback's Id
func (*Channel) Record ¶
func (c *Channel) Record(name string, format string) (*LiveRecording, error)
Record starts recording the channel, returning the LiveRecording
func (*Channel) Snoop ¶
Snoop begins a snoop session and returns its id TODO: what is the channel being returned; do we need it?
func (*Channel) StopSilence ¶
StopSilence stops transmission of silence to channel
type ChannelCallerId ¶
type ChannelCallerId struct { Event Caller_presentation int `json:"caller_presentation"` // The numeric portion Caller_presentation_txt string `json:"caller_presentation_txt"` // The textual portion Channel Channel `json:"channel"` }
ChannelCallerId events indicate a channel's caller Id information has changed
type ChannelCreated ¶
ChannelCreated events indicate a channel has been created
type ChannelDestroyed ¶
type ChannelDestroyed struct { Event Cause int `json:"cause"` Cause_txt string `json:"cause_txt"` Channel Channel `json:"channel"` }
ChannelDestroyed events indicate a channel has been destroyed
type ChannelDialplan ¶
type ChannelDialplan struct { Event Channel Channel `json:"channel"` Dialplan_app string `json:"dialplan_app"` // The application which is to be executed Dialplan_app_data string `json:"dialplan_app_data"` // The data to be passed to the application }
ChannelDialplan events indicate a channel has changed its location in the dialplan
NOTE: This event also most likely implies the channel is leaving the control of this ARI application
type ChannelDtmfReceived ¶
type ChannelDtmfReceived struct { Event Channel Channel `json:"channel"` Digit string `json:"digit"` // The DTMF digit which was received (0-9A-E*#) Duration_ms int `json:"duration_ms"` // The duration of the DTMF tone, in milliseconds }
ChannelDtmfReceived events indicate a channel has received a DTMF tone.
NOTE: this event is sent at the _end_ of the DTMF tone (and there is no indication for the _start_ of the DTMF tone)
type ChannelEnteredBridge ¶
type ChannelEnteredBridge struct { Event Bridge Bridge `json:"bridge"` Channel Channel `json:"channel"` }
ChannelEngteredBridge events indicate that a channel has joined a bridge
type ChannelEvent ¶
ChannelEvent (meta) is an event which affects a channel
type ChannelHangupRequest ¶
type ChannelHangupRequest struct { Event Cause int `json:"cause,omitempty"` // Integer cause code Channel Channel `json:"channel"` Soft bool `json:"soft,omitempty"` // Whether the request was "soft" }
ChannelHangupRequest events indicate that a channel has received a hangup request
TODO: find out if the application is supposed to act on this, or whether this event is purely advisory
type ChannelLeftBridge ¶
type ChannelLeftBridge struct { Event Bridge Bridge `json:"bridge"` Channel Channel `json:"channel"` }
ChannelLeftBridge events indicate that a channel has left a bridge
type ChannelStateChange ¶
ChannelStateChange events indicate that the state of a channel has changed
TODO: enumerate the possible channel states
type ChannelTalkingFinished ¶
type ChannelTalkingFinished struct { Event Channel Channel `json:"channel"` Duration int `json:"duration"` // Duration (in milliseconds) of the talking }
ChannelTalkingFinished events indicate that previously-detected talking on a channel is now absent
type ChannelTalkingStarted ¶
ChannelTalkingStarted events indicate that talking has been detected on a channel
type ChannelUserevent ¶
type ChannelUserevent struct { Event Bridge Bridge `json:"bridge,omitempty"` Channel Channel `json:"channel,omitempty"` Endpoint Endpoint `json:"endpoint,omitempty"` Eventname string `json:"eventname"` // Name of the user event Userevent interface{} `json:"userevent"` // Custome data sent with the user event }
ChannelUserevent events are custom-formatted events which have been received
TODO: figure out if these include AMI user events, etc, and how the data is formatted
type ChannelVarset ¶
type ChannelVarset struct { Event Channel Channel `json:"channel,omitempty"` // If not present, variable is global Value string `json:"value"` // New value Variable string `json:"variable"` // Variable name }
ChannelVarset events indicate a channel variable has been set (or changed)
type Client ¶
type Client struct { Application string // ARI Application name Url string // root URL of ARI server (asterisk box), e.g. http://localhost:8088/ari WsUrl string // URL of ARI Websocket events, e.g. ws://localhost:8088/ari/events WSConfig *websocket.Config // websocket connection configuration WebSocket *websocket.Conn // websocket connection used to receive events Events chan *Event // chan on which events are sent StopChan <-chan struct{} // Stop signal channel // contains filtered or unexported fields }
Client describes an ARI connection to an Asterisk server Create one client for each ARI application
func ClientFromContext ¶
ClientFromContext returns the Client stored in the context with the default key
func ClientFromContextWithKey ¶
ClientFromContextWithKey returns the Client stored in the context with the given keyname
func NewClient ¶
NewClient creates a new Asterisk client This function does not attempt to connect to Asterisk itself.
func NewClientWithStop ¶
func NewClientWithStop(appName, aurl, wsurl, username, password string, stopChan <-chan struct{}) (Client, error)
NewClientWithStop creates a new Asterisk client with a stop channel This function does not attempt to connect to Asterisk itself.
func (*Client) AddChannel ¶
func (c *Client) AddChannel(bridgeId string, req AddChannelRequest) error
Add a channel to a bridge Equivalent to Post /bridges/{bridgeId}/addChannel
func (*Client) AnswerChannel ¶
Answer a channel Equivalent to Post /channels/{channelId}/answer
func (*Client) AriDelete ¶
func (c *Client) AriDelete(url string, ret interface{}, req interface{}) RequestError
AriDelete is a shorthand for MakeRequest("DELETE",url,nil,nil) It calls the ARI server with a DELETE request
func (*Client) AriGet ¶
func (c *Client) AriGet(url string, ret interface{}) RequestError
AriGet wraps restclient.Get with the complete url It calls the ARI server with a GET request
func (*Client) AriPost ¶
func (c *Client) AriPost(url string, ret interface{}, req interface{}) RequestError
AriPost is a shorthand for MakeRequest("POST",url,ret,req) It calls the ARI server with a POST request Uses restclient.PostForm since ARI returns bad request otherwise
func (*Client) AriPut ¶
func (c *Client) AriPut(url string, ret interface{}, req interface{}) RequestError
AriPut is a shorthand for MakeRequest("PUT",url,ret,req) It calls the ARI server with a PUT request
func (*Client) BridgeDelete ¶
Shut down a bridge. If any channels are in this bridge, they will be removed and resume whatever they were doing beforehand. This means that the channels themselves are not deleted. Equivalent to DELETE /bridges/{bridgeId}
func (*Client) BridgeStopMoh ¶
Stop playing music on hold to a bridge. This will only stop music on hold being played via POST bridges/{bridgeId}/moh. Equivalent to DELETE /bridges/{bridgeId}/moh
func (*Client) ChangeDeviceState ¶
Change the state of a device controlled by ARI. (Note - implicitly creates the device state). Equivalent to PUT /deviceStates/{deviceName}
func (*Client) ChangeMailboxState ¶
Change the state of a mailbox. (Note - implicitly creates the mailbox). Equivalent to PUT /mailboxes/{mailboxName}
func (*Client) CheckDirection ¶
func (*Client) ContinueChannel ¶
func (c *Client) ContinueChannel(channelId string, req ContinueChannelRequest) error
Exit application and continue execution in the dialplan Equivalent to Post /channels/{channelId}/continue
func (*Client) ControlPlayback ¶
Equivalent to POST /playbacks/{playbackId}/control
func (*Client) CopyStoredRecording ¶
func (c *Client) CopyStoredRecording(recordingName string, destination string) (StoredRecording, error)
Copy a stored recording Equivalent to Post /recordings/stored/{recordingName}/copy
func (*Client) CreateBridge ¶
func (c *Client) CreateBridge(req CreateBridgeRequest) (Bridge, error)
Create a new bridge Equivalent to POST /bridges
func (*Client) CreateChannel ¶
func (c *Client) CreateChannel(req OriginateRequest) (Channel, error)
CreateChannel originates a new call
func (*Client) CreateChannelWithId ¶
func (c *Client) CreateChannelWithId(id string, req OriginateRequest) (Channel, error)
CreateChannelWithId originates a new call with the given channel Id
func (*Client) CreateUserEvent ¶
func (c *Client) CreateUserEvent(eventName string, req CreateUserEventRequest) error
Generate a new user event Equivalent to Post /events/user/{eventName}
func (*Client) DeleteDeviceState ¶
Destroy a device-state controlled by ARI. Equivalent to DELETE /deviceStates/{deviceName}
func (*Client) DeleteMailbox ¶
Destroy a mailbox. Equivalent to DELETE /mailboxes/{mailboxName}
func (*Client) DeleteStoredRecording ¶
Delete a stored recording Equivalent to DELETE /recordings/stored/{recordingName}
func (*Client) GetApplication ¶
func (c *Client) GetApplication(applicationName string) (Application, error)
GetApplication returns the details of a given ARI application Equivalent to GET /applications/{applicationName}
func (*Client) GetAsteriskInfo ¶
func (c *Client) GetAsteriskInfo(only string) (*AsteriskInfo, error)
GetAsteriskInfo returns various data about the Asterisk system Equivalent to GET /asterisk/info
func (*Client) GetAsteriskVariable ¶
GetAsteriskVariable returns the value of the given global variable Equivalent to GET /asterisk/variable
func (*Client) GetChannel ¶
Get a specific channel's details Equivalent to Get /channels/{channelId}
func (*Client) GetChannelVariable ¶
Get the value of a channel variable or function Equivalent to Get /channels/{channelId}/variable
func (*Client) GetDeviceState ¶
func (c *Client) GetDeviceState(deviceName string) (DeviceState, error)
Retrieve the current state of a specified device Equivalent to GET /deviceStates/{deviceName}
func (*Client) GetEndpoint ¶
GetEndpoint requests the details of an endpoint from Asterisk
func (*Client) GetEndpointsByTech ¶
List available endpoints for a given endpoint technology Equivalent to Get /endpoints/{tech}
func (*Client) GetLiveRecording ¶
func (c *Client) GetLiveRecording(recordingName string) (LiveRecording, error)
Get a specific live recording Equivalent to GET /recordings/live/{recordingName}
func (*Client) GetMailbox ¶
Retrieve the current state of a specific mailbox Equivalent to GET /mailboxes/{mailboxName}
func (*Client) GetPlaybackDetails ¶
Get a playback's details Equivalent to GET /playbacks/{playbackId}
func (*Client) GetStoredRecording ¶
func (c *Client) GetStoredRecording(recordingName string) (StoredRecording, error)
Get a stored recording's details Equivalent to GET /recordings/stored/{recordingName}
func (*Client) HangupChannel ¶
Delete (i.e. hangup) a channel. Equivalent to DELETE /channels/{channelId}
func (*Client) HoldChannel ¶
Hold a channel Equivalent to Post /channels/{channelId}/hold
func (*Client) ListApplications ¶
func (c *Client) ListApplications() ([]Application, error)
ListApplications returns the list of ARI applications on the Asterisk server Equivalent to GET /applications
func (*Client) ListBridges ¶
List all active bridges in Asterisk Equivalent to GET /bridges
func (*Client) ListChannels ¶
List all active channels in asterisk Equivalent to Get /channels
func (*Client) ListDeviceStates ¶
func (c *Client) ListDeviceStates() ([]DeviceState, error)
ListDeviceStates returns the list of all ARI controlled device states Equivalent to GET /deviceStates
func (*Client) ListEndpoints ¶
ListEndpoints lists all endpoints TODO: associated with the application, or on the entire system?
func (*Client) ListMailboxes ¶
List all mailboxes on asterisk server Equivalent to GET /mailboxes
func (*Client) ListSounds ¶
ListSounds returns a list of (all) the available sounds
func (*Client) ListSoundsFiltered ¶
ListSoundsFiltered lists sounds limited by the provided filters valid filters are "lang" and "format"
func (*Client) ListStoredRecordings ¶
func (c *Client) ListStoredRecordings() ([]StoredRecording, error)
List all completed recordings Equivalent to GET /recordings/stored
func (*Client) MuteChannel ¶
Mute a channel Equivalent to Post /channels/{channelId}/mute Viable options are "in," "out," or "both"
func (*Client) MuteLiveRecording ¶
Mute a live recording Equivalent to Post /recordings/live/{recordingName}/mute
func (*Client) NewBridge ¶
NewBridge is a simple wrapper to create a new, unique bridge, with the default options
func (*Client) NewChannel ¶
func (c *Client) NewChannel(endpoint string, cid *CallerId, vars map[string]string) (Channel, error)
NewChannel is a shorthand for creating a new channel. It generates a unique Id, sets the destination to be the current application, and passes any variables through; pass nil for vars if no variables are needed
func (*Client) NewOriginateRequest ¶
func (c *Client) NewOriginateRequest(endpoint string) OriginateRequest
NewOriginateRequest generates an originate request with a unique channel Id, destination equal to the current client, and an unlimited call timeout
func (*Client) ParseMessage ¶
Parse a websocket message and send it to the Events chan
func (*Client) PauseLiveRecording ¶
Pause a live recording Equivalent to Post /recordings/live/{recordingName}/pause
func (*Client) PlayMOHToChannel ¶
Play music on hold to a channel Equivalent to Post /channels/{channelId}/moh
func (*Client) PlayMedia ¶
PlayMedia is a wrapper to initiate a playback with the given Media URI, returning the playback id
func (*Client) PlayMusicOnHold ¶
Play music on hold to a bridge or change the MOH class that's playing Equivalent to Post /bridges/{bridgeId}/moh (music on hold)
func (*Client) PlaySilenceToChannel ¶
Play silence to a channel Equivalent to Post /channels/{channelId}/silence
func (*Client) PlayToBridge ¶
func (c *Client) PlayToBridge(bridgeId string, req PlayMediaRequest) (Playback, error)
Start playback of media on specified bridge Equivalent to Post /bridges/{bridgeId}/play
func (*Client) PlayToBridgeById ¶
func (c *Client) PlayToBridgeById(bridgeId string, playbackId string, req PlayMediaRequest) (Playback, error)
Start playback of specific media on specified bridge Equivalent to Post /bridges/{bridgeId}/play/{playbackId}
func (*Client) PlayToChannel ¶
func (c *Client) PlayToChannel(channelId string, req PlayMediaRequest) (Playback, error)
Start playback of media to a channel Equivalent to Post /channels/{channelId}/play
func (*Client) PlayToChannelById ¶
func (c *Client) PlayToChannelById(channelId string, playbackId string, req PlayMediaRequest) (Playback, error)
Specifiy media to playback to a channel Equivalent to Post /channels/{channelId}/play/{playbackId}
func (*Client) RecordBridge ¶
func (c *Client) RecordBridge(bridgeId string, req RecordRequest) (LiveRecording, error)
start a recording on specified bridge Equivalent to Post /bridges/{bridgeId}/record
func (*Client) RecordChannel ¶
func (c *Client) RecordChannel(channelId string, req RecordRequest) (LiveRecording, error)
Start a live recording Equivalent to Post /channels/{channelId}/record
func (*Client) RemoveChannel ¶
Remove a specific channel from a bridge Equivalent to Post /bridges/{bridgeId}/removeChannel
func (*Client) ResumeLiveRecording ¶
Unpause a live recording Equivalent to DELETE /recordings/live/{recordingName}/pause
func (*Client) RingChannel ¶
Indicate ringing to a channel Equivalent to Post /channels/{channelId}/ring
func (*Client) ScrapLiveRecording ¶
TODO reproduce this error in isolation: does not delete. Cannot delete any recording produced by this. Stop a live recording and discard it Equivalent to DELETE /recordings/live/{recordingName}
func (*Client) SendDTMFToChannel ¶
func (c *Client) SendDTMFToChannel(channelId string, req SendDTMFToChannelRequest) error
Send provided DTMF to a given channel Equivalent to Post /channels/{channelId}/dtmf
func (*Client) SendMessage ¶
SendMessage sends a text message to an endpoint
func (*Client) SendMessageByUri ¶
SendMessageByUri sends a text message to an endpoint by free-form URI (rather than tech/resource)
func (*Client) SetAsteriskVariable ¶
Equivalent to POST /asterisk/variable
func (*Client) SetChannelVariable ¶
Set the value of a variable Equivalent to Post /channels/{channelId}/variable
func (*Client) StartSnoopChannel ¶
func (c *Client) StartSnoopChannel(channelId string, req SnoopRequest) (Channel, error)
Start snooping Equivalent to Post /channels/{channelId}/snoop
func (*Client) StartSnoopChannelById ¶
func (c *Client) StartSnoopChannelById(channelId string, snoopId string, req SnoopRequest) (Channel, error)
Start Snooping by specific ID Equivalent to Post /channels/{channelId}/snoop/{snoopId}
func (*Client) StopHoldChannel ¶
Remove a channel from hold Equivalent to DELETE /channels/{channelId}/hold
func (*Client) StopLiveRecording ¶
Stop and store a live recording Equivalent to Post /recordings/live/{recordingName}/stop
func (*Client) StopMohChannel ¶
Stop playing music on hold to a channel Equivalent to DELETE /channels/{channelId}/moh
func (*Client) StopPlayback ¶
func (c *Client) StopPlayback(playbackId string) RequestError
Stop a playback. Equivalent to DELETE /playbacks/{playbackId}
func (*Client) StopRinging ¶
Stop ringing indication on a channel if locally generated. Equivalent to DELETE /channels/{channelId}/ring
func (*Client) StopSilenceChannel ¶
Stop playing silence to a channel Equivalent to DELETE /channels/{channelId}/silence
func (*Client) SubscribeApplication ¶
func (c *Client) SubscribeApplication(applicationName string, eventSource string) (Application, error)
SubscribeApplication 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>
Equivalent to POST /applications/{applicationName}/subscription
func (*Client) UnMuteChannel ¶
Unmute a channel Equivalent to DELETE /channels/{channelId}/mute
func (*Client) UnmuteLiveRecording ¶
Unmute a live recording Equivalent to DELETE /recordings/live/{recordingName}/mute
func (*Client) UnsubscribeApplication ¶
func (c *Client) UnsubscribeApplication(applicationName string, eventSource string) (Application, error)
UnsubscribeApplication unsubscribes (removes a subscription to) a given ARI application from the provided event source Equivalent to DELETE /applications/{applicationName}/subscription
func (*Client) UpsertBridge ¶
func (c *Client) UpsertBridge(bridgeId string, req CreateBridgeRequest) (Bridge, error)
Update a bridge or create a new one (upsert) Equivalent to POST /bridges/{bridgeId}
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 ContinueChannelRequest ¶
type ContinueChannelRequest struct { Context string `json:"context,omitempty"` Extension string `json:"extension,omitempty"` Priority int64 `json:"priority,omitempty"` }
priority is of type long = int64 Request structure for ContinueChannel. All fields are optional. The three fields mirror the construction of a channel by Dialplan, as the function returns a channel to the dialplan.
type CreateBridgeRequest ¶
type CreateBridgeRequest struct { Id string `json:"bridgeId,omitempty"` Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` }
Request structure for creating a bridge. No properies are required, meaning an empty struct may be passed to 'CreateBridge'
type CreateUserEventRequest ¶
type CreateUserEventRequest struct { Application string `json:"application"` Source string `json:"source,omitempty"` Variables string `json:"variables,omitempty"` }
Request structure for creating a user event. Only Application is required.
type DeviceState ¶
DeviceState describes the state of a device
type DeviceStateChanged ¶
type DeviceStateChanged struct { Event Device_state DeviceState `json:"device_state"` }
DeviceStateChanged events indicate that a device state has changed
type Dial ¶
type Dial struct { Event Caller Channel `json:"caller,omitempty"` // Dialing channel (if not system-originated) Dialstatus string `json:"dialstatus"` // Present status of the dial attempt Dialstring string `json:"dialstring,omitempty"` // The string describing the dial Forward string `json:"forward,omitempty"` // If present, indicates the forwarding target TODO: what is the format of this? Forwarded Channel `json:"forwarded,omitempty"` // If present, channel of forwarding target Peer Channel `json:"peer"` // Dialed channel }
Dial events indicate the dialing state for a channel has changed
type DialplanCEP ¶
type DialplanCEP struct { Context string `json:"context"` Exten string `json:"exten"` Priority int64 `json:"priority"` //int64 derived from Java's 'long' }
DialplanCEP describes a location in the dialplan (context,extension,priority)
type Distribution ¶
type Distribution struct {
// contains filtered or unexported fields
}
Distribution is a convenience tool for distribution of ARI events to subscribers. It is essentially a pubsub interface for ARI events. It contains no filtering and does not automatically attach to ARI for event sourcing. Instead, it merely provides a tool to redistribute received ARI events.
func (*Distribution) Publish ¶
func (d *Distribution) Publish(e *Event)
Publish pushes an event to all subscribers to this distribution
func (*Distribution) Subscribe ¶
func (d *Distribution) Subscribe() *Subscription
Subscribe returns a subscription to this distribution NOTE: it is the duty of subscribers to `Cancel` their own subscriptions.
func (*Distribution) SubscribeChan ¶
func (d *Distribution) SubscribeChan(eventChan chan *Event) *Subscription
SubscribeChan returns a subscription to this distribution using the provided channel as the event sink NOTE: it is the duty of subscribers to `Cancel` their own subscriptions.
func (*Distribution) Unsubscribe ¶
func (d *Distribution) Unsubscribe(id string)
Unsubscribe removes a subscription from the distribution. This should not be called directly, but rather, subscribers should call their subscription's `Cancel` method.
type Distributor ¶
type Distributor interface { Publish(*Event) Subscribe() *Subscription }
type Endpoint ¶
type Endpoint struct { 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) }
Endpoint 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 EndpointStateChange ¶
EndpointStateChange events indicate that an endpoint has changed state
type Event ¶
type Event struct { Message Application string `json:"application"` Timestamp AsteriskDate `json:"timestamp,omitempty"` }
Event is the base struct for all events
type FormatLangPair ¶
FormatLangPair describes the format and language of a sound file
type LiveRecording ¶
type LiveRecording struct { Cause string `json:"cause,omitempty"` // If failed, the cause of the failure Duration int `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_duration int `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_duration int `json:"talking_duration,omitempty"` // Duration of talking, in seconds, that has been detected in the recording (requires that maxSilenceSeconds be non-zero) Target_uri string `json:"target_uri"` // URI for the channel or bridge which is being recorded (TODO: figure out format for this) // contains filtered or unexported fields }
LiveRecording describes a recording which is in progress
func (*LiveRecording) Scrap ¶
func (l *LiveRecording) Scrap() error
TODO reproduce this error in isolation: does not delete. Cannot delete any recording produced by this. Stop and delete current LiveRecording
func (*LiveRecording) Stop ¶
func (l *LiveRecording) Stop() error
Stop and store current LiveRecording
type Mailbox ¶
type Mailbox struct { Name string `json:"name"` New_messages int `json:"new_messages"` // Number of new (unread) messages Old_messages int `json:"old_messages"` // Number of old (read) messages }
Mailbox respresents the state of an Asterisk (voice) mailbox
type Message ¶
type Message struct { RawMessage Type string `json:"type"` }
Message is the first extension of the RawMessage type, containing only a Type
func NewMessage ¶
Construct a Message from a byte slice
type MessageRawer ¶
type MissingParams ¶
type MissingParams struct { Message Params []string `json:"params"` // List of missing parameters which are required }
MissingParams is an error message response emitted when a request does not contain required parameters
type 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 // 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) Variables map[string]string `json:"variables,omitempty"` // Channel variables to set }
OriginateRequest is the basic structure for all channel creation methods
type PlayMediaRequest ¶
type Playback ¶
type Playback struct { 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') // contains filtered or unexported fields }
type PlaybackFinished ¶
PlaybackFinished events indicate that a media playback operation has completed
type PlaybackStarted ¶
PlaybackStarted events indicate that a media playback operation has begun
type RawMessage ¶
type RawMessage struct {
// contains filtered or unexported fields
}
func (*RawMessage) DecodeAs ¶
func (m *RawMessage) DecodeAs(v MessageRawer) error
DecodeAs converts the current message to a new message type
func (*RawMessage) GetRaw ¶
func (m *RawMessage) GetRaw() *[]byte
Get the __raw value of this RawMessage
func (*RawMessage) SetRaw ¶
func (m *RawMessage) SetRaw(raw *[]byte)
Set the __raw value of this RawMessage
type RecordRequest ¶
type RecordRequest struct { Name string `json:"name"` Format string `json:"format"` MaxDurationSeconds int `json:"maxDurationSeconds,omitempty"` MaxSilenceSeconds int `json:"maxSilenceSeconds,omitempty"` IfExists string `json:"ifExists,omitempty"` Beep bool `json:"beep,omitempty"` TerminateOn string `json:"terminateOn,omitempty"` }
type RecordingFailed ¶
type RecordingFailed struct { Event Recording LiveRecording `json:"recording"` }
RecordingFailed events indicate that a recording operation request has failed to complete
type RecordingFinished ¶
type RecordingFinished struct { Event Recording LiveRecording `json:"recording"` }
RecordingFinished events indicate that a recording operation has completed
type RecordingStarted ¶
type RecordingStarted struct { Event Recording LiveRecording `json:"recording"` }
RecordingStarted events indicate that a recording operation has begun
type RequestError ¶
type RequestError restclient.Error
type SendDTMFToChannelRequest ¶
type SendDTMFToChannelRequest struct { Dtmf string `json:"dtmf,omitempty"` Before int `json:"before,omitempty"` Between int `json:"between,omitempty"` Duration int `json:"duration,omitempty"` After int `json:"after,omitempty"` }
SendDTMPFToChannel Request structure. All fields are optional.
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 SnoopRequest ¶
type SnoopRequest struct { Spy string `json:"spy,omitempty"` //Direction of audio to spy on, default is 'none' Whisper string `json:"whisper,omitempty"` //Direction of audio to whisper into, default is 'none' App string `json:"app"` //Application that the snooping channel is placed into AppArgs string `json:"appArgs,omitempty"` //The application arguments to pass to the Stasis application //Only necessary for 'StartSnoopChannel' SnoopId string `json:"snoopId,omitempty"` //Unique ID to assign to snooping channel }
Structure for snooping a channel. Only App is required.
type Sound ¶
type Sound struct { Formats []FormatLangPair `json:"formats"` Id string `json:"id"` Text string `json:"text,omitempty"` }
Sound describes a media file which may be played back
type StasisStart ¶
type StasisStart struct { Event Args []string `json:"args"` Channel Channel `json:"channel"` ReplaceChannel Channel `json:"replacechannel,omitempty"` // TODO: find out what this is }
StasisStart events indicate a channel has entered the Stasis (Ari) application
func (*StasisStart) GetChannel ¶
func (s *StasisStart) GetChannel(c *Client) Channel
GetChannel returns the channel for whom the StasisStart event occurred, optionally attaching a copy of the ARI client
type StatusInfo ¶
type StatusInfo struct { LastReloadTime AsteriskDate `json:"last_reload_time"` StartupTime AsteriskDate `json:"startup_time"` }
StatusInfo describes the state of an Asterisk system
type StoredRecording ¶
type StoredRecording struct { Format string `json:"format"` Name string `json:"name"` // contains filtered or unexported fields }
StoredRecording describes a past recording which may be played back (via GetStoredRecording)
func (*StoredRecording) Copy ¶
func (s *StoredRecording) Copy(destination string) (StoredRecording, error)
Copy current StoredRecording
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
func (*Subscription) Cancel ¶
func (s *Subscription) Cancel()
Cancel removes a subscription and closes its channel
func (*Subscription) Inject ¶
func (s *Subscription) Inject(eChan chan *Event)
Allows for the injection of an event channel into a Subscription method
func (*Subscription) Next ¶
func (s *Subscription) Next() (*Event, bool)
Next blocks to return the next event
type SystemInfo ¶
SystemInfo describes information about the Asterisk system
type TextMessage ¶
type TextMessage struct { 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"` }
TextMessage describes text message
type TextMessageReceived ¶
type TextMessageReceived struct { Event Endpoint Endpoint `json:"endpoint,omitempty"` Message TextMessage `json:"message"` }
TextMessageReceived events indicate that an endpoint has emitted a text message
type TextMessageVariable ¶
TextMessageVariable describes a key-value pair (associated with a text message)