Documentation ¶
Overview ¶
REST API Wrapper
see postman collection
Index ¶
- Constants
- Variables
- type Command
- type CommunicationHandler
- func (d *CommunicationHandler) DecodeRecordingAnswer() (*RecordingResult, error)
- func (d *CommunicationHandler) DecodeSession() (*Session, error)
- func (handler *CommunicationHandler) ExecuteCommand(cmd Command) error
- func (handler *CommunicationHandler) ExecuteComposer(compo *Composer) error
- func (d *CommunicationHandler) NewComposer() *Composer
- func (handler *CommunicationHandler) ReplyBadRequest(message string)
- func (handler *CommunicationHandler) ReplyInternalError(reason string, message string)
- func (handler *CommunicationHandler) Say(message string, voice *Voice) error
- func (handler *CommunicationHandler) SendRawJSON(jsonString string) error
- type Composer
- type OnCommand
- type RecordChoices
- type RecordCommand
- type RecordTranscription
- type RecordingResult
- type SayCommand
- type Session
- type Voice
Constants ¶
View Source
const ( STATE_ANSWERED recordingState = "ANSWERED" STATE_DISCONNECTED recordingState = "DISCONNECTED" STATE_FAILED recordingState = "FAILED" )
View Source
const ( DEV environment = iota PROD )
View Source
const ( FEMALE gender = iota MALE )
Variables ¶
View Source
var VOICE_ALLISON = registerVoice("Allison", en_US, FEMALE, DEV)
View Source
var VOICE_AMELIE = registerVoice("Amelie", fr_CA, FEMALE, DEV)
View Source
var VOICE_AUDREY = registerVoice("Audrey", fr_FR, FEMALE, DEV)
View Source
var VOICE_AURELIE = registerVoice("Aurelie", fr_FR, FEMALE, DEV)
View Source
var VOICE_AVA = registerVoice("Ava", en_US, FEMALE, DEV)
View Source
var VOICE_CHANTAL = registerVoice("Chantal", fr_CA, FEMALE, DEV)
View Source
var VOICE_DEFAULT = VOICE_VANESSA // Tropo's default
View Source
var VOICE_NICOLAS = registerVoice("Nicolas", fr_CA, MALE, DEV)
View Source
var VOICE_SAMANTHA = registerVoice("Samantha", en_US, FEMALE, DEV)
View Source
var VOICE_SUSAN = registerVoice("Susan", en_US, FEMALE, DEV)
View Source
var VOICE_THOMAS = registerVoice("Thomas", fr_FR, MALE, DEV)
View Source
var VOICE_TOM = registerVoice("Tom", en_US, MALE, DEV)
View Source
var VOICE_VANESSA = registerVoice("Vanessa", en_US, FEMALE, DEV)
View Source
var VOICE_VERONICA = registerVoice("Veronica", en_US, FEMALE, DEV)
View Source
var VOICE_VICTOR = registerVoice("Victor", en_US, MALE, DEV)
Functions ¶
This section is empty.
Types ¶
type CommunicationHandler ¶
type CommunicationHandler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(w http.ResponseWriter, req *http.Request) *CommunicationHandler
func (*CommunicationHandler) DecodeRecordingAnswer ¶
func (d *CommunicationHandler) DecodeRecordingAnswer() (*RecordingResult, error)
func (*CommunicationHandler) DecodeSession ¶
func (d *CommunicationHandler) DecodeSession() (*Session, error)
func (*CommunicationHandler) ExecuteCommand ¶
func (handler *CommunicationHandler) ExecuteCommand(cmd Command) error
func (*CommunicationHandler) ExecuteComposer ¶
func (handler *CommunicationHandler) ExecuteComposer(compo *Composer) error
Sends outgoing payload
func (*CommunicationHandler) NewComposer ¶
func (d *CommunicationHandler) NewComposer() *Composer
Starts composing an outgoing payload
func (*CommunicationHandler) ReplyBadRequest ¶
func (handler *CommunicationHandler) ReplyBadRequest(message string)
func (*CommunicationHandler) ReplyInternalError ¶
func (handler *CommunicationHandler) ReplyInternalError(reason string, message string)
func (*CommunicationHandler) Say ¶
func (handler *CommunicationHandler) Say(message string, voice *Voice) error
func (*CommunicationHandler) SendRawJSON ¶
func (handler *CommunicationHandler) SendRawJSON(jsonString string) error
type Composer ¶
type Composer struct {
// contains filtered or unexported fields
}
helper to compose an outgoing payloaqd
func (*Composer) AddCommand ¶
type OnCommand ¶
type OnCommand struct { Event string `json:"event"` Next string `json:"next"` Required bool `json:"required,omitempty"` }
func (*OnCommand) MarshalJSON ¶
Commands interface
type RecordChoices ¶
type RecordChoices struct {
Terminator string `json:"terminator,omitempty"`
}
type RecordCommand ¶
type RecordCommand struct { Beep bool `json:"beep,omitempty"` Attempts int `json:"attempts,omitempty"` Bargein bool `json:"bargein,omitempty"` Choices *RecordChoices `json:"choices,omitempty"` MaxSilence int `json:"maxSilence,omitempty"` MaxTime int `json:"maxTime,omitempty"` Name string `json:"name,omitempty"` Timeout int `json:"timeout,omitempty"` URL string `json:"url,omitempty"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Format string `json:"format,omitempty"` AsyncUpload bool `json:"asyncUpload,omitempty"` Transcription *RecordTranscription `json:"transcription,omitempty"` }
func (*RecordCommand) MarshalJSON ¶
func (cmd *RecordCommand) MarshalJSON() ([]byte, error)
Commands interface
type RecordTranscription ¶
type RecordingResult ¶
type RecordingResult struct { SessionID string `json:"sessionId"` CallID string `json:"callId"` State recordingState `json:"state"` SessionDuration int `json:"sessionDuration"` Sequence int `json:"sequence"` Complete bool `json:"complete"` Error interface{} `json:"error"` CalledID string `json:"calledid"` Actions struct { Name string `json:"name"` Attempts int `json:"attempts"` Disposition string `json:"disposition"` Confidence int `json:"confidence"` Interpretation string `json:"interpretation"` Utterance string `json:"utterance"` Concept string `json:"concept"` Value string `json:"value"` XML string `json:"xml"` Duration int `json:"duration"` URL string `json:"url"` } `json:"actions"` }
type SayCommand ¶
func (*SayCommand) MarshalJSON ¶
func (cmd *SayCommand) MarshalJSON() ([]byte, error)
Commands interface
type Session ¶
type Session struct { ID string `json:"id"` AccountID string `json:"accountId"` Timestamp time.Time `json:"timestamp"` UserType string `json:"userType"` InitialText interface{} `json:"initialText"` CallID string `json:"callId"` To struct { ID string `json:"id"` Name interface{} `json:"name"` Channel string `json:"channel"` Network string `json:"network"` } `json:"to"` From struct { ID string `json:"id"` Name interface{} `json:"name"` Channel string `json:"channel"` Network string `json:"network"` } `json:"from"` Headers struct { MaxForwards string `json:"Max-Forwards"` Xsid string `json:"x-sid"` RecordRoute string `json:"Record-Route"` ContentLength string `json:"Content-Length"` Contact string `json:"Contact"` To string `json:"To"` Cseq string `json:"CSeq"` UserAgent string `json:"User-Agent"` Via string `json:"Via"` CallID string `json:"Call-ID"` ContentType string `json:"Content-Type"` From string `json:"From"` } `json:"headers"` }
func (*Session) IsHumanInitiated ¶
type Voice ¶
type Voice struct { Lang locale `json:"-"` Gender gender `json:"-"` Env environment `json:"-"` // contains filtered or unexported fields }
func (*Voice) MarshalJSON ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.