From 05d85d96e2188fec2d344e15fded046b9e2a392e Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Sun, 10 Oct 2021 15:12:15 -0400 Subject: [PATCH] mute/unmute now handled by rtpengine --- lib/tasks/dial.js | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/lib/tasks/dial.js b/lib/tasks/dial.js index f113b7c7..8ab8b49c 100644 --- a/lib/tasks/dial.js +++ b/lib/tasks/dial.js @@ -212,22 +212,19 @@ class TaskDial extends Task { * mute or unmute one side of the call */ async mute(callSid, doMute) { - if (doMute && !this.epOther && !this.ep) { - this.logger.info('Dial:mute re-anchoring media so we can mute'); - await this.reAnchorMedia(this.callSession, this.sd); - this.epOther.bridge(this.ep); - } - if (!this.epOther || !this.ep) return this.logger.info('Dial:mute: no paired endpoint found'); + const parentCall = callSid !== this.callSid; + const dlg = parentCall ? this.callSession.dlg : this.dlg; + const hdr = `${doMute ? 'mute' : 'unmute'} call leg`; try { - const parentCall = callSid !== this.callSid; - const ep = parentCall ? this.epOther : this.ep; - await ep[doMute ? 'mute' : 'unmute'](); - this.logger.debug(`Dial:mute ${doMute ? 'muted' : 'unmuted'} ${parentCall ? 'parentCall' : 'childCall'}`); - - /* release media once mute is over, if we can */ - if (!doMute && this.canReleaseMedia) this._releaseMedia(this.callSession, this.sd); + /* let rtpengine do the mute / unmute */ + await dlg.request({ + method: 'INFO', + headers: { + 'X-Reason': hdr + } + }); } catch (err) { - this.logger.error(err, 'Dial:mute error'); + this.logger.info({err}, `Dial:mute - ${hdr} error`); } }