Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hublot
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yoann HOUPERT
hublot
Commits
568d4111
Commit
568d4111
authored
Apr 17, 2018
by
Yoann HOUPERT
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
integrate KGS
parent
b1cc1bea
Pipeline
#13973
failed with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
36 deletions
+59
-36
client/robot/robot.js
client/robot/robot.js
+31
-4
lib/proxy.js
lib/proxy.js
+28
-32
No files found.
client/robot/robot.js
View file @
568d4111
...
...
@@ -144,6 +144,9 @@ robot = {
start
:
(
room
,
clientConfig
)
=>
{
robot
.
room
=
room
;
robot
.
clientConfig
=
clientConfig
;
robotLib
.
reco
=
robotLib
.
reco
(
robot
.
clientConfig
);
robotLib
.
archive
=
robotLib
.
archive
(
robot
.
clientConfig
);
robot
.
socket
=
io
.
connect
(
robot
.
clientConfig
.
gstreamerURL
,
{
transports
:
[
'
websocket
'
]
})
...
...
@@ -156,11 +159,35 @@ robot = {
robot
.
socket
.
on
(
'
error
'
,
(
e
)
=>
{
console
.
log
(
e
)
})
robot
.
socket
.
on
(
'
resume_data
'
,
(
data
)
=>
{
//send data to hublin
robot
.
socket
.
on
(
'
resume_data
'
,
(
event
)
=>
{
const
hyp
=
JSON
.
parse
(
event
.
data
);
if
(
hyp
.
status
===
0
)
{
if
(
hyp
.
result
!==
undefined
&&
hyp
.
result
.
final
)
{
const
transcription
=
((
hyp
.
result
.
hypotheses
)[
0
]).
transcript
;
let
start
;
let
end
;
if
(
hyp
[
'
segment-start
'
]
&&
hyp
[
'
segment-length
'
])
{
start
=
JSON
.
parse
(
hyp
[
'
segment-start
'
]);
end
=
parseFloat
(
hyp
[
'
segment-start
'
])
+
parseFloat
(
hyp
[
'
segment-length
'
]);
}
else
{
const
time
=
new
Date
().
getTime
()
/
1000
;
start
=
time
;
end
=
time
+
1
;
}
robotLib
.
reco
.
send
({
from
:
robot
.
room
,
text
:
start
+
'
\t
'
+
end
+
'
\t
'
+
easyrtcid
+
'
\t
'
+
transcription
});
}
}
robotLib
.
reco
.
send
({
from
:
robot
.
room
,
text
:
start
+
'
\t
'
+
end
+
'
\t
'
+
'
undefined
'
+
'
\t
'
+
event
});
})
robotLib
.
reco
=
robotLib
.
reco
(
robot
.
clientConfig
);
robotLib
.
archive
=
robotLib
.
archive
(
robot
.
clientConfig
);
robotController
.
onAttendeePush
=
(
e
,
data
)
=>
{
robotController
.
getMyId
().
then
(
rtcid
=>
{
...
...
lib/proxy.js
View file @
568d4111
...
...
@@ -55,35 +55,6 @@ module.exports = config => {
return
stompCapsule
;
}
function
kaldiWS
(
connectionToClient
,
resume
)
{
const
connectionToKaldi
=
new
WebSocket
(
config
.
services
.
kaldi
);
connectionToKaldi
.
on
(
'
open
'
,
()
=>
{
const
streamData
=
resume
.
generateStream
();
connectionToClient
.
on
(
'
message
'
,
message
=>
{
connectionToKaldi
.
send
(
message
,
{
binary
:
true
});
streamData
.
wstream
.
write
(
message
);
});
connectionToKaldi
.
on
(
'
message
'
,
message
=>
{
try
{
connectionToClient
.
send
(
message
);
}
catch
(
err
)
{
// Sometimes, the client will close the connection unexpectedly
// (e.g. when stopping). This is expected
}
});
connectionToClient
.
on
(
'
close
'
,
()
=>
connectionToKaldi
.
close
());
connectionToKaldi
.
on
(
'
close
'
,
()
=>
{
resume
.
endStream
(
streamData
)
connectionToClient
.
close
()
});
});
}
function
recoChatWS
(
connectionToClient
,
stompClient
)
{
connectionToClient
.
on
(
'
message
'
,
message
=>
{
try
{
...
...
@@ -145,6 +116,28 @@ module.exports = config => {
});
}
function
kaldiWSInit
(
socket
)
{
const
connectionToKaldi
=
new
WebSocket
(
config
.
services
.
kaldi
);
connectionToKaldi
.
on
(
'
open
'
,
()
=>
{
connectionToKaldi
.
on
(
'
message
'
,
message
=>
{
try
{
console
.
log
(
'
resume ?
'
)
console
.
log
(
message
)
socket
.
emit
(
'
resume_data
'
,
message
);
}
catch
(
err
)
{
// Sometimes, the client will close the connection unexpectedly
// (e.g. when stopping). This is expected
}
});
connectionToKaldi
.
on
(
'
close
'
,
()
=>
{
connectionToClient
.
close
()
});
});
return
connectionToKaldi
;
}
return
{
create
:
(
resume
)
=>
{
resume
.
createFolder
()
...
...
@@ -165,14 +158,18 @@ module.exports = config => {
asd
=
{}
//disconnect and kill asd sockets
})
socket
.
on
(
'
new_user
'
,
(
userId
)
=>
{
const
connectionToKaldi
=
kaldiWSInit
()
//create ASD stream //port 8882 - connexion de data
userAudioEvents
.
push
(
'
audio_from_
'
+
userId
)
//asd.on("resume_data", soket.emit('resume_data'))
//register custom event for user
socket
.
on
(
'
audio_from_
'
+
userId
,
(
data
)
=>
{
console
.
log
(
"
DATA RECEIVED FOR USER :
"
,
asd
)
//console.log(data)
//asd.send(data)
connectionToKaldi
.
send
(
data
,
{
binary
:
true
});
})
})
});
...
...
@@ -205,4 +202,3 @@ module.exports = config => {
}
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment