* initial changes for stream synonym to listen

* listen on B endpoint if nested listen in dial has channel === 2
This commit is contained in:
Dave Horton
2025-01-17 08:48:39 -05:00
committed by GitHub
parent 77f3d9d7ec
commit a194ba833e
7 changed files with 19 additions and 15 deletions

View File

@@ -1468,7 +1468,7 @@ class CallSession extends Emitter {
if (!listenTask) { if (!listenTask) {
return this.logger.info('CallSession:_lccListenStatus - invalid listen_status: Dial does not have a listen'); return this.logger.info('CallSession:_lccListenStatus - invalid listen_status: Dial does not have a listen');
} }
listenTask.updateListen(opts.listen_status); listenTask.updateListen(opts.listen_status || opts.stream_status);
} }
/** /**
@@ -1610,7 +1610,7 @@ Duration=${duration} `
// this whole thing requires us to be in a Dial verb // this whole thing requires us to be in a Dial verb
const task = this.currentTask; const task = this.currentTask;
if (!task || ![TaskName.Dial, TaskName.Listen].includes(task.name)) { if (!task || ![TaskName.Dial, TaskName.Listen].includes(task.name)) {
return this.logger.info('CallSession:_lccWhisper - invalid command since we are not in a dial or listen'); return this.logger.info('CallSession:_lccWhisper - invalid command since we are not in a dial or stream/listen');
} }
// allow user to provide a url object, a url string, an array of tasks, or a single task // allow user to provide a url object, a url string, an array of tasks, or a single task
@@ -1799,7 +1799,7 @@ Duration=${duration} `
if (opts.call_hook || opts.child_call_hook) { if (opts.call_hook || opts.child_call_hook) {
return await this._lccCallHook(opts); return await this._lccCallHook(opts);
} }
if (opts.listen_status) { if (opts.listen_status || opts.stream_status) {
await this._lccListenStatus(opts); await this._lccListenStatus(opts);
} }
if (opts.transcribe_status) { if (opts.transcribe_status) {
@@ -2109,6 +2109,7 @@ Duration=${duration} `
break; break;
case 'listen:status': case 'listen:status':
case 'stream:status':
this._lccListenStatus(data); this._lccListenStatus(data);
break; break;

View File

@@ -121,8 +121,9 @@ class TaskDial extends Task {
} }
} }
if (this.data.listen) { const listenData = this.data.listen || this.data.stream;
this.listenTask = makeTask(logger, {'listen': this.data.listen}, this); if (listenData) {
this.listenTask = makeTask(logger, {'listen': listenData }, this);
} }
if (this.data.transcribe) { if (this.data.transcribe) {
this.transcribeTask = makeTask(logger, {'transcribe' : this.data.transcribe}, this); this.transcribeTask = makeTask(logger, {'transcribe' : this.data.transcribe}, this);
@@ -873,7 +874,7 @@ class TaskDial extends Task {
if (cs.sipRequestWithinDialogHook) this._initSipIndialogRequestListener(cs, this.dlg); if (cs.sipRequestWithinDialogHook) this._initSipIndialogRequestListener(cs, this.dlg);
if (this.transcribeTask) this.transcribeTask.exec(cs, {ep: this.epOther, ep2:this.ep}); if (this.transcribeTask) this.transcribeTask.exec(cs, {ep: this.epOther, ep2:this.ep});
if (this.listenTask) this.listenTask.exec(cs, {ep: this.epOther}); if (this.listenTask) this.listenTask.exec(cs, {ep: this.listenTask.channel === 2 ? this.ep : this.epOther});
if (this.startAmd) { if (this.startAmd) {
try { try {
this.startAmd(cs, this.ep, this, this.data.amd); this.startAmd(cs, this.ep, this, this.data.amd);

View File

@@ -17,7 +17,7 @@ class TaskListen extends Task {
[ [
'action', 'auth', 'method', 'url', 'finishOnKey', 'maxLength', 'metadata', 'mixType', 'passDtmf', 'playBeep', 'action', 'auth', 'method', 'url', 'finishOnKey', 'maxLength', 'metadata', 'mixType', 'passDtmf', 'playBeep',
'sampleRate', 'timeout', 'transcribe', 'wsAuth', 'disableBidirectionalAudio' 'sampleRate', 'timeout', 'transcribe', 'wsAuth', 'disableBidirectionalAudio', 'channel'
].forEach((k) => this[k] = this.data[k]); ].forEach((k) => this[k] = this.data[k]);
this.mixType = this.mixType || 'mono'; this.mixType = this.mixType || 'mono';

View File

@@ -84,6 +84,7 @@ function makeTask(logger, obj, parent) {
const TaskTranscribe = require('./transcribe'); const TaskTranscribe = require('./transcribe');
return new TaskTranscribe(logger, data, parent); return new TaskTranscribe(logger, data, parent);
case TaskName.Listen: case TaskName.Listen:
case TaskName.Stream:
const TaskListen = require('./listen'); const TaskListen = require('./listen');
return new TaskListen(logger, data, parent); return new TaskListen(logger, data, parent);
case TaskName.Redirect: case TaskName.Redirect:

View File

@@ -28,6 +28,7 @@
"SipRedirect": "sip:redirect", "SipRedirect": "sip:redirect",
"Say": "say", "Say": "say",
"SayLegacy": "say:legacy", "SayLegacy": "say:legacy",
"Stream": "stream",
"Tag": "tag", "Tag": "tag",
"Transcribe": "transcribe" "Transcribe": "transcribe"
}, },

14
package-lock.json generated
View File

@@ -18,7 +18,7 @@
"@jambonz/speech-utils": "^0.2.1", "@jambonz/speech-utils": "^0.2.1",
"@jambonz/stats-collector": "^0.1.10", "@jambonz/stats-collector": "^0.1.10",
"@jambonz/time-series": "^0.2.13", "@jambonz/time-series": "^0.2.13",
"@jambonz/verb-specifications": "^0.0.93", "@jambonz/verb-specifications": "^0.0.94",
"@opentelemetry/api": "^1.8.0", "@opentelemetry/api": "^1.8.0",
"@opentelemetry/exporter-jaeger": "^1.23.0", "@opentelemetry/exporter-jaeger": "^1.23.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.50.0", "@opentelemetry/exporter-trace-otlp-http": "^0.50.0",
@@ -1671,9 +1671,9 @@
} }
}, },
"node_modules/@jambonz/verb-specifications": { "node_modules/@jambonz/verb-specifications": {
"version": "0.0.93", "version": "0.0.94",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.93.tgz", "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.94.tgz",
"integrity": "sha512-Ml1+fT+cNSm4sEkd6zQpG3g1WmBeoXRtgcXVDRn980gCjBKuegcaXHaaCod6ddyWOpj3YiA51PnVEpfpaXU76A==", "integrity": "sha512-gFqZvbzM+us9T2CLkMaFSjlnclTGCMzuP9BD9fDPJNU36/CaIX3TO+3/EDCcIVhg4+b/smr6cqTHjaLQ5fZn4g==",
"dependencies": { "dependencies": {
"debug": "^4.3.4", "debug": "^4.3.4",
"pino": "^8.8.0" "pino": "^8.8.0"
@@ -10938,9 +10938,9 @@
} }
}, },
"@jambonz/verb-specifications": { "@jambonz/verb-specifications": {
"version": "0.0.93", "version": "0.0.94",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.93.tgz", "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.94.tgz",
"integrity": "sha512-Ml1+fT+cNSm4sEkd6zQpG3g1WmBeoXRtgcXVDRn980gCjBKuegcaXHaaCod6ddyWOpj3YiA51PnVEpfpaXU76A==", "integrity": "sha512-gFqZvbzM+us9T2CLkMaFSjlnclTGCMzuP9BD9fDPJNU36/CaIX3TO+3/EDCcIVhg4+b/smr6cqTHjaLQ5fZn4g==",
"requires": { "requires": {
"debug": "^4.3.4", "debug": "^4.3.4",
"pino": "^8.8.0" "pino": "^8.8.0"

View File

@@ -33,7 +33,7 @@
"@jambonz/realtimedb-helpers": "^0.8.8", "@jambonz/realtimedb-helpers": "^0.8.8",
"@jambonz/speech-utils": "^0.2.1", "@jambonz/speech-utils": "^0.2.1",
"@jambonz/stats-collector": "^0.1.10", "@jambonz/stats-collector": "^0.1.10",
"@jambonz/verb-specifications": "^0.0.93", "@jambonz/verb-specifications": "^0.0.94",
"@jambonz/time-series": "^0.2.13", "@jambonz/time-series": "^0.2.13",
"@opentelemetry/api": "^1.8.0", "@opentelemetry/api": "^1.8.0",
"@opentelemetry/exporter-jaeger": "^1.23.0", "@opentelemetry/exporter-jaeger": "^1.23.0",