inboundxml

package
v0.0.0-...-a5614b4 Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conference

type Conference struct {
	Value                  string `xml:",chardata"`
	Muted                  bool   `xml:"muted,attr,omitempty"`
	Beep                   bool   `xml:"beep,attr,omitempty"`
	StartConferenceOnEnter bool   `xml:"startConferenceOnEnter,attr,omitempty"`
	EndConferenceOnExit    bool   `xml:"endConferenceOnExit,attr,omitempty"`
	MaxParticipants        int    `xml:"maxParticipants,attr,omitempty"`
	WaitSound              string `xml:"waitSound,attr,omitempty"`
	HangupOnStar           bool   `xml:"hangupOnStar,attr,omitempty"`
	CallbackUrl            string `xml:"callbackUrl,attr,omitempty"`
	CallbackMethod         string `xml:"callbackMethod,attr,omitempty"`
	DigitsMatch            string `xml:"digitsMatch,attr,omitempty"`
	StayAlone              bool   `xml:"stayAlone,attr,omitempty"`
	Record                 bool   `xml:"record,attr,omitempty"`
	RecordCallbackUrl      string `xml:"recordCallbackUrl,attr,omitempty"`
	RecordFileFormat       string `xml:"recordFileFormat,attr,omitempty"`
}

The conference room can be limited to a certain number of participants by setting the maxParticipants attribute. The endConferenceOnExit attribute is used to end a conference when an specific user (or any one of many users) exits.

type Dial

type Dial struct {
	Value             string      `xml:",chardata"`
	Action            string      `xml:"action,attr,omitempty"`
	Method            string      `xml:"method,attr,omitempty"`
	TimeLimit         int         `xml:"timeLimit,attr,omitempty"`
	CallerId          string      `xml:"callerId,attr,omitempty"`
	HideCallerId      bool        `xml:"hideCallerId,attr,omitempty"`
	DialMusic         string      `xml:"dialMusic,attr,omitempty"`
	CallbackUrl       string      `xml:"callbackUrl,attr,omitempty"`
	CallbackMethod    string      `xml:"callbackMethod,attr,omitempty"`
	ConfirmSound      string      `xml:"confirmSound,attr,omitempty"`
	DigitsMatch       string      `xml:"digitsMatch,attr,omitempty"`
	StraightToVm      bool        `xml:"straightToVm,attr,omitempty"`
	HeartbeatUrl      string      `xml:"heartbeatUrl,attr,omitempty"`
	HeartbeatMethod   string      `xml:"heartbeatMethod,attr,omitempty"`
	ForwardedFrom     int         `xml:"forwardedFrom,attr,omitempty"`
	IfMachine         string      `xml:"ifMachine,attr,omitempty"`
	IfMachineUrl      string      `xml:"ifMachineUrl,attr,omitempty"`
	IfMachineMethod   string      `xml:"ifMachineMethod,attr,omitempty"`
	Record            bool        `xml:"record,attr,omitempty"`
	RecordDirection   string      `xml:"recordDirection,attr,omitempty"`
	RecordCallbackUrl string      `xml:"recordCallbackUrl,attr,omitempty"`
	Conference        *Conference `xml:"Conference,omitempty"`
	Number            *Number     `xml:"Number,omitempty"`
	Sip               *Sip        `xml:"Sip,omitempty"`
}

The callerId attribute can be set to any number, and will default to the caller id of the original caller. The number to be dialed should be nested within the <Dial> element. For more options, use the <Number>, <Sip> or <Conference> elements instead of a simple phone number.

type Gather

type Gather struct {
	Input       string `xml:"input,attr,omitempty"`
	Language    string `xml:"language,attr,omitempty"`
	Hints       string `xml:"hints,attr,omitempty"`
	Action      string `xml:"action,attr,omitempty"`
	Method      string `xml:"method,attr,omitempty"`
	Timeout     int    `xml:"timeout,attr,omitempty"`
	FinishOnKey string `xml:"finishOnKey,attr,omitempty"`
	NumDigits   int    `xml:"numDigits,attr,omitempty"`
	Say         *Say   `xml:"Say,omitempty"`
	Play        *Play  `xml:"Play,omitempty"`
	Pause       *Pause `xml:"Pause,omitempty"`
}

By default, an unlimited number of digits can be gathered. <Gather> will timeout after 5 seconds or once the ‘#’ key is pressed. The gathered digits will then be submitted to the current InboundXML document. This default behavior of <Gather> can be altered using the provided element attributes.

type Hangup

type Hangup struct {
	Schedule int    `xml:"schedule,attr,omitempty"`
	Reason   string `xml:"reason,attr,omitempty"`
}

The <Hangup> element will hangup the current call.

type InboundXML

type InboundXML struct {
	Response    Response `xml:"Response"`
	RenderCache []byte
}

InboundXML -

func New

func New(r Response) (*InboundXML, error)

New -

func (*InboundXML) GetSchema

func (i *InboundXML) GetSchema() ([]byte, error)

GetSchema -

func (*InboundXML) Marshal

func (i *InboundXML) Marshal() (string, error)

Marshal -

func (*InboundXML) String

func (i *InboundXML) String() (response string)

String -

func (*InboundXML) Validate

func (i *InboundXML) Validate() error

Validate -

type Invalid

type Invalid struct{}

Invalid - Element used to validate/invalidate elements. Used across the tests

type Mms

type Mms struct {
	Value          string `xml:",chardata"`
	To             string `xml:"to,attr,omitempty"`
	From           string `xml:"from,attr,omitempty"`
	MediaUrl       string `xml:"mediaUrl,attr,omitempty"`
	Action         string `xml:"action,attr,omitempty"`
	Method         string `xml:"method,attr,omitempty"`
	StatusCallback string `xml:"statusCallback,attr,omitempty"`
}

The action attribute can be used to direct the MMS to a new InboundXML document for processing. If directed to a new InboundXML using the action attribute, all InboundXML beneath the <Mms> element in the originating InboundXML document is disregarded. Similarly, the statusCallback attribute is provided to report the outcome of the MMS transmission.

type Number

type Number struct {
	Value      string `xml:",chardata"`
	SendDigits string `xml:"sendDigits,attr,omitempty"`
}

The <Number> element must be nested within the <Dial> element. <Number> can be used to dial multiple phones simultaneously by using additional <Number> elements. If multiple <Number> elements are used to specify additional calls, the first call to answer is connected, and the rest of the outgoing calls are canceled. <Number> can also be used to send DTMF tones to called parties with the sendDigits attribute.

type Pause

type Pause struct {
	Length int `xml:"length,attr,omitempty"`
}

The <Pause> element will pause the call for the number of seconds set by the length attribute.

type Ping

type Ping struct {
	Value  string `xml:",chardata"`
	Method string `xml:"method,attr,omitempty"`
}

The <Ping> element is provided as a flexible way to send the default voice request parameters to a URL during a call. The URL to ping is nested within the opening and closing tags of this element.

type Play

type Play struct {
	Value  string `xml:",chardata"`
	Loop   int    `xml:"loop,attr,omitempty"`
	Method string `xml:"method,attr,omitempty"`
}

Say - InboundXML element plays an audio file for the caller. More information at: http://docs.zang.io/docs/play

Example:

ixml, err := New(Response{Play: &Play{
			Loop: 1,
			Value: "tone_stream://%(10000,0,350,440)",
}})

fmt.Println(inxml.String())

type PlayLastRecording

type PlayLastRecording struct{}

PlayLastRecording - InboundXML element used to play back recorded audio to callers. More information at: http://docs.zang.io/docs/playlastrecording

type Record

