Skip to content

Commit

Permalink
add: tts param to telephony reactions say
Browse files Browse the repository at this point in the history
  • Loading branch information
Yamakuprina committed Jan 22, 2024
1 parent 1f7109b commit bf45aa9
Showing 1 changed file with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ class TelephonyReactions(private val bargeInDefaultProps: BargeInProperties) : J
*
* @param text to synthesis speech from
* @param bargeIn true to allow interruption and handle in in current dialog context
* @param tts true to allow SSML parsing of text
* */
fun say(text: String, bargeIn: Boolean) = when (bargeIn) {
true -> say(text, CURRENT_CONTEXT_PATH)
false -> say(text)
fun say(text: String, bargeIn: Boolean, tts: Boolean = false) = when (bargeIn) {
true -> say(text, CURRENT_CONTEXT_PATH, tts)
false -> if (tts) {
replies.add(TextReply(text, state = currentState, tts = text))
SayReaction.create(text)
} else say(text)
}

/**
Expand All @@ -50,10 +54,18 @@ class TelephonyReactions(private val bargeInDefaultProps: BargeInProperties) : J
*
* @param text to synthesis speech from speech from
* @param bargeInContext scenario context with states which should handle possible interruptions.
* @param tts true to allow SSML parsing of text
* */
fun say(text: String, @PathValue bargeInContext: String): SayReaction {
fun say(text: String, @PathValue bargeInContext: String, tts: Boolean): SayReaction {
ensureBargeInProps()
replies.add(TextReply(text, state = currentState, bargeInReply = BargeInReplyData(bargeInContext, BargeInType.INTENT)))
replies.add(
TextReply(
text,
state = currentState,
bargeInReply = BargeInReplyData(bargeInContext, BargeInType.INTENT),
tts = if (tts) text else null
)
)
return SayReaction.create(text)
}

Expand Down

0 comments on commit bf45aa9

Please sign in to comment.