add support for muting/unmuting non moderators in a conference

This commit is contained in:
Dave Horton
2021-09-25 12:31:20 -04:00
parent 7cf342eeb8
commit 708c13d5f6
2 changed files with 24 additions and 0 deletions

View File

@@ -468,6 +468,14 @@ class CallSession extends Emitter {
task.doConferenceHold(this, opts);
}
async _lccConfMute(callSid, mute) {
const task = this.currentTask;
if (!task || TaskName.Conference !== task.name || !this.isInConference) {
return this.logger.info('CallSession:_lccConfMute - invalid command as call is not in conference');
}
task.doConferenceMuteNonModerators(this, mute);
}
/**
* perform live call control -- whisper to one party or the other on a call
* @param {array} opts - array of play or say tasks
@@ -540,6 +548,9 @@ class CallSession extends Emitter {
else if (opts.conf_hold_status) {
await this._lccConfHoldStatus(callSid, opts);
}
else if ('mute_conference' in opts) {
await this._lccConfMute(callSid, opts.mute_conference);
}
// whisper may be the only thing we are asked to do, or it may that
// we are doing a whisper after having muted, paused reccording etc..

View File

@@ -379,6 +379,19 @@ class Conference extends Task {
this.emitter.emit('join', opts);
}
async doConferenceMuteNonModerators(cs, mute) {
assert (cs.isInConference);
this.logger.info(`Conference:doConferenceMuteNonModerators ${mute ? 'muting' : 'unmuting'} non-moderators`);
this.ep.api(`conference ${this.confName} ${mute ? 'mute' : 'unmute'} non_moderator`)
.catch((err) => this.logger.info({err}, 'Error muting or unmuting non_moderators'));
if (this.conf_hold_status !== 'hold' && this._playSession) {
this._playSession.kill();
this._playSession = null;
}
}
async doConferenceHold(cs, opts) {
assert (cs.isInConference);