Skip to content

Commit bfc93ee

Browse files
authored
Merge pull request #151 from babblevoice/getchannel-transcribe
Add node getchannel(uuid) + transcribe command for audio tap
2 parents fc6439a + b8476c3 commit bfc93ee

3 files changed

Lines changed: 21 additions & 4 deletions

File tree

lib/node.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ const channelmap = {
2525
"play": ( chan, msg ) => chan.play( msg.soup ),
2626
"record": ( chan, msg ) => chan.record( msg.options ),
2727
"playrecord": ( chan, msg ) => chan.playrecord( msg.options ),
28-
"direction": ( chan, msg ) => chan.direction( msg.options )
28+
"direction": ( chan, msg ) => chan.direction( msg.options ),
29+
/* "transcribe" carries no channel action of its own - it is consumed by the
30+
node's pre hook (the consumer registers a token->channel binding and taps
31+
audio itself via getchannel() + createReadStream). Registered here as a
32+
no-op so the framework acknowledges it rather than replying "Unknown method". */
33+
"transcribe": () => {}
2934
}
3035

3136
/**
@@ -313,6 +318,18 @@ class rtpnode {
313318
this._post = this._defaulthandler.bind( this )
314319
}
315320

321+
/**
322+
* @summary Look up a live channel object by its uuid.
323+
* Channels are created by the node when the server sends an "open" command
324+
* and stored in the module-level map. This exposes them to pre/post hooks
325+
* (e.g. to tap audio with channel.createReadStream for live transcription).
326+
* @param { string } uuid - our channel uuid
327+
* @returns { object | undefined } the channel object, or undefined if unknown
328+
*/
329+
getchannel( uuid ) {
330+
return channels.get( uuid )
331+
}
332+
316333
/**
317334
* @summary Connect to a server.
318335
* @param {string} host

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@babblevoice/projectrtp",
3-
"version": "3.0.0",
3+
"version": "3.1.0",
44
"description": "A scalable Node addon RTP server",
55
"main": "index.js",
66
"directories": {

0 commit comments

Comments
 (0)