mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
support listen verb support bidirectionalAudioSampleRate (#695)
* support listen verb support bidirectionalAudioSampleRate * ưip * update verb spec and drachtio fsmrf * fix listen failing testcase * fix review comment * update freeswitch test image * update freeswitch teset image --------- Co-authored-by: Dave Horton <daveh@beachdognet.com>
This commit is contained in:
@@ -8,6 +8,10 @@ const DTMF_SPAN_NAME = 'dtmf';
|
||||
class TaskListen extends Task {
|
||||
constructor(logger, opts, parentTask) {
|
||||
super(logger, opts);
|
||||
/**
|
||||
* @deprecated
|
||||
* use bidirectionalAudio.enabled
|
||||
*/
|
||||
this.disableBidirectionalAudio = opts.disableBidirectionalAudio;
|
||||
this.preconditions = TaskPreconditions.Endpoint;
|
||||
|
||||
@@ -25,6 +29,15 @@ class TaskListen extends Task {
|
||||
this.results = {};
|
||||
this.playAudioQueue = [];
|
||||
this.isPlayingAudioFromQueue = false;
|
||||
this.bidirectionalAudio = {
|
||||
enabled: this.disableBidirectionalAudio === true ? false : true,
|
||||
...(this.data['bidirectionalAudio']),
|
||||
};
|
||||
|
||||
// From drachtio-version 3.0.40, forkAudioStart will send empty bugname, metadata together with
|
||||
// bidirectionalAudio params that cause old version of freeswitch missunderstand between bugname and
|
||||
// bidirectionalAudio params
|
||||
this._bugname = 'audio_fork';
|
||||
|
||||
if (this.transcribe) this.transcribeTask = makeTask(logger, {'transcribe': opts.transcribe}, this);
|
||||
}
|
||||
@@ -133,7 +146,8 @@ class TaskListen extends Task {
|
||||
mixType: this.mixType,
|
||||
sampling: this.sampleRate,
|
||||
...(this._bugname && {bugname: this._bugname}),
|
||||
metadata
|
||||
metadata,
|
||||
bidirectionalAudio: this.bidirectionalAudio || {}
|
||||
});
|
||||
this.recordStartTime = moment();
|
||||
if (this.maxLength) {
|
||||
@@ -153,7 +167,7 @@ class TaskListen extends Task {
|
||||
}
|
||||
|
||||
/* support bi-directional audio */
|
||||
if (!this.disableBidirectionalAudio) {
|
||||
if (this.bidirectionalAudio.enabled) {
|
||||
ep.addCustomEventListener(ListenEvents.PlayAudio, this._onPlayAudio.bind(this, ep));
|
||||
}
|
||||
ep.addCustomEventListener(ListenEvents.KillAudio, this._onKillAudio.bind(this, ep));
|
||||
|
||||
Reference in New Issue
Block a user