github.com/CyCoreSystems/ari@v4.8.4+incompatible/recording.go (about)

     1  package ari
     2  
     3  import "time"
     4  
     5  // Recording is a namespace for the recording types
     6  type Recording struct {
     7  	Stored StoredRecording
     8  	Live   LiveRecording
     9  }
    10  
    11  // Recorder describes an interface of something which can Record
    12  type Recorder interface {
    13  	// Record starts a recording, using the provided options, and returning a handle for the live recording
    14  	Record(string, *RecordingOptions) (*LiveRecordingHandle, error)
    15  
    16  	// StageRecord stages a recording, using the provided options, and returning a handle for the live recording.  The recording will actually be started only when Exec() is called.
    17  	StageRecord(string, *RecordingOptions) (*LiveRecordingHandle, error)
    18  
    19  	// Subscribe subscribes to events from the Recorder
    20  	Subscribe(n ...string) Subscription
    21  }
    22  
    23  // RecordingOptions describes the set of options available when making a recording.
    24  type RecordingOptions struct {
    25  	// Format is the file format/encoding to which the recording should be stored.
    26  	// This will usually be one of: slin, ulaw, alaw, wav, gsm.
    27  	// If not specified, this will default to slin.
    28  	Format string
    29  
    30  	// MaxDuration is the maximum duration of the recording, after which the recording will
    31  	// automatically stop.  If not set, there is no maximum.
    32  	MaxDuration time.Duration
    33  
    34  	// MaxSilence is the maximum duration of detected to be found before terminating the recording.
    35  	MaxSilence time.Duration
    36  
    37  	// Exists determines what should happen if the given recording already exists.
    38  	// Valid values are: "fail", "overwrite", or "append".
    39  	// If not specified, it will default to "fail"
    40  	Exists string
    41  
    42  	// Beep indicates whether a beep should be played to the recorded
    43  	// party at the beginning of the recording.
    44  	Beep bool
    45  
    46  	// Terminate indicates whether the recording should be terminated on
    47  	// receipt of a DTMF digit.
    48  	// valid options are: "none", "any", "*", and "#"
    49  	// If not specified, it will default to "none" (never terminate on DTMF).
    50  	Terminate string
    51  }