ari

package module
v0.0.0-...-13acdeb Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2015 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
const AST_CAUSE_ACCESS_INFO_DISCARDED = 43
View Source
const AST_CAUSE_ANSWERED_ELSEWHERE = 26
View Source
const AST_CAUSE_BEARERCAPABILITY_NOTAUTH = 57
View Source
const AST_CAUSE_BEARERCAPABILITY_NOTAVAIL = 58
View Source
const AST_CAUSE_BEARERCAPABILITY_NOTIMPL = 65
View Source
const AST_CAUSE_CALL_AWARDED_DELIVERED = 7
View Source
const AST_CAUSE_CALL_REJECTED = 21
View Source
const AST_CAUSE_CHANNEL_UNACCEPTABLE = 6
View Source
const AST_CAUSE_CHAN_NOT_IMPLEMENTED = 66
View Source
const AST_CAUSE_DESTINATION_OUT_OF_ORDER = 27
View Source
const AST_CAUSE_FACILITY_NOT_IMPLEMENTED = 69
View Source
const AST_CAUSE_FACILITY_NOT_SUBSCRIBED = 50
View Source
const AST_CAUSE_FACILITY_REJECTED = 29
View Source
const AST_CAUSE_IE_NONEXIST = 99
View Source
const AST_CAUSE_INCOMING_CALL_BARRED = 54
View Source
const AST_CAUSE_INCOMPATIBLE_DESTINATION = 88
View Source
const AST_CAUSE_INTERWORKING = 127
View Source
const AST_CAUSE_INVALID_CALL_REFERENCE = 81
View Source
const AST_CAUSE_INVALID_IE_CONTENTS = 100
View Source
const AST_CAUSE_INVALID_MSG_UNSPECIFIED = 95
View Source
const AST_CAUSE_INVALID_NUMBER_FORMAT = 28
View Source
const AST_CAUSE_MANDATORY_IE_LENGTH_ERROR = 103
View Source
const AST_CAUSE_MANDATORY_IE_MISSING = 96
View Source
const AST_CAUSE_MESSAGE_TYPE_NONEXIST = 97
View Source
const AST_CAUSE_MISDIALLED_TRUNK_PREFIX = 5
View Source
const AST_CAUSE_NETWORK_OUT_OF_ORDER = 38
View Source
const AST_CAUSE_NORMAL_CIRCUIT_CONGESTION = 34
View Source
const AST_CAUSE_NORMAL_CLEARING = 16
View Source
const AST_CAUSE_NORMAL_TEMPORARY_FAILURE = 41
View Source
const AST_CAUSE_NORMAL_UNSPECIFIED = 31
View Source
const AST_CAUSE_NO_ANSWER = 19
View Source
const AST_CAUSE_NO_ROUTE_DESTINATION = 3
View Source
const AST_CAUSE_NO_ROUTE_TRANSIT_NET = 2
View Source
const AST_CAUSE_NO_USER_RESPONSE = 18
View Source
const AST_CAUSE_NUMBER_CHANGED = 22
View Source
const AST_CAUSE_NUMBER_PORTED_NOT_HERE = 14
View Source
const AST_CAUSE_OUTGOING_CALL_BARRED = 52
View Source
const AST_CAUSE_PRE_EMPTED = 8
View Source
const AST_CAUSE_PROTOCOL_ERROR = 111
View Source
const AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE = 102
View Source
const AST_CAUSE_REDIRECTED_TO_NEW_DESTINATION = 23
View Source
const AST_CAUSE_REQUESTED_CHAN_UNAVAIL = 44
View Source
const AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY = 30
View Source
const AST_CAUSE_SUBSCRIBER_ABSENT = 20
View Source
const AST_CAUSE_SWITCH_CONGESTION = 42
View Source
const AST_CAUSE_UNALLOCATED = 1
View Source
const AST_CAUSE_USER_BUSY = 17
View Source
const AST_CAUSE_WRONG_CALL_STATE = 101
View Source
const AST_CAUSE_WRONG_MESSAGE = 98
View Source
const AsteriskDateFormat = "2006-01-02T15:04:05.000-0700"

