From 490d23a703c536d8f27943b687b21550ced0224a Mon Sep 17 00:00:00 2001 From: Hoan HL Date: Wed, 14 Jan 2026 15:46:29 +0700 Subject: [PATCH] wip --- lib/synth-audio.js | 2 +- test/synth.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/synth-audio.js b/lib/synth-audio.js index 1ae9244..8597b51 100644 --- a/lib/synth-audio.js +++ b/lib/synth-audio.js @@ -435,7 +435,7 @@ const synthGoogle = async(logger, { } let params = '{'; - params += `credentials=${JSON.stringify(credentials)}`; + params += `credentials=${Buffer.from(JSON.stringify(credentials)).toString('base64')}`; params += `,playback_id=${key}`; params += ',vendor=google'; params += `,voice=${voice}`; diff --git a/test/synth.js b/test/synth.js index e6723cb..7b2cc12 100644 --- a/test/synth.js +++ b/test/synth.js @@ -306,6 +306,9 @@ test('Google TTS streaming tests (!JAMBONES_DISABLE_TTS_STREAMING)', async(t) => t.ok(result.filePath.includes('vendor=google'), 'Standard voice streaming path contains vendor=google'); t.ok(result.filePath.includes('use_live_api=0'), 'Standard voice uses use_live_api=0'); t.ok(result.filePath.includes('voice=en-US-Wavenet-D'), 'Standard voice streaming path contains voice'); + // Verify credentials are base64 encoded (no raw JSON braces that would break FreeSWitch parsing) + t.ok(result.filePath.includes('credentials='), 'Standard voice streaming path contains credentials'); + t.ok(!result.filePath.includes('credentials={'), 'Credentials are not raw JSON (base64 encoded)'); // Test 2: HD voice streaming (use_live_api=1) result = await synthAudio(stats, {