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
*/
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`);
}
}