tropo

package
v0.0.0-...-8f513ac Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2016 License: MIT Imports: 7 Imported by: 1

Documentation

Overview

REST API Wrapper

see postman collection

Index

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 Command

type Command interface {
	MarshalJSON() ([]byte, error)
}

tagging interface for commands, ie, encoding.json.Marshaler

type CommunicationHandler

type CommunicationHandler struct {
	// contains filtered or unexported fields
}

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

func (compo *Composer) AddCommand(cmd Command)

type OnCommand

type OnCommand struct {
	Event    string `json:"event"`
	Next     string `json:"next"`
	Required bool   `json:"required,omitempty"`
}

func (*OnCommand) MarshalJSON

func (cmd *OnCommand) MarshalJSON() ([]byte, error)

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 RecordTranscription struct {
	ID  string `json:"id,omitempty"`
	URL string `json:"url,omitempty"`
}

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

type SayCommand struct {
	Message string `json:"value"`
	Voice   *Voice `json:"voice,omitempty"`
}

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

func (session *Session) IsCall() bool

func (*Session) IsHumanInitiated

func (session *Session) IsHumanInitiated() bool

type Voice

type Voice struct {
	Lang   locale      `json:"-"`
	Gender gender      `json:"-"`
	Env    environment `json:"-"`
	// contains filtered or unexported fields
}

func GetVoice

func GetVoice(code string) *Voice

func (*Voice) MarshalJSON

func (voice *Voice) MarshalJSON() ([]byte, error)

func (*Voice) Name

func (voice *Voice) Name() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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