Documentation ¶
Overview ¶
Web API to browse voice calls which have been answered by the AnsweringMachine.
Configuration API to read effective runtime configuration ¶
Utility to send json errors over HTTP ¶
Utility to persist messages among calls Note : recordings are stored to Recorder Server or Tropo File Storage, a pointer to the recording audio file is stored with each voice message entry
Index ¶
- Constants
- func AddConfEndpoint(machine *AnsweringMachine, route string)
- type AnsweringMachine
- type CheckMessagesWebAPI
- type CheckedStatus
- type EnvConfiguration
- type Error
- type HandlerRoutes
- type I18nMessages
- type MachineProgress
- type StorageInterface
- type VoiceMessage
- type VoiceMessageStorage
- func (storage *VoiceMessageStorage) CreateVoiceMessage(callID string, callerNumber string) *VoiceMessage
- func (storage *VoiceMessageStorage) FetchAllVoiceMessages() [](*VoiceMessage)
- func (storage *VoiceMessageStorage) FetchNewMessages() [](*VoiceMessage)
- func (storage *VoiceMessageStorage) GetVoiceMessageForCallID(callID string) (*VoiceMessage, error)
- func (storage *VoiceMessageStorage) MarkMessageAsRead(vm *VoiceMessage) error
- func (storage *VoiceMessageStorage) Store(msg *VoiceMessage) error
Constants ¶
const (
BOLT_BUCKET = "Answering-Machine"
)
Variables ¶
This section is empty.
Functions ¶
func AddConfEndpoint ¶
func AddConfEndpoint(machine *AnsweringMachine, route string)
Adds an endpoint to display the active runtime configuration of the AnsweringMachine. By default, the configuration is accessible at /conf Note that the configuration is defined at startup and cannot be changed afterwards
Types ¶
type AnsweringMachine ¶
type AnsweringMachine struct {
// contains filtered or unexported fields
}
func NewAnsweringMachine ¶
func NewAnsweringMachine(env *EnvConfiguration, messages *I18nMessages) *AnsweringMachine
func (*AnsweringMachine) RegisterHandlers ¶
func (app *AnsweringMachine) RegisterHandlers()
type CheckMessagesWebAPI ¶
type CheckMessagesWebAPI struct {
// contains filtered or unexported fields
}
func AddAdminEndpoint ¶
func AddAdminEndpoint(store *VoiceMessageStorage, route string) (*CheckMessagesWebAPI, error)
type CheckedStatus ¶
type CheckedStatus string
const ( NEW CheckedStatus = "NEW" CHECKED CheckedStatus = "CHECKED" DELETED CheckedStatus = "DELETED" UNDEFINED CheckedStatus = "UNDEFINED" )
type EnvConfiguration ¶
type EnvConfiguration struct { RecorderEndpoint string // URI to record the messages RecorderUsername string RecorderPassword string AudioServerEndpoint string TranscriptsReceiver string // email of the transcriptions receiver CheckerPhoneNumber string // phone number to check messages CheckerFirstName string // for greeting purpose DBfilename string DBresetAtStartup bool }
func LoadEnvConfiguration ¶
func LoadEnvConfiguration(filename string) *EnvConfiguration
type HandlerRoutes ¶
type HandlerRoutes struct { IncomingCallRoute string // route to the welcome message RecordingSuccessRoute string // invoked after message are recorded RecordingIncompleteRoute string // invoked if a timeout occurs RecordingFailedRoute string // invoked if the recording failed due to communication issues between Tropo and the AnsweringMachine CheckMessagesRoute string // endpoint to browse voice messages ConfigurationRoute string // endpoint to read runtime effective configuration }
func GetDefaultRoutes ¶
func GetDefaultRoutes() (routes *HandlerRoutes)
type I18nMessages ¶
type I18nMessages struct { DefaultVoice *tropo.Voice // see https://www.tropo.com/docs/webapi/international-features/speaking-multiple-languages WelcomeMessage string // message played at incoming calls WelcomeAltMessage string // message played at incoming calls when recording is not active CheckNoMessage string CheckNewMessages string RecordingOKMessage string RecordingFailedMessage string }
func GetDefaultMessages ¶
func GetDefaultMessages(filename string) *I18nMessages
func LoadMessagesConfiguration ¶
func LoadMessagesConfiguration(filename string) *I18nMessages
Load default messages from file The file is in json format and contains one or more of the entries: - GOLAM_VOICE - GOLAM_WELCOME - GOLAM_WELCOME_ALT - GOLAM_CHECK_NO_MESSAGE - GOLAM_CHECK_NEW_MESSAGES - GOLAM_RECORDING_OK - GOLAM_RECORDING_FAILED If an entry is not present, a default english message is added
type MachineProgress ¶
type MachineProgress string
const ( STARTED MachineProgress = "STARTED" RECORDED MachineProgress = "RECORDED" NOMESSAGE MachineProgress = "NOMESSAGE" // no message was left by caller FAILED MachineProgress = "FAILED" )
type StorageInterface ¶
type StorageInterface interface { CreateVoiceMessage() *VoiceMessage Store(msg *VoiceMessage) }
type VoiceMessage ¶
type VoiceMessage struct { CallID string CreatedAt time.Time CallerNumber string Progress MachineProgress // enum of STARTED, NOMESSAGE, RECORDED, FAILED Recording string // URL of the audio recording Duration int // number of seconds Transcript string // transcript contents if successful Status CheckedStatus // enum of NEW, CHECKED, DELETED, UNDEFINED CheckedAt time.Time }
type VoiceMessageStorage ¶
type VoiceMessageStorage struct {
// contains filtered or unexported fields
}
func NewStorage ¶
func NewStorage(dbName string, reset bool) (*VoiceMessageStorage, error)
Returns a message database storage engine. Messages are stored in specified file which is created if does not exists, The database is erased if reset arg is set to true An error is returned if the database cannot be opened
func (*VoiceMessageStorage) CreateVoiceMessage ¶
func (storage *VoiceMessageStorage) CreateVoiceMessage(callID string, callerNumber string) *VoiceMessage
func (*VoiceMessageStorage) FetchAllVoiceMessages ¶
func (storage *VoiceMessageStorage) FetchAllVoiceMessages() [](*VoiceMessage)
func (*VoiceMessageStorage) FetchNewMessages ¶
func (storage *VoiceMessageStorage) FetchNewMessages() [](*VoiceMessage)
func (*VoiceMessageStorage) GetVoiceMessageForCallID ¶
func (storage *VoiceMessageStorage) GetVoiceMessageForCallID(callID string) (*VoiceMessage, error)
func (*VoiceMessageStorage) MarkMessageAsRead ¶
func (storage *VoiceMessageStorage) MarkMessageAsRead(vm *VoiceMessage) error
func (*VoiceMessageStorage) Store ¶
func (storage *VoiceMessageStorage) Store(msg *VoiceMessage) error