mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-02-11 08:51:13 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee54e4341a | ||
|
|
4bf2f42f33 |
@@ -4,6 +4,7 @@ const {request} = require('undici');
|
||||
const {LlmEvents_Ultravox} = require('../../../utils/constants');
|
||||
|
||||
const ultravox_server_events = [
|
||||
'createCall',
|
||||
'pong',
|
||||
'state',
|
||||
'transcript',
|
||||
@@ -88,7 +89,7 @@ class TaskLlmUltravox_S2S extends Task {
|
||||
throw new Error(`Ultravox Error registering call: ${data.message}`);
|
||||
}
|
||||
this.logger.info({joinUrl: data.joinUrl}, 'Ultravox Call registered');
|
||||
return data.joinUrl;
|
||||
return data;
|
||||
}
|
||||
|
||||
_unregisterHandlers() {
|
||||
@@ -105,13 +106,19 @@ class TaskLlmUltravox_S2S extends Task {
|
||||
async _startListening(cs, ep) {
|
||||
this._registerHandlers(ep);
|
||||
|
||||
const joinUrl = await this.createCall();
|
||||
const data = await this.createCall();
|
||||
const {joinUrl} = data;
|
||||
// split the joinUrl into host and path
|
||||
const {host, pathname, search} = new URL(joinUrl);
|
||||
|
||||
try {
|
||||
const args = [ep.uuid, 'session.create', host, pathname + search];
|
||||
await this._api(ep, args);
|
||||
// Notify the application that the session has been created with detail information
|
||||
this._sendLlmEvent('createCall', {
|
||||
type: 'createCall',
|
||||
...data
|
||||
});
|
||||
} catch (err) {
|
||||
this.logger.error({err}, 'TaskLlmUltraVox_S2S:_startListening');
|
||||
this.notifyTaskDone();
|
||||
@@ -190,11 +197,7 @@ class TaskLlmUltravox_S2S extends Task {
|
||||
}
|
||||
}
|
||||
|
||||
/* check whether we should notify on this event */
|
||||
if (this.includeEvents.length > 0 ? this.includeEvents.includes(type) : !this.excludeEvents.includes(type)) {
|
||||
this.parent.sendEventHook(evt)
|
||||
.catch((err) => this.logger.info({err}, 'TaskLlmUltravox_S2S:_onServerEvent - error sending event hook'));
|
||||
}
|
||||
this._sendLlmEvent(type, evt);
|
||||
|
||||
if (endConversation) {
|
||||
this.logger.info({results: this.results},
|
||||
@@ -203,6 +206,14 @@ class TaskLlmUltravox_S2S extends Task {
|
||||
}
|
||||
}
|
||||
|
||||
_sendLlmEvent(type, evt) {
|
||||
/* check whether we should notify on this event */
|
||||
if (this.includeEvents.length > 0 ? this.includeEvents.includes(type) : !this.excludeEvents.includes(type)) {
|
||||
this.parent.sendEventHook(evt)
|
||||
.catch((err) => this.logger.info({err}, 'TaskLlmUltravox_S2S:_onServerEvent - error sending event hook'));
|
||||
}
|
||||
}
|
||||
|
||||
async processToolOutput(ep, tool_call_id, data) {
|
||||
try {
|
||||
this.logger.debug({tool_call_id, data}, 'TaskLlmUltravox_S2S:processToolOutput');
|
||||
|
||||
7
package-lock.json
generated
7
package-lock.json
generated
@@ -32,7 +32,7 @@
|
||||
"debug": "^4.3.4",
|
||||
"deepcopy": "^2.1.0",
|
||||
"drachtio-fsmrf": "^4.0.1",
|
||||
"drachtio-srf": "^5.0.1",
|
||||
"drachtio-srf": "^5.0.2",
|
||||
"express": "^4.19.2",
|
||||
"express-validator": "^7.0.1",
|
||||
"moment": "^2.30.1",
|
||||
@@ -3647,8 +3647,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/drachtio-srf": {
|
||||
"version": "5.0.1",
|
||||
"license": "MIT",
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/drachtio-srf/-/drachtio-srf-5.0.2.tgz",
|
||||
"integrity": "sha512-tM4TVNoC3IpdmpNn2gnuIp5AzNF6Ik6rvRTFjmQ25/W4gb4eVzK8cCYntc00rtbENI4HHmrX4Ep+/T+ZVnoTDw==",
|
||||
"dependencies": {
|
||||
"debug": "^3.2.7",
|
||||
"delegates": "^0.1.0",
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
"debug": "^4.3.4",
|
||||
"deepcopy": "^2.1.0",
|
||||
"drachtio-fsmrf": "^4.0.1",
|
||||
"drachtio-srf": "^5.0.1",
|
||||
"drachtio-srf": "^5.0.2",
|
||||
"express": "^4.19.2",
|
||||
"express-validator": "^7.0.1",
|
||||
"moment": "^2.30.1",
|
||||
|
||||
Reference in New Issue
Block a user