Skip to content

Commit

Permalink
Merge pull request #54 from zeddee/implement-onfinish-recording
Browse files Browse the repository at this point in the history
implemented onFinish attribute for CallFlowRecordStep
  • Loading branch information
marcel corso gonzalez committed Jan 9, 2020
2 parents 6f6cdb0 + 042cdb0 commit 1dbb310
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions voice/callflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,20 @@ type CallFlowRecordStep struct {
//
// Allowed values: de-DE, en-AU, en-UK, en-US, es-ES, es-LA, fr-FR, it-IT, nl-NL, pt-BR.
TranscribeLanguage string

// (Optional) OnFinish contains the URL to get a new CallFlow from when the recording terminates and this CallFlowRecordStep ends.
//
// The URL must contain a schema e.g. http://... or https://...
// This attribute is used for chaining call flows. When the current step ends,
// a POST request containing information about the recording is sent to the URL specified.
// This gets a new callflow from the URL specified, but re-uses the original Call ID and Leg ID i.e. it's the same Call.
//
// To get at the recording information from the POST request body, you must call (instead of relying on req.Form):
// ```go
// body,_ := ioutil.ReadAll(req.Body)
// recordingInfo := string(body[:])
// ```
OnFinish string
}

type jsonCallFlowRecordStep struct {
Expand All @@ -454,6 +468,7 @@ type jsonCallFlowRecordStep struct {
FinishOnKey string `json:"finishOnKey"`
Transcribe bool `json:"transcribe"`
TranscribeLanguage string `json:"transcribeLanguage"`
OnFinish string `json:"onFinish"`
} `json:"options"`
}

Expand All @@ -467,6 +482,7 @@ func (step *CallFlowRecordStep) MarshalJSON() ([]byte, error) {
data.Options.FinishOnKey = step.FinishOnKey
data.Options.Transcribe = step.Transcribe
data.Options.TranscribeLanguage = step.TranscribeLanguage
data.Options.OnFinish = step.OnFinish
return json.Marshal(data)
}

Expand All @@ -483,6 +499,7 @@ func (step *CallFlowRecordStep) UnmarshalJSON(data []byte) error {
FinishOnKey: raw.Options.FinishOnKey,
Transcribe: raw.Options.Transcribe,
TranscribeLanguage: raw.Options.TranscribeLanguage,
OnFinish: raw.Options.OnFinish,
}
return nil
}
Expand Down

0 comments on commit 1dbb310

Please sign in to comment.