Variables

View Source
var (
	DefaultBaseUri  = "http://216.66.0.147:8088/ari"
	DefaultWsUri    = "ws://216.66.0.147:8088/ari/events"
	DefaultUsername = "enswitch"
	DefaultSecret   = "enswitchDev"
)
View Source
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

func NewBridgeContext(ctx context.Context, b *Bridge) context.Context

NewBridgeContext returns a context with the bridge attached

func NewBridgeContextWithKey

func NewBridgeContextWithKey(ctx context.Context, b *Bridge, name string) context.Context

NewBridgeContextWithKey returns a context with the bridge attached as the given key

func NewChannelContext

func NewChannelContext(ctx context.Context, c *Channel) context.Context

NewChannelContext returns a context with the channel attached

func NewChannelContextWithKey

func NewChannelContextWithKey(ctx context.Context, c *Channel, name string) context.Context

NewChannelContext returns a context with the channel attached as the given key

func NewClientContext

func NewClientContext(ctx context.Context, c *Client) context.Context

NewClientContext returns a context with the client attached

func NewClientContextWithKey

func NewClientContextWithKey(ctx context.Context, c *Client, name string) context.Context

NewClientContextWithKey returns a context with the client attached as the given key

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

type AsteriskDate time.Time

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

func BridgeFromContext(ctx context.Context) (*Bridge, bool)

BridgeFromContext returns the default Bridge stored in the context

func BridgeFromContextWithKey

func BridgeFromContextWithKey(ctx context.Context, name string) (*Bridge, bool)

BridgeFromContextWithKey returns the Bridge stored in the context

func (*Bridge) Add

func (b *Bridge) Add(channelId string) error

Add adds a channel to the bridge

func (*Bridge) Delete

func (b *Bridge) Delete() error

Delete destroys the bridge

func (*Bridge) Remove

func (b *Bridge) Remove(channelId string) error

Remove removes a channel from the bridge

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

type BridgeCreated struct {
	Event
	Bridge Bridge `json:"bridge"`
}

BridgeCreated events indicate a bridge has been created

type BridgeDestroyed

type BridgeDestroyed struct {
	Event
	Bridge Bridge `json:"bridge"`
}

BridgeDestroyed events indicate a bridge has been destroyed

type BridgeEvent

type BridgeEvent struct {
	Event
	Bridge Bridge `json:"bridge,omitempty"` // Affected bridge
}

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

type CallerId struct {
	Name   string `json:"name"`
	Number string `json:"number"`
}

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

func (*CallerId) String

func (cid *CallerId) String() string

String returns the stringified callerid

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

func ChannelFromContext(ctx context.Context) (*Channel, bool)

ChannelFromContext returns the default Channel stored in the context

func ChannelFromContextWithKey

func ChannelFromContextWithKey(ctx context.Context, name string) (*Channel, bool)

ChannelFromContextWithKey returns the default Channel stored in the context

func (*Channel) Answer

func (c *Channel) Answer() error

Answer answers the current channel

func (*Channel) AttachClient

func (c *Channel) AttachClient(a *Client)

AttachClient attaches the provided ARI client to the channel

func (*Channel) Busy

func (c *Channel) Busy() error

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

func (*Channel) Congestion

func (c *Channel) Congestion() error

Congestion hangs up the current channel with the "congestion" cause code

func (*Channel) Continue

func (c *Channel) Continue(context string, extension string, priority int64) error

Continue causes the current channel to continue in the dialplan

func (*Channel) Get

func (c *Channel) Get(name string) (string, error)

Get retrieves a channel variable from the channel

func (*Channel) GetClient

func (c *Channel) GetClient() *Client

GetClient returns the ARI client which created the channel

func (*Channel) Hangup

func (c *Channel) Hangup() error

Hangup hangs up the current channel

func (*Channel) Hold

func (c *Channel) Hold() error

Hold puts the channel on hold

func (*Channel) MOH

func (c *Channel) MOH(mohClass string) error

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

func (*Channel) Mute

func (c *Channel) Mute(dir string) error

Mute mutes the channel in the given direction (one of "in", "out", or "both")

func (*Channel) Play

func (c *Channel) Play(mediaUri string) (string, error)

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) Ring

func (c *Channel) Ring() error

Ring indicates ringing to the channel

func (*Channel) SendDTMF

func (c *Channel) SendDTMF(dtmf string) error

SendDTMF sends DTMF to the channel

func (*Channel) Set

func (c *Channel) Set(name string, value string) error

Set sets a channel variable of the channel

func (*Channel) Silence

func (c *Channel) Silence() error

Silence transmits silence (comfort noise) to the channel

func (*Channel) Snoop

func (c *Channel) Snoop() (string, error)

Snoop begins a snoop session and returns its id TODO: what is the channel being returned; do we need it?

func (*Channel) StopMOH

func (c *Channel) StopMOH() error

StopMOH stops playing of music on hold to the channel

func (*Channel) StopRing

func (c *Channel) StopRing() error

StopRing stops ringing on the channel

func (*Channel) StopSilence

func (c *Channel) StopSilence() error

StopSilence stops transmission of silence to channel

func (*Channel) Unhold

func (c *Channel) Unhold() error

Unhold retrieves the channel from hold

func (*Channel) Unmute

func (c *Channel) Unmute(dir string) error

Unmute stops muting of the channel in the given direction (one of "in", "out", or "both")

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

type ChannelCreated struct {
	Event
	Channel Channel `json:"channel"`
}

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

type ChannelEvent struct {
	Event
	Channel Channel `json:"channel,omitempty"` // Affected channel
}

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

type ChannelStateChange struct {
	Event
	Channel Channel `json:"channel"`
}

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

type ChannelTalkingStarted struct {
	Event
	Channel Channel `json:"channel"`
}

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

func ClientFromContext(ctx context.Context) (*Client, bool)

ClientFromContext returns the Client stored in the context with the default key

func ClientFromContextWithKey

func ClientFromContextWithKey(ctx context.Context, name string) (*Client, bool)

ClientFromContextWithKey returns the Client stored in the context with the given keyname

func NewClient

func NewClient(appName, aurl, wsurl, username, password string) (Client, error)

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

func (c *Client) AnswerChannel(channelId string) error

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

func (c *Client) BridgeDelete(bridgeId string) error

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

func (c *Client) BridgeStopMoh(bridgeId string) error

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

func (c *Client) ChangeDeviceState(deviceName string, deviceState string) error

Change the state of a device controlled by ARI. (Note - implicitly creates the device state). Equivalent to PUT /deviceStates/{deviceName}

func (*Client) ChangeMailboxState

func (c *Client) ChangeMailboxState(mailboxName string, oldMessages int, newMessages int) error

Change the state of a mailbox. (Note - implicitly creates the mailbox). Equivalent to PUT /mailboxes/{mailboxName}

func (*Client) CheckDirection

func (c *Client) CheckDirection(dir *string) error

func (*Client) Close

func (c *Client) Close()

Close an active client connection

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

func (c *Client) ControlPlayback(playbackId string, operation string) error

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

func (c *Client) DeleteDeviceState(deviceName string) error

Destroy a device-state controlled by ARI. Equivalent to DELETE /deviceStates/{deviceName}

func (*Client) DeleteMailbox

func (c *Client) DeleteMailbox(mailboxName string) error

Destroy a mailbox. Equivalent to DELETE /mailboxes/{mailboxName}

func (*Client) DeleteStoredRecording

func (c *Client) DeleteStoredRecording(recordingName string) error

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

func (c *Client) GetAsteriskVariable(variable string) (string, error)

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

func (*Client) GetBridge

func (c *Client) GetBridge(bridgeId string) (Bridge, error)

Get bridge details Equivalent to Get /bridges/{bridgeId}

func (*Client) GetChannel

func (c *Client) GetChannel(channelId string) (Channel, error)

Get a specific channel's details Equivalent to Get /channels/{channelId}

func (*Client) GetChannelVariable

func (c *Client) GetChannelVariable(channelId string, variable string) (Variable, error)

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

func (c *Client) GetEndpoint(tech string, resource string) (Endpoint, error)

GetEndpoint requests the details of an endpoint from Asterisk

func (*Client) GetEndpointsByTech

func (c *Client) GetEndpointsByTech(tech string) ([]Endpoint, error)

List available endpoints for a given endpoint technology Equivalent to Get /endpoints/{tech}

func (*Client) GetEvents

func (c *Client) GetEvents(app string) (Message, error)

Websocket connection for events Equivalent to GET /events

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

func (c *Client) GetMailbox(mailboxName string) (Mailbox, error)

Retrieve the current state of a specific mailbox Equivalent to GET /mailboxes/{mailboxName}

func (*Client) GetPlaybackDetails

func (c *Client) GetPlaybackDetails(playbackId string) (Playback, error)

Get a playback's details Equivalent to GET /playbacks/{playbackId}

func (*Client) GetSound

func (c *Client) GetSound(soundId string) (Sound, error)

Get a sound's details Equivalent to GET /sounds/{soundId}

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) Go

func (c *Client) Go()

Go maintains a websocket connection until told to stop

func (*Client) HangupChannel

func (c *Client) HangupChannel(channelId string, reason string) error

Delete (i.e. hangup) a channel. Equivalent to DELETE /channels/{channelId}

func (*Client) HoldChannel

func (c *Client) HoldChannel(channelId string) error

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

func (c *Client) ListBridges() ([]Bridge, error)

List all active bridges in Asterisk Equivalent to GET /bridges

func (*Client) ListChannels

func (c *Client) ListChannels() ([]Channel, error)

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

func (c *Client) ListEndpoints() ([]Endpoint, error)

ListEndpoints lists all endpoints TODO: associated with the application, or on the entire system?

func (*Client) ListMailboxes

func (c *Client) ListMailboxes() ([]Mailbox, error)

List all mailboxes on asterisk server Equivalent to GET /mailboxes

func (*Client) ListSounds

func (c *Client) ListSounds(filters map[string]string) ([]Sound, error)

ListSounds returns a list of (all) the available sounds

func (*Client) ListSoundsFiltered

func (c *Client) ListSoundsFiltered(filters map[string]string) ([]Sound, error)

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) Listen

func (c *Client) Listen(closedChan chan bool)

Listen waits for events on the Websocket connection

func (*Client) MuteChannel

func (c *Client) MuteChannel(channelId string, direction string) error

Mute a channel Equivalent to Post /channels/{channelId}/mute Viable options are "in," "out," or "both"

func (*Client) MuteLiveRecording

func (c *Client) MuteLiveRecording(recordingName string) error

Mute a live recording Equivalent to Post /recordings/live/{recordingName}/mute

func (*Client) NewBridge

func (c *Client) NewBridge() (Bridge, error)

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

func (c *Client) ParseMessage(data []byte)

Parse a websocket message and send it to the Events chan

func (*Client) PauseLiveRecording

func (c *Client) PauseLiveRecording(recordingName string) error

Pause a live recording Equivalent to Post /recordings/live/{recordingName}/pause

func (*Client) PlayMOHToChannel

func (c *Client) PlayMOHToChannel(channelId string, mohClass string) error

Play music on hold to a channel Equivalent to Post /channels/{channelId}/moh

func (*Client) PlayMedia

func (c *Client) PlayMedia(channelId, mediaUri string) (string, error)

PlayMedia is a wrapper to initiate a playback with the given Media URI, returning the playback id

func (*Client) PlayMusicOnHold

func (c *Client) PlayMusicOnHold(bridgeId string, mohClass string) error

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

func (c *Client) PlaySilenceToChannel(channelId string) error

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

func (c *Client) RemoveChannel(bridgeId string, channelId string) error

Remove a specific channel from a bridge Equivalent to Post /bridges/{bridgeId}/removeChannel

func (*Client) ResumeLiveRecording

func (c *Client) ResumeLiveRecording(recordingName string) error

Unpause a live recording Equivalent to DELETE /recordings/live/{recordingName}/pause

func (*Client) RingChannel

func (c *Client) RingChannel(channelId string) error

Indicate ringing to a channel Equivalent to Post /channels/{channelId}/ring

func (*Client) ScrapLiveRecording

func (c *Client) ScrapLiveRecording(recordingName string) error

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

func (c *Client) SendMessage(from, tech, resource, body string, vars map[string]string) error

SendMessage sends a text message to an endpoint

func (*Client) SendMessageByUri

func (c *Client) SendMessageByUri(from, to, body string, vars map[string]string) error

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

func (*Client) SetAsteriskVariable

func (c *Client) SetAsteriskVariable(variable string, value string) error

Equivalent to POST /asterisk/variable

func (*Client) SetChannelVariable

func (c *Client) SetChannelVariable(channelId string, variable string, value string) error

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

func (c *Client) StopHoldChannel(channelId string) error

Remove a channel from hold Equivalent to DELETE /channels/{channelId}/hold

func (*Client) StopLiveRecording

func (c *Client) StopLiveRecording(recordingName string) error

Stop and store a live recording Equivalent to Post /recordings/live/{recordingName}/stop

func (*Client) StopMohChannel

func (c *Client) StopMohChannel(channelId string) error

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

func (c *Client) StopRinging(channelId string) error

Stop ringing indication on a channel if locally generated. Equivalent to DELETE /channels/{channelId}/ring

func (*Client) StopSilenceChannel

func (c *Client) StopSilenceChannel(channelId string) error

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

func (c *Client) UnMuteChannel(channelId string, direction string) error

Unmute a channel Equivalent to DELETE /channels/{channelId}/mute

func (*Client) UnmuteLiveRecording

func (c *Client) UnmuteLiveRecording(recordingName string) error

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

type DeviceState struct {
	Name  string `json:"name"`
	State string `json:"state"`
}

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

type EndpointStateChange struct {
	Event
	Endpoint Endpoint `json:"endpoint"`
}

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

func NewEvent

func NewEvent(raw []byte) (*Event, error)

NewEvent constructs an Event from a byte slice (unmarshals the event from Ari)

type FormatLangPair

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

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) Delete

func (l *LiveRecording) Delete() error

Delete current LiveRecording

func (*LiveRecording) Mute

func (l *LiveRecording) Mute() error

Mute current LiveRecording

func (*LiveRecording) Pause

func (l *LiveRecording) Pause() error

Pause current LiveRecording

func (*LiveRecording) Resume

func (l *LiveRecording) Resume() error

Unpause current LiveRecording

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

func (*LiveRecording) Unmute

func (l *LiveRecording) Unmute() error

Unmute 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

func NewMessage(raw []byte) (*Message, error)

Construct a Message from a byte slice

type MessageRawer

type MessageRawer interface {
	SetRaw(*[]byte)
	GetRaw() *[]byte
}

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 PlayMediaRequest struct {
	Media    string `json:"media"`
	Lang     string `json:"lang,omitempty"`
	Offsetms int    `json:"offsetms,omitempty"`
	Skipms   int    `json:"skipms,omitempty"`

	//PlaybackId unnecessary if specifically naming it in query path
	PlaybackId string `json:"playbackId,omitempty"`
}

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
}

func (*Playback) Control

func (p *Playback) Control(operation string) error

Control the current Playback

func (*Playback) Stop

func (p *Playback) Stop() error

Stop the current Playback.

type PlaybackFinished

type PlaybackFinished struct {
	Event
	Playback Playback `json:"playback"`
}

PlaybackFinished events indicate that a media playback operation has completed

type PlaybackStarted

type PlaybackStarted struct {
	Event
	Playback Playback `json:"playback"`
}

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 StasisEnd

type StasisEnd struct {
	Event
	Args    []string `json:"args"`
	Channel Channel  `json:"channel"`
}

StasisEnd events indicate that a channel has left the Stasis (Ari) application

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

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

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

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

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

type Variable

type Variable struct {
	Value string `json:"value"`
}

Variable describes the value of a channel variable

NOTE: the variable name is not included, so it must be
tracked with the request

Jump to

Keyboard shortcuts

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