From 7802822773276c0029dacf271102afba876c95cb Mon Sep 17 00:00:00 2001 From: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com> Date: Wed, 3 Dec 2025 19:16:25 +0700 Subject: [PATCH] fixed dial verb cannot bridge 2 leg endpoints due to transcoding (#1457) * fixed dial verb cannot bridge 2 leg endpoints due to transcoding * wip --- lib/tasks/dial.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/tasks/dial.js b/lib/tasks/dial.js index f79b7bf0..3e96b54b 100644 --- a/lib/tasks/dial.js +++ b/lib/tasks/dial.js @@ -158,7 +158,7 @@ class TaskDial extends Task { get canReleaseMedia() { const keepAnchor = this.data.anchorMedia || - this.weAreTranscoding || + this.isTranscoding || this.cs.isBackGroundListen || this.cs.onHoldMusic || ANCHOR_MEDIA_ALWAYS || @@ -773,6 +773,15 @@ class TaskDial extends Task { } async _connectSingleDial(cs, sd) { + // start connect with dialed leg, this is the soonest we can identify transcoding + if (this.epOther && sd.ep) { + const codecA = getLeadingCodec(this.epOther.local.sdp); + const codecB = getLeadingCodec(sd.ep.remote.sdp); + this.isTranscoding = (codecA !== codecB); + if (this.isTranscoding) { + this.logger.info(`Dial:_connectSingleDial - transcoding from ${codecA} (A leg) to ${codecB} (B leg)`); + } + } if (!this.bridged && !this.canReleaseMedia) { this.logger.debug('Dial:_connectSingleDial bridging endpoints'); if (this.epOther) { @@ -930,13 +939,6 @@ class TaskDial extends Task { this.logger.info({err}, 'Dial:_selectSingleDial - Error boosting audio signal'); } } - /* basic determination to see if call is being transcoded */ - const codecA = getLeadingCodec(this.epOther.local.sdp); - const codecB = getLeadingCodec(this.ep.remote.sdp); - this.weAreTranscoding = (codecA !== codecB); - if (this.weAreTranscoding) { - this.logger.info(`Dial:_selectSingleDial - transcoding from ${codecA} (A leg) to ${codecB} (B leg)`); - } /* if we can release the media back to the SBC, do so now */ if (this.canReleaseMedia || this.shouldExitMediaPathEntirely) { setTimeout(this._releaseMedia.bind(this, cs, sd, this.shouldExitMediaPathEntirely), 200);