mute/unmute now handled by rtpengine

This commit is contained in:
Dave Horton
2021-10-10 15:12:15 -04:00
parent 4627c0fa54
commit 05d85d96e2

View File

@@ -212,22 +212,19 @@ class TaskDial extends Task {
* mute or unmute one side of the call * mute or unmute one side of the call
*/ */
async mute(callSid, doMute) { async mute(callSid, doMute) {
if (doMute && !this.epOther && !this.ep) { const parentCall = callSid !== this.callSid;
this.logger.info('Dial:mute re-anchoring media so we can mute'); const dlg = parentCall ? this.callSession.dlg : this.dlg;
await this.reAnchorMedia(this.callSession, this.sd); const hdr = `${doMute ? 'mute' : 'unmute'} call leg`;
this.epOther.bridge(this.ep);
}
if (!this.epOther || !this.ep) return this.logger.info('Dial:mute: no paired endpoint found');
try { try {
const parentCall = callSid !== this.callSid; /* let rtpengine do the mute / unmute */
const ep = parentCall ? this.epOther : this.ep; await dlg.request({
await ep[doMute ? 'mute' : 'unmute'](); method: 'INFO',
this.logger.debug(`Dial:mute ${doMute ? 'muted' : 'unmuted'} ${parentCall ? 'parentCall' : 'childCall'}`); headers: {
'X-Reason': hdr
/* release media once mute is over, if we can */ }
if (!doMute && this.canReleaseMedia) this._releaseMedia(this.callSession, this.sd); });
} catch (err) { } catch (err) {
this.logger.error(err, 'Dial:mute error'); this.logger.info({err}, `Dial:mute - ${hdr} error`);
} }
} }