Hello, I am using the Config API to download prompt (.wav) files. I can download the files but they have poor audio quality. Specifically, the speaker's words sound fuzzy. The same files, when downloaded via the Prompt administration wizard in the UCCX web interface sound fine. I assume I'm doing something wrong when calling the REST API or when writing the response data to the file system. I checked the files and those downloaded via the API are slightly smaller than those downloaded via the administration wizard. Looking at the files in a text editor, there are some occasional differences to the naked eye.
One thing I don't understand: the prompt/download API call (per the documentation) uses an HTTP content-type of Application/XML; first, this seems strange since the content is binary (a .wav file). Second, I don't see any evidence that the API call response contains XML elements; it looks entirely binary to me. This is probably my ignorance of how audio is moved over the Internet.
I'm doing this on Linux in Node.js. Here's my code:
const axios = require('axios');
async function downloadExample() {
const url = `http://<hostname>/adminapi/prompt/download/en_US/Complaints.wav`;
const auth = {username: <user>, password: <pswd>};
const headers = {Accept: 'application/xml'};
const xmlCfg = {url, method: 'get', auth, headers};
const response = await axios(xmlCfg);
await writeToBinaryFile('/temp/audio/Complaints.wav', response.data);
}
function writeToBinaryFile(path, buffer) {
return new Promise(function(resolve, reject) {
fs.writeFile(path, buffer, 'binary', function(err) {
if (err) reject(err);
resolve(null);
});
});
}
Any help would be much appreciated.
John