Commit 8bdc8b34 authored by Yoann HOUPERT's avatar Yoann HOUPERT

add room

parent e4e59887
......@@ -27,10 +27,13 @@ In the docker-kaldi-gstreamer-server directory, run `docker build -t linagora/ka
Don't forget to **add the config.properties file** in the openpaas-summary directory, and then you can build the docker image (being in the openpaas-summary directory):
`docker build -t linagora/recommender .`
### Selenium
### Offline
If you want, you can pull the selenium image from Docker Hub: run `docker pull selenium/standalone-chrome`
This image will be pulled the first time you run `docker-compose up`, if you don't pull it now.
* Clone the project:
`git clone https://ci.linagora.com/linagora/lgs/labs/linstt-offline-decoding`
* And you can directly build the docker image running:
`docker build -t linagora/stt-offline .`
## Clone Hublot
......@@ -44,7 +47,12 @@ Note that if you have an old docker image tagged `linagora/hublot` on your machi
Three environment variables are defined in the .env file:
* NB_WORKERS is the number of workers of the kaldi gstreamer server
* MODELS_PATH is the path of the directory containing the models used by kaldi
* MODEL_PATH_OFFLINE is the path of the directory containing the offline models used by kaldi
* OFFLINE_PORT is the offline port of the server
* YAML is the path of the yaml file describing the model that you want to use
* ASD_SERVER_IP is the activity speech detection ip
* ASD_CONTROL_PORT is the activity speech detection port that will get the transcription data
* ASD_STREAM_PORT is the activity speech detection port that send the data to determine the current speaker
There are different ways to set environment variables:
* You can modify the values of these environment variables in the .env file.
......
......@@ -103,7 +103,8 @@ robot = {
},
recordParticipant(easyrtcid) {
robot.socket.emit('new_user', easyrtcid);
robot.socket.emit('new_user', {userId : easyrtcid, roomId : robot.room});
robot.getUserStream(easyrtcid);
robot.recordedParticipantsWS.push(easyrtcid);
},
......@@ -157,7 +158,7 @@ robot = {
console.log(e);
});
robot.socket.on('resume_data', hyp => {
robot.socket.on('resume_data_'+room, hyp => {
if (hyp.status === 0) {
if (hyp.result !== undefined && hyp.result.final) {
const transcription = ((hyp.result.hypotheses)[0]).transcript;
......
......@@ -49,13 +49,14 @@ class Asd extends EventEmitter {
controlConnect() {
return new Promise((resolve, reject) => {
let recoTimer;
// Tries to reconnect in case of error
function reco() {
recoTimer = setTimeout(() => {
this.init();
}, 2000);
}
try {
// Tries to reconnect in case of error
function reco() {
recoTimer = setTimeout(() => {
this.init();
}, 2000);
}
const controlTcpClient = new net.Socket();
controlTcpClient.once('error', err => {
debug(err);
......
......@@ -116,15 +116,18 @@ module.exports = config => {
});
}
function kaldiWS(userId, socket) {
function kaldiWS(userId, roomId, socket) {
const connectionToKaldi = new WebSocket(config.services.kaldi);
connectionToKaldi.on('open', () => {
connectionToKaldi.on('message', message => {
try {
const msgJson = JSON.parse(message);
msgJson.userId = userId;
msgJson.roomId = roomId;
socket.emit('resume_data', msgJson);
console.log('room transcription '+roomId+' ==== ', msgJson)
socket.emit('resume_data_'+roomId, msgJson);
} catch (err) {
// Sometimes, the client will close the connection unexpectedly
// (e.g. when stopping). This is expected
......@@ -147,10 +150,10 @@ module.exports = config => {
if (config.asd.isUse) {
asd = await require('./asd');
asd.on('resume_data',(data)=>{
//envoyer la data vers Hublin
asd.on('resume_data', data => {
// Envoyer la data vers Hublin
socket.emit('resume_data', data);
})
});
}
socket.on('error', err => {
......@@ -161,27 +164,33 @@ module.exports = config => {
userAudioEvents = [];
});
socket.on('new_user', async userId => {
const streamData = resume.generateStream();
socket.on('new_user', async data => {
const userId = data.userId;
const roomId = data.roomId;
resume.createFolder('_'+roomId);
const streamData = resume.generateStream(roomId)
let transcriptor;
if (config.asd.isUse) {
transcriptor = await asd.streamConnect();
} else {
transcriptor = kaldiWS(userId, socket);
transcriptor = kaldiWS(userId, roomId, socket);
}
userAudioEvents.push('audio_from_' + userId);
// register custom event for user
// Register custom event for user
socket.on('audio_from_' + userId, data => {
if (config.asd.isUse) {
asd.streamPush(transcriptor, data); // Asd
} else {
if (transcriptor.readyState === 2 || transcriptor.readyState === 3)
transcriptor = kaldiWS(userId, socket);
if (transcriptor.readyState === 1)
transcriptor.send(data, {binary: true}); // Kaldi
if (transcriptor.readyState === 2 || transcriptor.readyState === 3) {
transcriptor = kaldiWS(userId, roomId, socket);
}
if (transcriptor.readyState === 1) {
transcriptor.send(data, {binary: true});
} // Kaldi
}
streamData.wstream.write(data);
......@@ -200,13 +209,13 @@ module.exports = config => {
});
});
});
audioWebSocketServer.listen(config.port_ws_audio);
}
return {
create: resume => {
resume.createFolder();
//resume.createFolder();
const stompClient = createStompClient();
audioSocket(resume);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment