mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
* initial changes to gather to support nuance stt * updateSpeechCredentialLastUsed could be called without a speech_credential_sid if credentials are passed in the flow * fix bugname * typo * added handlers for nuance * logging * major refactor of parsing transcriptions * initial support for nuance in transcribe verb * updates from testing * cleanup some tests * update action * typo * gather: start nuance timers after say/play completes * update drachtio-fsrmf * refactor some code * typo * log nuance error detail * timeout handling * typo * handle nuance 413 response when recognition times out * typo in specs.json * add support for nuance resources * fixes and tests for transcribe * remove logging from test * initial support for kryptonEndpoint * try getting access token even when using krypton * typo in kryptonEndpoint property * add support for Nuance tts * parse nuance voice and model for tts * use nuance credentials from db * update to db-helpers@0.7.0 with caching option * add support for azure audio logging in gather/transcribe * sync package-lock.json
71 lines
1.7 KiB
JavaScript
71 lines
1.7 KiB
JavaScript
const { spawn } = require('child_process');
|
|
const debug = require('debug')('test:sipp');
|
|
let network;
|
|
const obj = {};
|
|
let output = '';
|
|
let idx = 1;
|
|
|
|
function clearOutput() {
|
|
output = '';
|
|
}
|
|
|
|
function addOutput(str) {
|
|
for (let i = 0; i < str.length; i++) {
|
|
if (str.charCodeAt(i) < 128) output += str.charAt(i);
|
|
}
|
|
}
|
|
|
|
module.exports = (networkName) => {
|
|
network = networkName ;
|
|
return obj;
|
|
};
|
|
|
|
obj.output = () => {
|
|
return output;
|
|
};
|
|
|
|
obj.sippUac = (file, bindAddress, from='sipp', to='16174000000') => {
|
|
const cmd = 'docker';
|
|
const args = [
|
|
'run', '-t', '--rm', '--net', `${network}`,
|
|
'-v', `${__dirname}/scenarios:/tmp/scenarios`,
|
|
'drachtio/sipp', 'sipp', '-sf', `/tmp/scenarios/${file}`,
|
|
'-m', '1',
|
|
'-sleep', '250ms',
|
|
'-nostdin',
|
|
'-cid_str', `%u-%p@%s-${idx++}`,
|
|
'172.38.0.50',
|
|
'-key','from', from,
|
|
'-key','to', to, '-trace_msg'
|
|
];
|
|
|
|
if (bindAddress) args.splice(5, 0, '--ip', bindAddress);
|
|
|
|
//console.log(args.join(' '));
|
|
clearOutput();
|
|
|
|
return new Promise((resolve, reject) => {
|
|
const child_process = spawn(cmd, args, {stdio: ['inherit', 'pipe', 'pipe']});
|
|
|
|
child_process.on('exit', (code, signal) => {
|
|
if (code === 0) {
|
|
return resolve();
|
|
}
|
|
console.log(`sipp exited with non-zero code ${code} signal ${signal}`);
|
|
reject(code);
|
|
});
|
|
child_process.on('error', (error) => {
|
|
console.log(`error spawing child process for docker: ${args}`);
|
|
});
|
|
|
|
child_process.stdout.on('data', (data) => {
|
|
//console.log(`stdout: ${data}`);
|
|
addOutput(data.toString());
|
|
});
|
|
child_process.stdout.on('data', (data) => {
|
|
// console.log(`stdout: ${data}`);
|
|
addOutput(data.toString());
|
|
});
|
|
});
|
|
};
|