Hey can anyone help
- the speech to text, i'm using twiML <record> method to get the audio file url
- when generation speech for text, the code provide me with a audio file but when then twiML <play> method requires a audio url, which make the latency greater as not i have to upload the file to a storage and then provide the url
this is the code
const incoming = async (req, res) => {
try {
const voiceResponse = new twiml.VoiceResponse();
voiceResponse.say({ language: "hi-IN" }, INITIAL_MESSAGE);
voiceResponse.record({
timeout: 3,
playBeep: false,
action: "/api/v1/respond",
});
res.set("Content-Type", "application/xml").send(
voiceResponse.toString()
);
} catch (error) {
console.error(error);
res.status(500).json({ error: error.message });
}
};
const response = async (req, res) => {
try {
const { RecordingUrl: recordingUrl } = req.body;
console.log(recordingUrl);
const transcript = await transcribeUrl(recordingUrl);
console.log(transcript);
then this is my transcriber code
const transcribeUrl = async (url) => {
const deepgram = createClient(apiKey);
const { result, error } = await deepgram.listen.prerecorded.transcribeUrl(
{
url: `${url}.mp3`,
},
{
model: "nova-2",
smart_format: true,
}
);
if (error) throw error;
if (!error) {
return result;
}
};
the issue that i'm getting is that when i set the URL from twiML, it says in the documentation that it to get .mp3 just add .mp3 in it, but when i try to use the url it gives 401.. i tried opening the url in my browser, it gives a proup and ask for credentails, how do i tackle this, there is no way given in the documentation to provide credentails to the recordingURL