@@ -5,6 +5,7 @@ import com.justai.jaicf.channel.jaicp.dto.JaicpDialerAPI
55import com.justai.jaicf.channel.jaicp.dto.JaicpResponseData
66import com.justai.jaicf.channel.jaicp.dto.Reply
77import com.justai.jaicf.channel.jaicp.dto.TextReply
8+ import com.justai.jaicf.channel.jaicp.jaicpRequest
89import com.justai.jaicf.channel.jaicp.logging.internal.SessionManager
910import com.justai.jaicf.context.DialogContext
1011import com.justai.jaicf.logging.EndSessionReaction
@@ -26,6 +27,8 @@ open class JaicpReactions : Reactions() {
2627
2728 protected val responseData: MutableMap <String , JsonElement > = mutableMapOf ()
2829
30+ private var ttsTokenData: JsonObject ? = null
31+
2932 internal fun getCurrentState () = botContext.dialogContext.currentState
3033
3134 /* *
@@ -77,6 +80,11 @@ open class JaicpReactions : Reactions() {
7780 fun collect (): JsonObject {
7881 doBeforeCollect()
7982
83+ ttsTokenData = checkNotNull(executionContext.jaicpRequest)
84+ .rawRequest.jsonObject[" asrTtsProviderData" ]?.jsonObject?.get(" tts" )?.jsonObject?.get(" tokenData" )?.jsonObject
85+ ? : ttsTokenData
86+ val ttsConfig = telephony?.ttsConfig?.copy(tokenData = ttsTokenData?.jsonObject)
87+
8088 return JSON .encodeToJsonElement(
8189 serializer = JaicpResponseData .serializer(),
8290 value = JaicpResponseData (
@@ -86,7 +94,7 @@ open class JaicpReactions : Reactions() {
8694 bargeInInterrupt = telephony?.bargeInInterrupt,
8795 sessionId = SessionManager .get(executionContext).getOrCreateSessionId().sessionId,
8896 responseData = responseData,
89- ttsConfig = telephony?. ttsConfig,
97+ ttsConfig = ttsConfig,
9098 asrConfig = telephony?.asrConfig
9199 )
92100 ).jsonObject
0 commit comments