type Record struct {
	Action             string `xml:"action,attr,omitempty"`
	Method             string `xml:"method,attr,omitempty"`
	Timeout            int    `xml:"timeout,attr,omitempty"`
	FinishOnKey        string `xml:"finishOnKey,attr,omitempty"`
	MaxLength          int    `xml:"maxLength,attr,omitempty"`
	Transcribe         bool   `xml:"transcribe,attr,omitempty"`
	TranscribeQuality  string `xml:"transcribeQuality,attr,omitempty"`
	TranscribeCallback string `xml:"transcribeCallback,attr,omitempty"`
	PlayBeep           bool   `xml:"playBeep,attr,omitempty"`
	Direction          string `xml:"direction,attr,omitempty"`
	FileFormat         string `xml:"fileFormat,attr,omitempty"`
	Background         bool   `xml:"background,attr,omitempty"`
	TrimSilence        bool   `xml:"trimSilence,attr,omitempty"`
}

Note: no more than than 5 recordings may be attached to a call

type Redirect

type Redirect struct {
	Value  string `xml:",chardata"`
	Method string `xml:"method,attr,omitempty"`
}

The <Redirect> element directs the call to another InboundXML document. The URL of the InboundXML document is nested within the <Redirect> element, and the method attribute sets if the request will be a GET or POST. In addition to the default voice request parameters, the parameter UrlBase will also be forwarded when the redirect request is made. UrlBase points to the base InboundXML document where the <Redirect> occurred.

type Reject

type Reject struct {
	Reason string `xml:"reason,attr,omitempty"`
}

Reject - InboundXML Verb designed reject the call More information at: http://docs.zang.io/docs/reject

type Response

type Response struct {
	Say               *Say               `xml:"Say,omitempty"`
	Play              *Play              `xml:"Play,omitempty"`
	Reject            *Reject            `xml:"Reject,omitempty"`
	Invalid           *Invalid           `xml:"Invalid,omitempty"`
	PlayLastRecording *PlayLastRecording `xml:"PlayLastRecording,omitempty"`
	Dial              *Dial              `xml:"Dial,omitempty"`
	Gather            *Gather            `xml:"Gather,omitempty"`
	Hangup            *Hangup            `xml:"Hangup,omitempty"`
	Pause             *Pause             `xml:"Pause,omitempty"`
	Ping              *Ping              `xml:"Ping,omitempty"`
	Record            *Record            `xml:"Record,omitempty"`
	Redirect          *Redirect          `xml:"Redirect,omitempty"`
	Sms               *Sms               `xml:"Sms,omitempty"`
	Mms               *Mms               `xml:"Mms,omitempty"`
}

Response - Main InboundXML verbs container element. REQUIRED More information at: http://docs.zang.io/docs/response

type Say

type Say struct {
	Value    string `xml:",chardata"`
	Voice    string `xml:"voice,attr,omitempty"`
	Language string `xml:"language,attr,omitempty"`
	Loop     int    `xml:"loop,attr,omitempty"`
}

Say - InboundXML Verb designed to do a TTS speech towards callee More information at: http://docs.zang.io/docs/say

Example:

ixml, err := New(Response{Say: &Say{
			Voice: "female",
			Value: "Lorem Ipsum dolor sit amet",
}})

fmt.Println(inxml.String())

type Sip

type Sip struct {
	Value    string `xml:",chardata"`
	Username string `xml:"username,attr,omitempty"`
	Password string `xml:"password,attr,omitempty"`
}

If multiple <Sip> elements are used, the first call to answer is connected and the rest of the outgoing calls are canceled.

type Sms

type Sms struct {
	Value          string `xml:",chardata"`
	To             string `xml:"to,attr,omitempty"`
	From           string `xml:"from,attr,omitempty"`
	Action         string `xml:"action,attr,omitempty"`
	Method         string `xml:"method,attr,omitempty"`
	StatusCallback string `xml:"statusCallback,attr,omitempty"`
}

The action attribute can be used to direct the SMS to a new InboundXML document for processing. If directed to a new InboundXML using the action attribute, all InboundXML beneath the <Sms> element in the originating InboundXML document is disregarded. Similarly, the statusCallback attribute is provided to report the outcome of the SMS transmission.

Jump to

Keyboard shortcuts

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