diff --git a/lib/session/call-session.js b/lib/session/call-session.js index f270d626..dd1a1df9 100644 --- a/lib/session/call-session.js +++ b/lib/session/call-session.js @@ -468,12 +468,12 @@ class CallSession extends Emitter { task.doConferenceHold(this, opts); } - async _lccConfMute(callSid, mute) { + async _lccConfMuteStatus(callSid, opts) { 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'); + return this.logger.info('CallSession:_lccConfHoldStatus - invalid command as call is not in conference'); } - task.doConferenceMuteNonModerators(this, mute); + task.doConferenceMuteNonModerators(this, opts); } /** @@ -548,8 +548,8 @@ 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); + else if (opts.conf_mute_status) { + await this._lccConfMuteStatus(callSid, opts); } // whisper may be the only thing we are asked to do, or it may that diff --git a/lib/tasks/conference.js b/lib/tasks/conference.js index ae023bac..440bbf25 100644 --- a/lib/tasks/conference.js +++ b/lib/tasks/conference.js @@ -46,7 +46,7 @@ class Conference extends Task { this.confName = this.data.name; [ - 'beep', 'startConferenceOnEnter', 'endConferenceOnExit', + 'beep', 'startConferenceOnEnter', 'endConferenceOnExit', 'joinMuted', 'maxParticipants', 'waitHook', 'statusHook', 'endHook', 'enterHook' ].forEach((attr) => this[attr] = this.data[attr]); @@ -332,6 +332,9 @@ class Conference extends Task { const opts = {}; if (this.endConferenceOnExit) Object.assign(opts, {flags: {endconf: true}}); + if (this.startConferenceOnEnter) Object.assign(opts, {flags: {moderator: true}}); + if (this.joinMuted) Object.assign(opts, {flags: {mute: true}}); + try { const {memberId, confUuid} = await this.ep.join(this.confName, opts); this.logger.debug({memberId, confUuid}, `Conference:_joinConference: successfully joined ${this.confName}`); @@ -379,7 +382,8 @@ class Conference extends Task { this.emitter.emit('join', opts); } - async doConferenceMuteNonModerators(cs, mute) { + async doConferenceMuteNonModerators(cs, opts) { + const mute = opts.conf_mute_status === 'mute'; assert (cs.isInConference); this.logger.info(`Conference:doConferenceMuteNonModerators ${mute ? 'muting' : 'unmuting'} non-moderators`); diff --git a/lib/tasks/specs.json b/lib/tasks/specs.json index 0db0ae81..0282f8c1 100644 --- a/lib/tasks/specs.json +++ b/lib/tasks/specs.json @@ -87,6 +87,7 @@ "startConferenceOnEnter": "boolean", "endConferenceOnExit": "boolean", "maxParticipants": "number", + "joinMuted": "boolean", "actionHook": "object|string", "waitHook": "object|string", "statusEvents": "array",