mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
Feat/1041 (#1045)
* initial changes for stream synonym to listen * listen on B endpoint if nested listen in dial has channel === 2
This commit is contained in:
@@ -1468,7 +1468,7 @@ class CallSession extends Emitter {
|
||||
if (!listenTask) {
|
||||
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
|
||||
const task = this.currentTask;
|
||||
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
|
||||
@@ -1799,7 +1799,7 @@ Duration=${duration} `
|
||||
if (opts.call_hook || opts.child_call_hook) {
|
||||
return await this._lccCallHook(opts);
|
||||
}
|
||||
if (opts.listen_status) {
|
||||
if (opts.listen_status || opts.stream_status) {
|
||||
await this._lccListenStatus(opts);
|
||||
}
|
||||
if (opts.transcribe_status) {
|
||||
@@ -2109,6 +2109,7 @@ Duration=${duration} `
|
||||
break;
|
||||
|
||||
case 'listen:status':
|
||||
case 'stream:status':
|
||||
this._lccListenStatus(data);
|
||||
break;
|
||||
|
||||
|
||||
@@ -121,8 +121,9 @@ class TaskDial extends Task {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.data.listen) {
|
||||
this.listenTask = makeTask(logger, {'listen': this.data.listen}, this);
|
||||
const listenData = this.data.listen || this.data.stream;
|
||||
if (listenData) {
|
||||
this.listenTask = makeTask(logger, {'listen': listenData }, this);
|
||||
}
|
||||
if (this.data.transcribe) {
|
||||
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 (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) {
|
||||
try {
|
||||
this.startAmd(cs, this.ep, this, this.data.amd);
|
||||
|
||||
@@ -17,7 +17,7 @@ class TaskListen extends Task {
|
||||
|
||||
[
|
||||
'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]);
|
||||
|
||||
this.mixType = this.mixType || 'mono';
|
||||
|
||||
@@ -84,6 +84,7 @@ function makeTask(logger, obj, parent) {
|
||||
const TaskTranscribe = require('./transcribe');
|
||||
return new TaskTranscribe(logger, data, parent);
|
||||
case TaskName.Listen:
|
||||
case TaskName.Stream:
|
||||
const TaskListen = require('./listen');
|
||||
return new TaskListen(logger, data, parent);
|
||||
case TaskName.Redirect:
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
"SipRedirect": "sip:redirect",
|
||||
"Say": "say",
|
||||
"SayLegacy": "say:legacy",
|
||||
"Stream": "stream",
|
||||
"Tag": "tag",
|
||||
"Transcribe": "transcribe"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user