Compare commits

..

6 Commits

Author SHA1 Message Date
Dave Horton
f20d3dba2f bump speech-utils 2025-05-28 13:13:16 -04:00
Dave Horton
b734952855 proper handling of case when amd fails because no speech credentials (#1220) 2025-05-28 13:01:08 -04:00
Hoan Luu Huu
4990b1fb68 fix mod dub throw undefined reference (#1209) 2025-05-28 09:58:33 -04:00
Hoan Luu Huu
3475f39b1d support deepgram model_id in speechCredential (#1213) 2025-05-28 08:00:56 -04:00
Hoan Luu Huu
690a7fcd55 add ws msgid to telemetry span if it's ws requestor (#1215)
* add ws msgid to telemetry span if it's ws requestor

* wip
2025-05-28 07:51:59 -04:00
Dave Horton
760394aa5e Revert "fix: member mute on conference (#1048)" (#1216)
This reverts commit 761b7f26e7.
2025-05-28 07:21:24 -04:00
12 changed files with 26 additions and 19 deletions

View File

@@ -438,7 +438,7 @@ module.exports = function(srf, logger) {
span = obj.span;
const b3 = rootSpan.getTracingPropagation();
const httpHeaders = b3 && { b3 };
json = await app.requestor.request('session:new', app.call_hook, params, httpHeaders);
json = await app.requestor.request('session:new', app.call_hook, params, httpHeaders, span);
}
app.tasks = normalizeJambones(logger, json).map((tdata) => makeTask(logger, tdata));

View File

@@ -1032,6 +1032,7 @@ class CallSession extends Emitter {
return {
speech_credential_sid: credential.speech_credential_sid,
api_key: credential.api_key,
model_id: credential.model_id,
deepgram_stt_uri: credential.deepgram_stt_uri,
deepgram_tts_uri: credential.deepgram_tts_uri,
deepgram_stt_use_tls: credential.deepgram_stt_use_tls

View File

@@ -465,7 +465,7 @@ class Conference extends Task {
doConferenceMute(cs, opts) {
assert (cs.isInConference);
this.logger.info(`Conference:doConferenceMute ${mute ? 'muting' : 'unmuting'} member`);
const mute = opts.conf_mute_status === 'mute';
this.ep.api(`conference ${this.confName} ${mute ? 'mute' : 'unmute'} ${this.memberId}`)
.catch((err) => this.logger.info({err}, 'Error muting or unmuting participant'));
@@ -568,8 +568,8 @@ class Conference extends Task {
/**
* mute or unmute side of the call
*/
async mute(callSid, doMute) {
this.doConferenceMute(this.callSession, {conf_mute_status: doMute ? 'mute' : 'unmute'});
mute(callSid, doMute) {
this.doConferenceMute(this.callSession, {conf_mute_status: doMute});
}
/**

View File

@@ -139,7 +139,7 @@ class TaskConfig extends Task {
try {
this.ep = ep;
this.startAmd(cs, ep, this, this.data.amd);
await this.startAmd(cs, ep, this, this.data.amd);
} catch (err) {
this.logger.info({err}, 'Config:exec - Error calling startAmd');
}

View File

@@ -166,7 +166,7 @@ class Task extends Emitter {
span.setAttributes({'http.body': JSON.stringify(params)});
try {
if (this.id) params.verb_id = this.id;
const json = await this.cs.requestor.request(type, this.actionHook, params, httpHeaders);
const json = await this.cs.requestor.request(type, this.actionHook, params, httpHeaders, span);
span.setAttributes({'http.statusCode': 200});
const isWsConnection = this.cs.requestor instanceof WsRequestor;
if (!isWsConnection || (expectResponse && json && Array.isArray(json) && json.length)) {
@@ -210,7 +210,7 @@ class Task extends Emitter {
const httpHeaders = b3 && {b3};
span.setAttributes({'http.body': JSON.stringify(params)});
try {
const json = await cs.requestor.request('verb:hook', hook, params, httpHeaders);
const json = await cs.requestor.request('verb:hook', hook, params, httpHeaders, span);
span.setAttributes({'http.statusCode': 200});
span.end();
if (json && Array.isArray(json)) {

View File

@@ -45,7 +45,8 @@ class TtsTask extends Task {
}
const fullText = Array.isArray(this.text) ? this.text.join(' ') : this.text;
if (fullText.length > 0) {
// in case dub verb, text might not be set.
if (fullText?.length > 0) {
cs.emit('botSaid', fullText);
}
}

View File

@@ -76,6 +76,7 @@ const speechMapper = (cred) => {
else if ('deepgram' === obj.vendor) {
const o = JSON.parse(decrypt(credential));
obj.api_key = o.api_key;
obj.model_id = o.model_id;
obj.deepgram_stt_uri = o.deepgram_stt_uri;
obj.deepgram_tts_uri = o.deepgram_tts_uri;
obj.deepgram_stt_use_tls = o.deepgram_stt_use_tls;

View File

@@ -102,7 +102,7 @@ class HttpRequestor extends BaseRequestor {
* @param {string} [hook.password] - if basic auth is protecting the endpoint
* @param {object} [params] - request parameters
*/
async request(type, hook, params, httpHeaders = {}) {
async request(type, hook, params, httpHeaders = {}, span) {
/* jambonz:error only sent over ws */
if (type === 'jambonz:error') return;
@@ -131,7 +131,7 @@ class HttpRequestor extends BaseRequestor {
this.close();
this.emit('handover', requestor);
}
return requestor.request('session:new', hook, params, httpHeaders);
return requestor.request('session:new', hook, params, httpHeaders, span);
}
let newClient;

View File

@@ -829,7 +829,7 @@ module.exports = (logger) => {
};
}
else if ('deepgram' === vendor) {
let model = rOpts.deepgramOptions?.model || rOpts.model;
let model = rOpts.deepgramOptions?.model || rOpts.model || sttCredentials.model_id;
const {deepgramOptions = {}} = rOpts;
const deepgramUri = deepgramOptions.deepgramSttUri || sttCredentials.deepgram_stt_uri;
const useTls = deepgramOptions.deepgramSttUseTls || sttCredentials.deepgram_stt_use_tls;

View File

@@ -55,7 +55,7 @@ class WsRequestor extends BaseRequestor {
* @param {string} [hook.password] - if basic auth is protecting the endpoint
* @param {object} [params] - request parameters
*/
async request(type, hook, params, httpHeaders = {}) {
async request(type, hook, params, httpHeaders = {}, span) {
assert(HookMsgTypes.includes(type));
const url = hook.url || hook;
const wantsAck = !MTYPE_WANTS_ACK.includes(type);
@@ -87,7 +87,7 @@ class WsRequestor extends BaseRequestor {
this.close();
this.emit('handover', requestor);
}
return requestor.request(type, hook, params, httpHeaders);
return requestor.request(type, hook, params, httpHeaders, span);
}
/* connect if necessary */
@@ -152,13 +152,17 @@ class WsRequestor extends BaseRequestor {
data: {...payload},
...b3
};
// add msgid to span attributes if it exists
if (span) {
span.setAttributes({'msgid': msgid});
}
const sendQueuedMsgs = () => {
if (this.queuedMsg.length > 0) {
for (const {type, hook, params, httpHeaders, promise} of this.queuedMsg) {
this.logger.debug(`WsRequestor:request - preparing queued ${type} for sending`);
if (promise) {
this.request(type, hook, params, httpHeaders)
this.request(type, hook, params, httpHeaders, span)
.then((res) => promise.resolve(res))
.catch((err) => promise.reject(err));
}

8
package-lock.json generated
View File

@@ -15,7 +15,7 @@
"@jambonz/http-health-check": "^0.0.1",
"@jambonz/mw-registrar": "^0.2.7",
"@jambonz/realtimedb-helpers": "^0.8.13",
"@jambonz/speech-utils": "^0.2.10",
"@jambonz/speech-utils": "^0.2.11",
"@jambonz/stats-collector": "^0.1.10",
"@jambonz/time-series": "^0.2.13",
"@jambonz/verb-specifications": "^0.0.104",
@@ -1466,9 +1466,9 @@
}
},
"node_modules/@jambonz/speech-utils": {
"version": "0.2.10",
"resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.2.10.tgz",
"integrity": "sha512-RyBSS/xWMG/Uo3RG+jtESKXz/afySe8qaTuuAP9iDzEVzEXtSdxSp5lwuBjA1LZV8FUeWGI7KOV23izGQeNtHg==",
"version": "0.2.11",
"resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.2.11.tgz",
"integrity": "sha512-5V+OJUUnK1CpKKrB0PrAbGVDcwRGQYH/ZPHFMBayW67XaNRpiL3b9jDpMvq35yzx8MGY18JpzCPgVKHTxERlqQ==",
"dependencies": {
"23": "^0.0.0",
"@aws-sdk/client-polly": "^3.496.0",

View File

@@ -31,7 +31,7 @@
"@jambonz/http-health-check": "^0.0.1",
"@jambonz/mw-registrar": "^0.2.7",
"@jambonz/realtimedb-helpers": "^0.8.13",
"@jambonz/speech-utils": "^0.2.10",
"@jambonz/speech-utils": "^0.2.11",
"@jambonz/stats-collector": "^0.1.10",
"@jambonz/time-series": "^0.2.13",
"@jambonz/verb-specifications": "^0.0.104",