I'm trying to get twilio streams connected to dialogflow cx but I keep getting a "no audio" error from dialogflow cx streamingdetectintent API.
How can I see what the output of this function is?
function createAudioRequestStream() {
return new Transform({
objectMode: true,
transform: (chunk, encoding, callback) => {
const msg = JSON.parse(chunk.toString("utf8"));
// Only process media messages
if (msg.event !== "media") {
console.log("msg.event = "+ msg.event + " and not media");
return callback();
}
// This is mulaw/8000 base64-encoded
console.log("createAudioRequestStream " + msg.event.toString());
console.log("createAudioRequestStream " + msg.media.payload.toString());
return callback({ inputAudio: msg.media.payload }, { inputAudio: msg.media.payload });
//return callback(null, { inputAudio: msg.media.payload });
},
});
}