Documentation ¶
Index ¶
Constants ¶
const AllDTMF = "0123456789ABCD*#"
AllDTMF is a string which contains all possible DTMF digits.
Variables ¶
var Logger = log15.New()
Logger defaults to a discard handler (null output). If you wish to enable logging, you can set your own handler like so:
ari.Logger.SetHandler(log15.StderrHandler)
var MaxPlaybackTime = 10 * time.Minute
MaxPlaybackTime is the maximum amount of time to allow for a playback to complete.
var PlaybackStartTimeout = 1 * time.Second
PlaybackStartTimeout is the time to allow for Asterisk to send the PlaybackStarted before giving up.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { // ID is an optional ID to use for the playback's ID. If one // is not supplied, an ID will be randomly generated internally. // NOTE that this ID will only be used for the FIRST playback // in a queue. All subsequent playback IDs will be randomly generated. ID string // ExitOnDTMF defines a list of DTMF digits on receipt of which will // terminate the playback of the queue. You may set this to AllDTMF // in order to match any DTMF digit. ExitOnDTMF string // Done is an optional channel for receiving notification when the playback // is complete. This is useful if the playback is to be executed asynchronously. // This channel will be closed by the playback when playback the is complete. Done chan<- struct{} }
Options describes various options which are available to playback operations.
type Playback ¶
type Playback struct {
// contains filtered or unexported fields
}
A Playback is a lifecycle managed audio object
func (*Playback) Handle ¶
func (p *Playback) Handle() *ari.PlaybackHandle
Handle returns the ARI reference to the playback object
func (*Playback) Started ¶
func (p *Playback) Started() <-chan struct{}
Started returns the channel that is closed when the playback has started
type Player ¶
type Player interface { ari.Subscriber // Play plays the audio using the given playback ID and media URI Play(string, string) (*ari.PlaybackHandle, error) }
A Player is an entity which can have an audio URI played and can have event subscriptions
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue represents a sequence of audio playbacks which are to be played on the associated Player
func (*Queue) Flush ¶
func (pq *Queue) Flush()
Flush empties a playback queue. NOTE that this does NOT stop the current playback.
func (*Queue) ReceivedDTMF ¶
ReceivedDTMF returns any DTMF which has been received by the PlaybackQueue.
type Status ¶
type Status int
Status indicates the status of the prompt operation.
const ( // InProgress indicates that the audio is currently playing InProgress Status = iota // Finished indicates that the audio playback finished successfully Finished // Canceled indicates that the audio was canceled Canceled // Timeout indicates that audio playback timed out Timeout // Hangup indicates that the audio was interrupted by hangup Hangup // Failed indicates that the audio playback failed Failed )