Skip to content

Commit 042cdb0

Browse files
committed
added comments documenting OnFinish; formatted code additions to conform to style
1 parent 6a93987 commit 042cdb0

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

voice/callflow.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,18 @@ type CallFlowRecordStep struct {
440440
// Allowed values: de-DE, en-AU, en-UK, en-US, es-ES, es-LA, fr-FR, it-IT, nl-NL, pt-BR.
441441
TranscribeLanguage string
442442

443+
// (Optional) OnFinish contains the URL to get a new CallFlow from when the recording terminates and this CallFlowRecordStep ends.
444+
//
445+
// The URL must contain a schema e.g. http://... or https://...
446+
// This attribute is used for chaining call flows. When the current step ends,
447+
// a POST request containing information about the recording is sent to the URL specified.
448+
// 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.
449+
//
450+
// To get at the recording information from the POST request body, you must call (instead of relying on req.Form):
451+
// ```go
452+
// body,_ := ioutil.ReadAll(req.Body)
453+
// recordingInfo := string(body[:])
454+
// ```
443455
OnFinish string
444456
}
445457

@@ -451,7 +463,7 @@ type jsonCallFlowRecordStep struct {
451463
Timeout int `json:"timeout"`
452464
FinishOnKey string `json:"finishOnKey"`
453465
TranscribeLanguage string `json:"transcribeLanguage"`
454-
OnFinish string `json:"onFinish"`
466+
OnFinish string `json:"onFinish"`
455467
} `json:"options"`
456468
}
457469

@@ -480,7 +492,7 @@ func (step *CallFlowRecordStep) UnmarshalJSON(data []byte) error {
480492
Timeout: time.Duration(raw.Options.Timeout) * time.Second,
481493
FinishOnKey: raw.Options.FinishOnKey,
482494
TranscribeLanguage: raw.Options.TranscribeLanguage,
483-
OnFinish: raw.Options.OnFinish,
495+
OnFinish: raw.Options.OnFinish,
484496
}
485497
return nil
486498
}

0 commit comments

Comments
 (0)